Merge changes from topic 'fix-monit-script'
[releng.git] / utils / calculate_version.sh
index 5dccc07..cf929dd 100755 (executable)
@@ -1,15 +1,17 @@
 #!/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
+##############################################################################
 
-#
-# Authors:
-#      Jose Lausuch <jose.lausuch@ericsson.com>
-#      Fatih Degirmenci <fatih.degirmenci@ericsson.com>
-#
 # Calculates and generates the version tag for the OPNFV objects:
 #     - Docker images
 #     - ISOs
-#     - Artifcats
-#
+#     - Artifacts
 
 info ()  {
     logger -s -t "Calculate_version.info" "$*"
@@ -33,15 +35,18 @@ function docker_version() {
     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
-        error "The Docker Image ${docker_image} does not have a TAG with base version ${BASE_VERSION}"
+        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
-    tag=$(echo $tag_json | awk '{print $2}' | sed 's/\,//' | sed 's/\"//g')
-    #e.g.: tag=brahmaputra.0.2
-    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}
 }