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
diff --git a/jjb/pipeline/xos-synchronizer-update.groovy b/jjb/pipeline/xos-synchronizer-update.groovy
index d2cdfda..96251d9 100644
--- a/jjb/pipeline/xos-synchronizer-update.groovy
+++ b/jjb/pipeline/xos-synchronizer-update.groovy
@@ -12,8 +12,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// Run XOS api tests after changing the containers to use the `candidate`
-// parent, which may include synchronizer changes
+// Run XOS api tests after changing the containers to use the current XOS
+// container versions as parent, which may include synchronizer framework
+// changes
 
 CORE_CONTAINER="null"
 
@@ -109,22 +110,36 @@
       }
     }
 
-    stage('candiate tag') {
+    stage('tag update') {
       steps {
         sh """
+           #!/usr/bin/env bash
+           set -eu -o pipefail
+
            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:candidate/" "\$df"
+               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
            """
       }
     }
@@ -218,7 +233,7 @@
            #!/usr/bin/env bash
            set -eu -o pipefail
 
-           helm_install_args='-f examples/image-tag-candidate.yaml -f examples/imagePullPolicy-IfNotPresent.yaml -f examples/api-test-values.yaml'
+           helm_install_args='-f examples/image-tag-candidate.yaml -f examples/imagePullPolicy-IfNotPresent.yaml -f examples/api-test-values.yaml -f $WORKSPACE/xos_tags.yaml'
 
            pushd cord/helm-charts