diff --git a/images/oc-build-deploy-dind/build-deploy.sh b/images/oc-build-deploy-dind/build-deploy.sh index 19f24e1dda..0a542f81f5 100755 --- a/images/oc-build-deploy-dind/build-deploy.sh +++ b/images/oc-build-deploy-dind/build-deploy.sh @@ -18,14 +18,6 @@ else /oc-build-deploy/scripts/git-checkout-pull.sh "$SOURCE_REPOSITORY" "$GIT_REF" fi -INJECT_GIT_SHA=$(cat .lagoon.yml | shyaml get-value environment_variables.git_sha false) -if [ "$INJECT_GIT_SHA" == "true" ] -then - LAGOON_GIT_SHA=`git rev-parse HEAD` -else - LAGOON_GIT_SHA="0000000000000000" -fi - if [[ -n "$SUBFOLDER" ]]; then cd $SUBFOLDER fi @@ -34,6 +26,14 @@ if [ ! -f .lagoon.yml ]; then echo "no .lagoon.yml file found"; exit 1; fi +INJECT_GIT_SHA=$(cat .lagoon.yml | shyaml get-value environment_variables.git_sha false) +if [ "$INJECT_GIT_SHA" == "true" ] +then + LAGOON_GIT_SHA=`git rev-parse HEAD` +else + LAGOON_GIT_SHA="0000000000000000" +fi + DOCKER_REGISTRY_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) docker login -u=jenkins -p="${DOCKER_REGISTRY_TOKEN}" ${OPENSHIFT_REGISTRY}