X-Git-Url: https://gerrit.nordix.org/gitweb?a=blobdiff_plain;f=jjb%2Fcloud-infra%2Fscripts%2Fgenerate-change-metadata.sh;h=878735d2c5b667a1a8f60944c1c54841c74ee92e;hb=4a03190d37a5ae619bb049f8142fb466070b046f;hp=73f889748eb8e892450a88d52c1eb01f911ddd19;hpb=a41cb97c1eb86df7fd495dff15100b2e7a005a0c;p=infra%2Fcicd.git diff --git a/jjb/cloud-infra/scripts/generate-change-metadata.sh b/jjb/cloud-infra/scripts/generate-change-metadata.sh index 73f88974..878735d2 100755 --- a/jjb/cloud-infra/scripts/generate-change-metadata.sh +++ b/jjb/cloud-infra/scripts/generate-change-metadata.sh @@ -43,7 +43,7 @@ function determine_dependency() { echo "Info : Processing change $DEPENDENT_CHANGE_ID" declare -a DEPENDENT_CHANGE_METADATA readarray -t DEPENDENT_CHANGE_METADATA < <(curl -s "https://gerrit.nordix.org/changes/?q=$DEPENDENT_CHANGE_ID&o=CURRENT_REVISION" 2>&1 \ - | grep "project\|status\|current_revision\|ref.*," | sed -e 's/\s//g' -e 's/,//g' -e 's/"//g'| cut -d: -f2) + | grep "project\|status\|current_revision\|ref\".*," | sed -e 's/\s//g' -e 's/,//g' -e 's/"//g'| cut -d: -f2) # NOTE (fdegir): check if the dependeny change exists # and ignore if it doesn't @@ -103,6 +103,17 @@ echo "Info : Generating change metadata" # this scripts is used by all engine repos so we need to determine what this change is for export ENGINE_COMPONENT="${GERRIT_PROJECT//*\//}" +# Check if we need to override the deploy scenario. +if ! echo "$GERRIT_CHANGE_COMMIT_MESSAGE" | grep -qs "^Deploy-Scenario:"; then + echo "Info : No DEPLOY_SCENARIO override found." +else + echo "Info : DEPLOY_SCENARIO override found!" + echo "Info : Before override: DEPLOY_SCENARIO=${DEPLOY_SCENARIO}" + DEPLOY_SCENARIO=$(echo "$GERRIT_CHANGE_COMMIT_MESSAGE" | grep '^Deploy-Scenario:' | cut -d ":" -f2 | sed 's/\s*//g') + export DEPLOY_SCENARIO + echo "Info : After override: DEPLOY_SCENARIO=${DEPLOY_SCENARIO}" +fi + echo "Info : Setting STACK_TYPE and STACK_VERSION" if [[ "$GERRIT_PROJECT" =~ /stack/ ]]; then # set vars @@ -141,8 +152,10 @@ elif [[ "$GERRIT_PROJECT" =~ /installer/ ]]; then echo "NORDIX_$(echo $ENGINE_COMPONENT | tr a-z A-Z)_VERSION=$GERRIT_PATCHSET_REVISION" >> "$CHANGE_METADATA_FILE" echo "NORDIX_$(echo $ENGINE_COMPONENT | tr a-z A-Z)_REFSPEC=$GERRIT_REFSPEC" >> "$CHANGE_METADATA_FILE" else + # NOTE (fdegir): if the change comes into provisioner repos, we need to set the stack type + # properly for the jobs verifying those changes # set vars - export STACK_TYPE=kubernetes + export STACK_TYPE="${STACK_TYPE:-kubernetes}" export STACK_VERSION=$GERRIT_BRANCH # record vars to properties file