Strict checking that XOS is using SemVer version

Tag and use new XOS version when testing

Change-Id: Idda46440f885c4f4ee4e6aa0bace379a7587f480
diff --git a/jjb/pipeline/all-xos-api-test-helm.groovy b/jjb/pipeline/all-xos-api-test-helm.groovy
index bc83a81..4e1384b 100644
--- a/jjb/pipeline/all-xos-api-test-helm.groovy
+++ b/jjb/pipeline/all-xos-api-test-helm.groovy
@@ -109,6 +109,44 @@
       }
     }
 
+    stage('tag update') {
+      steps {
+        sh """
+           #!/usr/bin/env bash
+           set -eu -o pipefail
+
+           # skip projects that aren't the XOS core repository
+           if [ "${gerrit_project}" != "xos" ]; then
+             exit 0
+           fi
+
+           echo "" > \${WORKSPACE}/updated_dockerfiles
+           XOS_MAJOR=\$(cut -b 1 cord/orchestration/xos/VERSION)
+           XOS_VERSION=\$(cat cord/orchestration/xos/VERSION)
+
+           # update services
+           for df in cord/orchestration/xos_services/*/Dockerfile.synchronizer cord/orchestration/profiles/*/Dockerfile.synchronizer
+           do
+             df_contents=\$(cat "\$df")
+             if [[ "\$df_contents" =~ "FROM xosproject/xos-synchronizer-base:\${XOS_MAJOR}" ||
+                   "\$df_contents" =~ "FROM xosproject/xos-synchronizer-base:master" ]]
+             then
+               sed -i "s/^FROM\\(.*\\):.*\$/FROM\\1:\$XOS_VERSION/" "\$df"
+               echo "\${WORKSPACE}/\$df" >> \${WORKSPACE}/updated_dockerfiles
+             fi
+           done
+
+           # create values file with core version tags
+           cat << EOF > \${WORKSPACE}/xos_tags.yaml
+           ---
+           xos_coreImage: 'xosproject/xos-core:\$(XOS_VERSION}'
+           xos_chameleonImage: 'xosproject/chameleon:\$(XOS_VERSION}'
+           xos_toscaImage: 'xosproject/xos-tosca:\$(XOS_VERSION}'
+
+           EOF
+           """
+      }
+    }
 
     stage('prep') {
       parallel {
@@ -170,6 +208,11 @@
 
            helm_install_args='-f examples/image-tag-candidate.yaml -f examples/imagePullPolicy-IfNotPresent.yaml -f examples/api-test-values.yaml'
 
+           # skip projects that aren't the XOS core repository
+           if [ "${gerrit_project}" != "xos" ]; then
+             helm_install_args+=' -f $WORKSPACE/xos_tags.yaml'
+           fi
+
            pushd cord/helm-charts
 
            helm dep up xos-core