From 4ce4ac60b2c059d82845ba5b7bc3a86615f13e55 Mon Sep 17 00:00:00 2001 From: Chris Selzo Date: Wed, 30 Sep 2026 10:52:33 -0700 Subject: [PATCH] CI: Remove the Cloud Partner Portal publishing tasks The Windows pipelines publish through the Partner Center tasks. ai-assisted=yes [TNZ-155310] Co-Authored-By: Claude Opus 5.5 --- .../run | 256 ------------------ .../task.yml | 27 -- ci/tasks/azure-start-publishing/run | 136 ---------- ci/tasks/azure-start-publishing/task.yml | 23 -- ci/tasks/signoff-azure-live/run | 33 --- ci/tasks/signoff-azure-live/task.yml | 15 - .../wait-for-azure-marketplace-offer-live/run | 55 ---- .../task.yml | 15 - ci/tasks/wait-for-azure-publisher-signoff/run | 65 ----- .../wait-for-azure-publisher-signoff/task.yml | 15 - 10 files changed, 640 deletions(-) delete mode 100755 ci/tasks/azure-image-upload-and-start-publishing/run delete mode 100644 ci/tasks/azure-image-upload-and-start-publishing/task.yml delete mode 100755 ci/tasks/azure-start-publishing/run delete mode 100644 ci/tasks/azure-start-publishing/task.yml delete mode 100755 ci/tasks/signoff-azure-live/run delete mode 100644 ci/tasks/signoff-azure-live/task.yml delete mode 100755 ci/tasks/wait-for-azure-marketplace-offer-live/run delete mode 100644 ci/tasks/wait-for-azure-marketplace-offer-live/task.yml delete mode 100755 ci/tasks/wait-for-azure-publisher-signoff/run delete mode 100644 ci/tasks/wait-for-azure-publisher-signoff/task.yml diff --git a/ci/tasks/azure-image-upload-and-start-publishing/run b/ci/tasks/azure-image-upload-and-start-publishing/run deleted file mode 100755 index 1326e0e33..000000000 --- a/ci/tasks/azure-image-upload-and-start-publishing/run +++ /dev/null @@ -1,256 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main_version=$(cat version/number) -uri_filename='bosh-stemcell-*-azure-vhd-uri.txt' -image_url=$(cat azure-base-vhd-uri/${uri_filename}) -vhd_filename=$(basename "${image_url}" | cut -d? -f1) - -retrieve_blob_url() { - retrieve_blob_url=$( - az storage blob url \ - --container-name ${AZURE_CONTAINER_NAME} \ - --name ${vhd_filename} \ - --account-name ${AZURE_PUBLISHED_STORAGE_ACCOUNT} \ - --account-key ${AZURE_PUBLISHED_STORAGE_ACCESS_KEY} - ) - - blob_url=$(echo ${retrieve_blob_url} | sed -E 's/"//g') - - echo $blob_url -} - -create_azure_sas() { - iso8601_format='+%Y-%m-%dT%TZ' - yesterday=$(date -u --date="-1 day" $iso8601_format) - in_two_years=$(date -u --date="+2 years" $iso8601_format) - - azure_sas=$( - az storage container generate-sas --name ${AZURE_CONTAINER_NAME} \ - --permissions rl \ - --account-name ${AZURE_PUBLISHED_STORAGE_ACCOUNT} \ - --account-key ${AZURE_PUBLISHED_STORAGE_ACCESS_KEY} \ - --start ${yesterday} --expiry ${in_two_years} - ) - - sas_params=$(echo ${azure_sas} | sed -E 's/"//g') - - echo $sas_params -} - -format_version() { - main_version=$1 - version_regex='([0-9]+)\.([0-9]+)\.([0-9]+)-build\.([0-9]+)' - version_number_tokens=$(echo $main_version | sed -E "s/^$version_regex$/\1 \2 \3 \4/") - echo $version_number_tokens | awk '{ printf("%d.%d.%03d%03d", $1, $2, $3, $4) } ' -} - -create_microsoft_token() { - tenant_id=${PARTNER_PORTAL_TENANT_ID} - client_id=${PARTNER_PORTAL_CLIENT_ID} - client_secret=${PARTNER_PORTAL_CLIENT_SECRET} - grant_type="client_credentials" - resource="https://cloudpartner.azure.com" - - microsoft_auth_endpoint="https://login.microsoftonline.com/$tenant_id/oauth2/token" - token=$(curl --fail -X POST "$microsoft_auth_endpoint" \ - -F "client_id=$client_id" \ - -F "client_secret=$client_secret" \ - -F "grant_type=$grant_type" \ - -F "resource=$resource" | jq -r .access_token - ) - echo $token -} - -create_original_offer_json() { - curl --fail -X GET "$offer_id_endpoint" \ - -H "Authorization: Bearer $token" \ - -H "Content-Type: application/json" -} - -create_modified_offer_json() { - - vm_image_path=".definition.plans[] | select(.planId == \"$AZURE_SKU\") | .[\"microsoft-azure-virtualmachines.vmImages\"]" - new_vm_object="{\"$image_version\": {\"osVhdUrl\":\"$vhd_url\", \"lunVhdDetails\": []}}" - add_image_to_plan="($vm_image_path) |= . + $new_vm_object" - jq "$add_image_to_plan" "$original_offer_json" -} - -update_offer() { - sleep 10 - curl --fail -X PUT -d "@$modified_offer_json" "$offer_id_endpoint" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $token" -} - - -copy_blob_to_premiumstore() { - az storage blob copy start \ - --source-account-key "${AZURE_STORAGE_ACCESS_KEY}" \ - --source-account-name "${AZURE_STORAGE_ACCOUNT}" \ - --source-container "${AZURE_CONTAINER_NAME}" \ - --source-blob "${vhd_filename}" \ - --account-name "${AZURE_PUBLISHED_STORAGE_ACCOUNT}" \ - --account-key "${AZURE_PUBLISHED_STORAGE_ACCESS_KEY}" \ - --destination-container "${AZURE_CONTAINER_NAME}" \ - --destination-blob "${vhd_filename}" -} - -wait_for_copy_blob_to_premiumstore() { - while true; do - copy_status="$(get_copy_blob_status)" - case "${copy_status}" in - failed | aborted) - echo "Copy ${copy_status}" - exit 1 - ;; - success) - break - ;; - *) - sleep 5 - esac - done -} - -get_copy_blob_status() { - az storage blob show \ - --container-name "${AZURE_CONTAINER_NAME}" \ - --name "${vhd_filename}" \ - --account-name "${AZURE_PUBLISHED_STORAGE_ACCOUNT}" \ - --account-key "${AZURE_PUBLISHED_STORAGE_ACCESS_KEY}" | jq -r ".properties.copy.status" -} - -publish_offer() { - jq -n --arg email "${OFFER_NOTIFICATION_EMAIL}" \ - '{ "metadata": { "notification-emails": $email } }' > offer_emails.json - - publish_offer_endpoint="https://cloudpartner.azure.com/api/publishers/$AZURE_PUBLISHER/offers/$AZURE_OFFER/publish?api-version=2017-10-31" - curl --fail-with-body -X POST -d "@offer_emails.json" -vv "$publish_offer_endpoint" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $token" -} - -if [[ "${MANUALLY_BYPASS_SUBMISSION:-}" != "" ]]; then - pacific_today=$(TZ="America/Los_Angeles" date +%Y-%m-%d) - - if ! echo "${MANUALLY_BYPASS_SUBMISSION}" | grep -qE '^[0-9]{4}-[0-9]{2}-[0-9]{2}$'; then - echo "ERROR: MANUALLY_BYPASS_SUBMISSION is set to '${MANUALLY_BYPASS_SUBMISSION}' which is not a valid YYYY-MM-DD date." - echo "To bypass submission today, set MANUALLY_BYPASS_SUBMISSION to: ${pacific_today}" - exit 1 - fi - - if [[ "${MANUALLY_BYPASS_SUBMISSION}" != "${pacific_today}" ]]; then - echo "ERROR: MANUALLY_BYPASS_SUBMISSION date '${MANUALLY_BYPASS_SUBMISSION}' does not match today's Pacific date '${pacific_today}'." - echo "To bypass submission today, set MANUALLY_BYPASS_SUBMISSION to: ${pacific_today}" - exit 1 - fi - - echo "Date check passed: MANUALLY_BYPASS_SUBMISSION matches today's Pacific date (${pacific_today})." - - echo "Authenticating with Microsoft..." - token=$(create_microsoft_token) - echo OK - - offer_id_endpoint="https://cloudpartner.azure.com/api/publishers/$AZURE_PUBLISHER/offers/$AZURE_OFFER?api-version=2017-10-31" - - echo "Retrieving current offer to verify image was already added..." - original_offer_json="$PWD/original_offer.json" - create_original_offer_json > "$original_offer_json" - - image_version=$(format_version "$main_version") - blob_url=$(retrieve_blob_url) - - existing_vhd_url=$(jq -r " - .definition.plans[] | - select(.planId == \"$AZURE_SKU\") | - .[\"microsoft-azure-virtualmachines.vmImages\"][\"$image_version\"].osVhdUrl - " "$original_offer_json") - - if [[ -z "${existing_vhd_url}" || "${existing_vhd_url}" == "null" ]]; then - echo "ERROR: Image version '${image_version}' not found in offer for plan '${AZURE_SKU}'." - echo "The offer does not contain the expected image. Verify that manual submission was completed." - exit 1 - fi - - if [[ "${existing_vhd_url}" != "${blob_url}"* ]]; then - echo "ERROR: The existing osVhdUrl '${existing_vhd_url}' does not start with expected blob URL '${blob_url}'." - echo "The offer may not have been updated with the correct image." - exit 1 - fi - - echo "Image check passed: image version '${image_version}' with expected blob URL found in offer." - - echo "Checking offer status..." - offer_status_endpoint="https://cloudpartner.azure.com/api/publishers/$AZURE_PUBLISHER/offers/$AZURE_OFFER/status?api-version=2017-10-31" - offer_status_json="$PWD/offer_status.json" - curl --fail -X GET "$offer_status_endpoint" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $token" > "$offer_status_json" - - signoff_step_status=$(jq -er ".steps[] | select(.id == \"publisher-signoff\") | .status" "$offer_status_json") - - if [[ "${signoff_step_status}" == "complete" ]]; then - echo "ERROR: Offer publisher-signoff status is 'complete'. The offer has already been published." - echo "Do not use MANUALLY_BYPASS_SUBMISSION when the offer is already complete." - exit 1 - fi - - echo - echo "========================================================================" - echo "WARNING: MANUALLY BYPASSING AZURE MARKETPLACE SUBMISSION" - echo "The submission was performed manually outside of this pipeline job." - echo "All safety checks passed. Proceeding to wait-for-azure-publisher-signoff." - echo " Offer status (publisher-signoff step): ${signoff_step_status}" - echo " Bypass authorized for date: ${MANUALLY_BYPASS_SUBMISSION}" - echo "========================================================================" - echo - exit 0 -fi - -echo -n "Authenticating with Microsoft..." -echo -token=$(create_microsoft_token) -echo OK - -echo -echo "Copying Image from ${AZURE_STORAGE_ACCOUNT} to ${AZURE_PUBLISHED_STORAGE_ACCOUNT}" -copy_blob_to_premiumstore -echo OK - -echo -echo "Waiting for copy to finish from ${AZURE_STORAGE_ACCOUNT} to ${AZURE_PUBLISHED_STORAGE_ACCOUNT}" -wait_for_copy_blob_to_premiumstore -echo OK - - -offer_id_endpoint="https://cloudpartner.azure.com/api/publishers/$AZURE_PUBLISHER/offers/$AZURE_OFFER?api-version=2017-10-31" - -echo -echo "retrieving current offer details from the Partner Center API..." -original_offer_json="$PWD/original_offer.json" -echo "to debug, 'fly intercept -u ' and 'cat $original_offer_json'" -create_original_offer_json > "$original_offer_json" -echo OK - -echo -echo "adding image version and vhd url to offer json:" -modified_offer_json="$PWD/modified_offer.json" -echo "to debug, 'fly intercept -u ' and 'cat $modified_offer_json'" -image_version=$(format_version "$main_version") -echo "setting image version: $image_version" -vhd_url="$(retrieve_blob_url)?$(create_azure_sas)" -echo "VHD URL: $vhd_url" -create_modified_offer_json > "$modified_offer_json" -echo OK - -echo -echo "modifying offer details by PUTting to Partner Center API..." -echo "to debug, 'fly intercept -u ' and 'cat endstate.json'" -update_offer > "endstate.json" -echo OK - -echo -echo "Publishing offer, will notify ${OFFER_NOTIFICATION_EMAIL}" -publish_offer -echo OK diff --git a/ci/tasks/azure-image-upload-and-start-publishing/task.yml b/ci/tasks/azure-image-upload-and-start-publishing/task.yml deleted file mode 100644 index 1aaa6d89e..000000000 --- a/ci/tasks/azure-image-upload-and-start-publishing/task.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -platform: linux - -inputs: - - name: bosh-windows-stemcell-builder-ci - - name: version - - name: stemcell-builder - - name: azure-base-vhd-uri - -run: - path: bosh-windows-stemcell-builder-ci/ci/tasks/azure-image-upload-and-start-publishing/run - -params: - AZURE_STORAGE_ACCESS_KEY: - AZURE_STORAGE_ACCOUNT: - AZURE_PUBLISHED_STORAGE_ACCESS_KEY: - AZURE_PUBLISHED_STORAGE_ACCOUNT: - AZURE_CONTAINER_NAME: - AZURE_SKU: - AZURE_PUBLISHER: - AZURE_OFFER: - PARTNER_PORTAL_TENANT_ID: - PARTNER_PORTAL_CLIENT_ID: - PARTNER_PORTAL_CLIENT_SECRET: - OFFER_NOTIFICATION_EMAIL: - MANUALLY_BYPASS_SUBMISSION: - diff --git a/ci/tasks/azure-start-publishing/run b/ci/tasks/azure-start-publishing/run deleted file mode 100755 index b2e6b36ec..000000000 --- a/ci/tasks/azure-start-publishing/run +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -main_version=$(cat version/number) -uri_filename='bosh-stemcell-*-azure-vhd-uri.txt' -image_url=$(cat "azure-base-vhd-uri/${uri_filename}") -vhd_path=$(echo "${image_url}" | sed -E 's/^.*(Microsoft\.Compute\/Images\/.*vhd).*$/\1/') - -retrieve_blob_url() { - retrieve_blob_url=$( - az storage blob url \ - --container-name "${AZURE_CONTAINER_NAME}" \ - --name "${vhd_path}" \ - --account-name "${AZURE_PUBLISHED_STORAGE_ACCOUNT}" \ - --account-key "${AZURE_PUBLISHED_STORAGE_ACCESS_KEY}" - ) - - blob_url=$(echo "${retrieve_blob_url}" | sed -E 's/"//g') - - echo "${blob_url}" -} - -create_azure_sas() { - iso8601_format='+%Y-%m-%dT%TZ' - yesterday=$(date -u --date="-1 day" ${iso8601_format}) - in_two_years=$(date -u --date="+2 years" ${iso8601_format}) - - azure_sas=$( - az storage container generate-sas --name "${AZURE_CONTAINER_NAME}" \ - --permissions rl \ - --account-name "${AZURE_PUBLISHED_STORAGE_ACCOUNT}" \ - --account-key "${AZURE_PUBLISHED_STORAGE_ACCESS_KEY}" \ - --start "${yesterday}" --expiry "${in_two_years}" - ) - - sas_params=$(echo "${azure_sas}" | sed -E 's/"//g') - - echo "${sas_params}" -} - -format_version() { - main_version=${1} - version_regex='([0-9]+)\.([0-9]+)\.([0-9]+)-build\.([0-9]+)' - version_number_tokens=$(echo "${main_version}" | sed -E "s/^${version_regex}$/\1 \2 \3 \4/") - echo "${version_number_tokens}" | awk '{ printf("%d.%d.%03d%03d", $1, $2, $3, $4) } ' -} - -create_microsoft_token() { - tenant_id=${PARTNER_PORTAL_TENANT_ID} - client_id=${PARTNER_PORTAL_CLIENT_ID} - client_secret=${PARTNER_PORTAL_CLIENT_SECRET} - grant_type="client_credentials" - resource="https://cloudpartner.azure.com" - - microsoft_auth_endpoint="https://login.microsoftonline.com/${tenant_id}/oauth2/token" - token=$(curl --fail -X POST "${microsoft_auth_endpoint}" \ - -F "client_id=${client_id}" \ - -F "client_secret=${client_secret}" \ - -F "grant_type=${grant_type}" \ - -F "resource=${resource}" | jq -r .access_token - ) - echo "${token}" -} - -create_original_offer_json() { - curl -vv --fail -X GET "${offer_id_endpoint}" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer ${token}" -} - -create_modified_offer_json() { - - vm_image_path=".definition.plans[] | select(.planId == \"${AZURE_SKU}\") | .[\"microsoft-azure-virtualmachines.vmImages\"]" - new_vm_object="{\"${image_version}\": {\"osVhdUrl\":\"${vhd_url}\", \"lunVhdDetails\": []}}" - add_image_to_plan="(${vm_image_path}) |= . + ${new_vm_object}" - jq "${add_image_to_plan}" "${original_offer_json}" -} - -update_offer() { - sleep 10 - curl -vv --fail -X PUT -d "@${modified_offer_json}" "${offer_id_endpoint}" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer ${token}" -} - -publish_offer() { - jq -n --arg email "${OFFER_NOTIFICATION_EMAIL}" \ - '{ "metadata": { "notification-emails": $email } }' > offer_emails.json - - publish_offer_endpoint="https://cloudpartner.azure.com/api/publishers/${AZURE_PUBLISHER}/offers/${AZURE_OFFER}/publish?api-version=2017-10-31" - curl -vv --fail -X POST -d "@offer_emails.json" "${publish_offer_endpoint}" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer ${token}" -} - -echo -n "Authenticating with Microsoft..." -echo -token=$(create_microsoft_token) -echo OK - -offer_id_endpoint="https://cloudpartner.azure.com/api/publishers/${AZURE_PUBLISHER}/offers/${AZURE_OFFER}?api-version=2017-10-31" - -echo -echo "retrieving current offer details from the Partner Center API..." - -original_offer_json="${PWD}/original_offer.json" -echo "to debug, 'fly intercept -u ' and 'cat ${original_offer_json}'" - -create_original_offer_json > "${original_offer_json}" -echo OK - -echo -echo "adding image version and vhd url to offer json:" - -modified_offer_json="${PWD}/modified_offer.json" -echo "to debug, 'fly intercept -u ' and 'cat ${modified_offer_json}'" - -image_version=$(format_version "${main_version}") -echo "setting image version: ${image_version}" - -vhd_url="$(retrieve_blob_url)?$(create_azure_sas)" -echo "VHD URL: ${vhd_url}" - -create_modified_offer_json > "${modified_offer_json}" -echo OK - -echo -echo "modifying offer details by PUTting to Partner Center API..." -echo "to debug, 'fly intercept -u ' and 'cat endstate.json'" -update_offer > "endstate.json" -echo OK - -echo -echo "Publishing offer, will notify ${OFFER_NOTIFICATION_EMAIL}" -publish_offer -echo OK diff --git a/ci/tasks/azure-start-publishing/task.yml b/ci/tasks/azure-start-publishing/task.yml deleted file mode 100644 index 8b2b4d159..000000000 --- a/ci/tasks/azure-start-publishing/task.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -platform: linux - -inputs: - - name: bosh-windows-stemcell-builder-ci - - name: version - - name: stemcell-builder - - name: azure-base-vhd-uri - -run: - path: bosh-windows-stemcell-builder-ci/ci/tasks/azure-start-publishing/run - -params: - AZURE_PUBLISHED_STORAGE_ACCESS_KEY: - AZURE_PUBLISHED_STORAGE_ACCOUNT: - AZURE_CONTAINER_NAME: - AZURE_SKU: - AZURE_PUBLISHER: - AZURE_OFFER: - PARTNER_PORTAL_TENANT_ID: - PARTNER_PORTAL_CLIENT_ID: - PARTNER_PORTAL_CLIENT_SECRET: - OFFER_NOTIFICATION_EMAIL: diff --git a/ci/tasks/signoff-azure-live/run b/ci/tasks/signoff-azure-live/run deleted file mode 100755 index 2b3994a3b..000000000 --- a/ci/tasks/signoff-azure-live/run +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -set -eu -o pipefail - -create_microsoft_token() { - tenant_id=${PARTNER_PORTAL_TENANT_ID} - client_id=${PARTNER_PORTAL_CLIENT_ID} - client_secret=${PARTNER_PORTAL_CLIENT_SECRET} - grant_type="client_credentials" - resource="https://cloudpartner.azure.com" - - microsoft_auth_endpoint="https://login.microsoftonline.com/$tenant_id/oauth2/token" - token=$(curl -X POST $microsoft_auth_endpoint \ - -F "client_id=$client_id" \ - -F "client_secret=$client_secret" \ - -F "grant_type=$grant_type" \ - -F "resource=$resource" | jq -r .access_token - ) - echo $token -} - -go_live_endpoint="https://cloudpartner.azure.com/api/publishers/$AZURE_PUBLISHER/offers/$AZURE_OFFER/golive?api-version=2017-10-31" -click_go_live() { - token=$(create_microsoft_token) - curl --fail -X POST $go_live_endpoint \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $token" \ - -d "" -} - -echo "Clicking 'Go Live'..." -click_go_live -echo OK - diff --git a/ci/tasks/signoff-azure-live/task.yml b/ci/tasks/signoff-azure-live/task.yml deleted file mode 100644 index 2c9526258..000000000 --- a/ci/tasks/signoff-azure-live/task.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -platform: linux - -inputs: - - name: bosh-windows-stemcell-builder-ci - -run: - path: bosh-windows-stemcell-builder-ci/ci/tasks/signoff-azure-live/run - -params: - AZURE_PUBLISHER: - AZURE_OFFER: - PARTNER_PORTAL_TENANT_ID: - PARTNER_PORTAL_CLIENT_ID: - PARTNER_PORTAL_CLIENT_SECRET: \ No newline at end of file diff --git a/ci/tasks/wait-for-azure-marketplace-offer-live/run b/ci/tasks/wait-for-azure-marketplace-offer-live/run deleted file mode 100755 index f7a8ae527..000000000 --- a/ci/tasks/wait-for-azure-marketplace-offer-live/run +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash -set -eu -o pipefail - -create_microsoft_token() { - tenant_id=${PARTNER_PORTAL_TENANT_ID} - client_id=${PARTNER_PORTAL_CLIENT_ID} - client_secret=${PARTNER_PORTAL_CLIENT_SECRET} - grant_type="client_credentials" - resource="https://cloudpartner.azure.com" - - microsoft_auth_endpoint="https://login.microsoftonline.com/$tenant_id/oauth2/token" - token=$(curl -X POST $microsoft_auth_endpoint \ - -F "client_id=$client_id" \ - -F "client_secret=$client_secret" \ - -F "grant_type=$grant_type" \ - -F "resource=$resource" | jq -r .access_token - ) - echo $token -} - -retrieve_offer_status_json() { - curl -X GET $offer_status_endpoint \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $token" -} - -check_offer_is_live() { - echo -n "authenticating with microsoft..." - token=$(create_microsoft_token) - retrieve_offer_status_json > offer_status_json - offer_status=$(jq -r .status offer_status_json) - live_step_status=$(jq -r ".steps[] | select(.id == \"live\") | .status" offer_status_json) - while [[ $offer_status != "succeeded" || $live_step_status != "complete" ]]; do - echo "At time $(date), offer is not live yet" - sleep 1h - token=$(create_microsoft_token) - retrieve_offer_status_json > offer_status_json - offer_status=$(jq -r .status offer_status_json) - live_step_status=$(jq -r ".steps[] | select(.id == \"live\") | .status" offer_status_json) - done -} - -offer_status_endpoint="https://cloudpartner.azure.com/api/publishers/$AZURE_PUBLISHER/offers/$AZURE_OFFER/status?api-version=2017-10-31" - - -echo "===============================================================================================" -echo "This is a long running job that can run for up to 5 days before it reaches a Concourse timeout." -echo "===============================================================================================" -echo -echo "Checking to see if the Marketplace Offer is live..." -check_offer_is_live -echo "The publish step has completed. It can take up to 4 more hours for the offer to be visible in the marketplace..." -sleep 4h -echo "Offer is Live!" - diff --git a/ci/tasks/wait-for-azure-marketplace-offer-live/task.yml b/ci/tasks/wait-for-azure-marketplace-offer-live/task.yml deleted file mode 100644 index 4cb30ddf4..000000000 --- a/ci/tasks/wait-for-azure-marketplace-offer-live/task.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -platform: linux - -inputs: - - name: bosh-windows-stemcell-builder-ci - -run: - path: bosh-windows-stemcell-builder-ci/ci/tasks/wait-for-azure-marketplace-offer-live/run - -params: - AZURE_PUBLISHER: - AZURE_OFFER: - PARTNER_PORTAL_TENANT_ID: - PARTNER_PORTAL_CLIENT_ID: - PARTNER_PORTAL_CLIENT_SECRET: diff --git a/ci/tasks/wait-for-azure-publisher-signoff/run b/ci/tasks/wait-for-azure-publisher-signoff/run deleted file mode 100755 index ed8d42d15..000000000 --- a/ci/tasks/wait-for-azure-publisher-signoff/run +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash -set -eu -o pipefail - -create_microsoft_token() { - tenant_id=${PARTNER_PORTAL_TENANT_ID} - client_id=${PARTNER_PORTAL_CLIENT_ID} - client_secret=${PARTNER_PORTAL_CLIENT_SECRET} - grant_type="client_credentials" - resource="https://cloudpartner.azure.com" - - microsoft_auth_endpoint="https://login.microsoftonline.com/$tenant_id/oauth2/token" - token=$(curl -X POST $microsoft_auth_endpoint \ - -F "client_id=$client_id" \ - -F "client_secret=$client_secret" \ - -F "grant_type=$grant_type" \ - -F "resource=$resource" | jq -r .access_token - ) - echo $token -} - -retrieve_offer_status_json() { - curl -X GET $offer_status_endpoint \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $token" -} - -checking_status() { - echo -n "authenticating with microsoft..." - token=$(create_microsoft_token) - retrieve_offer_status_json > offer_status_json - echo "Full offer status json response is: $(cat offer_status_json)" - original_publishing_version=$(jq -r ".publishingVersion" offer_status_json) - signoff_step_status=$(jq -r ".steps[] | select(.id == \"publisher-signoff\") | .status" offer_status_json) - while [[ $signoff_step_status != "waitingForPublisherReview" ]]; do - echo "At time $(date), offer is waiting for publisher sign off: ${signoff_step_status}" - if [[ "$signoff_step_status" == "complete" ]]; then - echo "Status is marked as 'complete'. We are expecting the status to become 'waitingForPublisherReview'. We may be trying to re-publish a previously published version." - exit 1 - fi - sleep 30m - token=$(create_microsoft_token) - retrieve_offer_status_json > offer_status_json - publishing_version=$(jq -r ".publishingVersion" offer_status_json) - if [[ "${original_publishing_version}" -gt "${publishing_version}" ]]; then - echo "The offer no longer exists, it was probably rejected" - exit 1 - fi - if [[ "${original_publishing_version}" -lt "${publishing_version}" ]]; then - echo "The offer has been superseded by a newer offer. We are now waiting for that offering to be successful" - original_publishing_version=${publishing_version} - fi - signoff_step_status=$(jq -r ".steps[] | select(.id == \"publisher-signoff\") | .status" offer_status_json) - echo "Full offer status json response is: $(cat offer_status_json)" - done -} - -offer_status_endpoint="https://cloudpartner.azure.com/api/publishers/$AZURE_PUBLISHER/offers/$AZURE_OFFER/status?api-version=2017-10-31" - -echo "===============================================================================================" -echo "This is a long running job that can run for up to 7 days before it reaches a Concourse timeout." -echo "===============================================================================================" -echo -echo "Waiting for 'Go Live' to be available..." -checking_status -echo "The 'Go Live' is available." diff --git a/ci/tasks/wait-for-azure-publisher-signoff/task.yml b/ci/tasks/wait-for-azure-publisher-signoff/task.yml deleted file mode 100644 index 5a85bdcf5..000000000 --- a/ci/tasks/wait-for-azure-publisher-signoff/task.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -platform: linux - -inputs: - - name: bosh-windows-stemcell-builder-ci - -run: - path: bosh-windows-stemcell-builder-ci/ci/tasks/wait-for-azure-publisher-signoff/run - -params: - AZURE_PUBLISHER: - AZURE_OFFER: - PARTNER_PORTAL_TENANT_ID: - PARTNER_PORTAL_CLIENT_ID: - PARTNER_PORTAL_CLIENT_SECRET: \ No newline at end of file