fixing workspace variable in pipeline scripts
Change-Id: I6d4977cf729c45604c11d4cb0b243884d1482a27
diff --git a/jjb/pipeline/all-xos-api-test-helm.groovy b/jjb/pipeline/all-xos-api-test-helm.groovy
index 73e9dd7..63904ee 100644
--- a/jjb/pipeline/all-xos-api-test-helm.groovy
+++ b/jjb/pipeline/all-xos-api-test-helm.groovy
@@ -115,12 +115,13 @@
#!/usr/bin/env bash
set -eu -o pipefail
+ echo "" > $WORKSPACE/xos_tags.yaml
# skip projects that aren't the XOS core repository
- if [ "${gerrit_project}" != "xos" ]; then
+ if [ "$GERRIT_PROJECT" != "xos" ]; then
exit 0
fi
- echo "" > \${WORKSPACE}/updated_dockerfiles
+ echo "" > $WORKSPACE/updated_dockerfiles
XOS_MAJOR=\$(cut -b 1 cord/orchestration/xos/VERSION)
XOS_VERSION=\$(cat cord/orchestration/xos/VERSION)
@@ -128,21 +129,21 @@
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}" ||
+ 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
+ echo "$WORKSPACE/\$df" >> $WORKSPACE/updated_dockerfiles
fi
done
# create values file with core version tags
# not indented because heredoc requires it
- cat << EOF > \${WORKSPACE}/xos_tags.yaml
+ 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}'
+xos_coreImage: 'xosproject/xos-core:\$XOS_VERSION'
+xos_chameleonImage: 'xosproject/chameleon:\$XOS_VERSION'
+xos_toscaImage: 'xosproject/xos-tosca:\$XOS_VERSION'
EOF
"""
}
@@ -209,7 +210,7 @@
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
+ if [ "$GERRIT_PROJECT" != "xos" ]; then
helm_install_args+=' -f $WORKSPACE/xos_tags.yaml'
fi
diff --git a/jjb/pipeline/xos-synchronizer-update.groovy b/jjb/pipeline/xos-synchronizer-update.groovy
index a4c715e..208d8b4 100644
--- a/jjb/pipeline/xos-synchronizer-update.groovy
+++ b/jjb/pipeline/xos-synchronizer-update.groovy
@@ -116,7 +116,8 @@
#!/usr/bin/env bash
set -eu -o pipefail
- echo "" > \${WORKSPACE}/updated_dockerfiles
+ echo "" > $WORKSPACE/xos_tags.yaml
+ echo "" > $WORKSPACE/updated_dockerfiles
XOS_MAJOR=\$(cut -b 1 cord/orchestration/xos/VERSION)
XOS_VERSION=\$(cat cord/orchestration/xos/VERSION)
@@ -124,21 +125,21 @@
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}" ||
+ 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
+ echo "$WORKSPACE/\$df" >> $WORKSPACE/updated_dockerfiles
fi
done
# create values file with core version tags
# not indented because heredoc requires it
- cat << EOF > \${WORKSPACE}/xos_tags.yaml
+ 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}'
+xos_coreImage: 'xosproject/xos-core:\$XOS_VERSION'
+xos_chameleonImage: 'xosproject/chameleon:\$XOS_VERSION'
+xos_toscaImage: 'xosproject/xos-tosca:\$XOS_VERSION'
EOF
"""
}