X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fpacker-build.sh;h=b85c31a794369557bcc1831834bab380329b8a79;hb=eafdcafcbe25dbad05e5117aca20bf6ea048ac44;hp=3349a723374af0c7f5f7d3c1115b4a1c5e08e592;hpb=eccb60c2014c1dfed187ad0d783a57664fac3086;p=releng%2Fglobal-jjb.git diff --git a/shell/packer-build.sh b/shell/packer-build.sh index 3349a723..b85c31a7 100644 --- a/shell/packer-build.sh +++ b/shell/packer-build.sh @@ -53,8 +53,9 @@ then elif [[ "${GIT_BASE:-}" =~ https://github.com ]]; then LAST_CHANGE_SHA=$(git log --no-merges -1 --format=%H) API_BASE=$(echo "$GIT_BASE" | sed -E 's#(www.)?github.com#api.github.com/repos#') - STATUS=$(curl "${API_BASE}/statuses/${LAST_CHANGE_SHA}" \ - | jq ".[] | select(.state == \"success\" and .context == \"Packer ${PACKER_PLATFORM}-${PACKER_TEMPLATE} Verify Build\")") + CONTEXT_VALUE="\"Packer ${PACKER_PLATFORM}-${PACKER_TEMPLATE} Verify Build\"" + JQ_QUERY=".[] | select(.state == \"success\" and .context == ${CONTEXT_VALUE})" + STATUS=$(curl "${API_BASE}/statuses/${LAST_CHANGE_SHA}" | jq "${JQ_QUERY}") if [[ -n ${STATUS} ]]; then echo "Build already successful for this patch set. Skipping merge build..." exit @@ -63,12 +64,13 @@ fi set +x packer.io build -color=false \ + -only "${PACKER_BUILDER}" \ -var-file="$CLOUDENV" \ -var-file="$platform_file" \ "templates/$PACKER_TEMPLATE.json" # Extract image name from log and store value in the downstream job -if [[ ${UPDATE_CLOUD_IMAGE} ]]; then +if [[ ${UPDATE_CLOUD_IMAGE} == 'true' ]]; then NEW_IMAGE_NAME=$(grep -P '(\s+.*image: )(ZZCI\s+.*\d+-\d+\.\d+)' \ "$PACKER_BUILD_LOG" | awk -F': ' '{print $4}')