summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-11-22 16:29:20 +0100
committerjose.lausuch <jose.lausuch@ericsson.com>2016-11-28 10:24:21 +0100
commitd84b20c90908bfa4e2e544f06b422226b67e2b26 (patch)
tree7c918003f8390a2b140822b237763b7583a19b50 /utils
parent3dd256b66f19f382eb3cdb27719af48c84e84804 (diff)
Refactor Docker build jobs
- Remove incremental tags for stable branches - Use "latest" or "stable" tags only - Have a single job template for all projects More info here: https://wiki.opnfv.org/display/INF/Docker+handling+in+CI Change-Id: Ibce3ef2faee136f56f0eab12dfe7a93c267db854 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/calculate_version.sh136
1 files changed, 0 insertions, 136 deletions
diff --git a/utils/calculate_version.sh b/utils/calculate_version.sh
deleted file mode 100755
index cf929dd5e..000000000
--- a/utils/calculate_version.sh
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/bin/bash
-# SPDX-license-identifier: Apache-2.0
-##############################################################################
-# Copyright (c) 2016 Ericsson AB and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-# Calculates and generates the version tag for the OPNFV objects:
-# - Docker images
-# - ISOs
-# - Artifacts
-
-info () {
- logger -s -t "Calculate_version.info" "$*"
-}
-
-
-error () {
- logger -s -t "Calculate_version.error" "$*"
- exit 1
-}
-
-
-#Functions which calculate the version
-function docker_version() {
- docker_image=$1
- url_repo="https://registry.hub.docker.com/v2/repositories/${docker_image}/"
- url_tag="https://registry.hub.docker.com/v2/repositories/${docker_image}/tags/"
- status=$(curl -s --head -w %{http_code} ${url_repo} -o /dev/null)
- if [ "${status}" != "200" ]; then
- error "Cannot access ${url_repo}. Does the image ${docker_image} exist?"
- fi
- tag_json=$(curl $url_tag 2>/dev/null | python -mjson.tool | grep ${BASE_VERSION} | head -1)
- #e.g. tag_json= "name": "brahmaputra.0.2",
- #special case, for dovetail, not sync with release, tag_json name not headed with arno, etc
- if [ "${tag_json}" == "" ]; then
- echo ${BASE_VERSION}.0
- else
- tag=$(echo $tag_json | awk '{print $2}' | sed 's/\,//' | sed 's/\"//g')
- #e.g.: tag=brahmaputra.0.2
- #special case, for dovetail, not sync with release
- tag_current_version=$(echo $tag | sed 's/.*\.//')
- tag_new_version=$(($tag_current_version+1))
- #e.g.: tag=brahmaputra.0.3
- echo ${BASE_VERSION}.${tag_new_version}
- fi
-}
-
-
-function artifact_version() {
- # To be done
- error "Not supported yet..."
-}
-
-
-STORAGE_TYPES=(docker artifactrepo)
-TYPE=""
-NAME=""
-
-
-usage="Calculates the version text of one of the following objects.
-
-usage:
- bash $(basename "$0") [-h|--help] -t|--type docker|artifactrepo -n|--name <object_name>
-
-where:
- -h|--help show this help text
- -t|--type specify the storage location
- -n|--name name of the repository/object
-
-examples:
- $(basename "$0") -t docker -n opnfv/functest
- $(basename "$0") -t artifactrepo -n fuel"
-
-
-
-
-# Parse parameters
-while [[ $# > 0 ]]
- do
- key="$1"
- case $key in
- -h|--help)
- echo "$usage"
- exit 0
- shift
- ;;
- -t|--type)
- TYPE="$2"
- shift
- ;;
- -n|--name)
- NAME="$2"
- shift
- ;;
- *)
- error "unknown option $1"
- exit 1
- ;;
- esac
- shift # past argument or value
-done
-
-if [ -z "$BASE_VERSION" ]; then
- error "Base version must be specified as environment variable. Ex.: export BASE_VERSION='brahmaputra.0'"
-fi
-
-if [ "${TYPE}" == "" ]; then
- error "Please specify the type of object to get the version from. $usage"
-fi
-
-if [ "${NAME}" == "" ]; then
- error "Please specify the name for the given storage type. $usage"
-fi
-
-not_in=1
-for i in "${STORAGE_TYPES[@]}"; do
- if [[ "${TYPE}" == "$i" ]]; then
- not_in=0
- fi
-done
-if [ ${not_in} == 1 ]; then
- error "Unknown type: ${TYPE}. Available storage types are: [${STORAGE_TYPES[@]}]"
-fi
-
-
-#info "Calculating version for object '${TYPE}' with arguments '${INFO}'..."
-if [ "${TYPE}" == "docker" ]; then
- docker_version $NAME
-
-elif [ "${TYPE}" == "artifactrepo" ]; then
- artifact_version $NAME
-fi