diff --git a/.github/workflows/module-release.yml b/.github/workflows/module-release.yml index ad4a61c..04ffe5c 100644 --- a/.github/workflows/module-release.yml +++ b/.github/workflows/module-release.yml @@ -283,11 +283,16 @@ jobs: # reports success even though GitHub Pages deduplicated the request and # skipped serving the newly uploaded artifact (wso2/wso2-cli#209). # - # Polling the live origin guarantees that this job fails rather than - # reporting a false positive when the released version was not actually served. + # Polling the live origin lets this job fail rather than report success + # when the released version is not served. A Pages change can take up to + # 10 minutes to publish and the CDN caches each file for max-age=600, + # regardless of query string, so polling runs until an 11-minute deadline. - name: Verify the released version is served live + timeout-minutes: 15 env: PAGE_URL: ${{ steps.deploy.outputs.page_url }} + DEADLINE_SECONDS: '660' + INTERVAL_SECONDS: '15' run: | set -euo pipefail @@ -307,13 +312,15 @@ jobs: check_index_version=true fi - echo "Verifying ${namespace} v${version} is served live at ${module_endpoint} and ${index_endpoint}..." - for attempt in $(seq 1 18); do - ts="$(date +%s)" + echo "Verifying ${namespace} v${version} is served live at ${module_endpoint} and ${index_endpoint} (deadline ${DEADLINE_SECONDS}s)..." + deadline=$(( $(date +%s) + DEADLINE_SECONDS )) + attempt=0 + while true; do + attempt=$(( attempt + 1 )) module_ok=false index_ok=false - if module_content="$(curl --connect-timeout 5 --max-time 10 -fsSL "${module_endpoint}?t=${ts}" 2>/dev/null)"; then + if module_content="$(curl --connect-timeout 5 --max-time 10 -fsSL "${module_endpoint}" 2>/dev/null)"; then if jq -e --arg ver "${version}" \ '.versions[] | select(.version == $ver)' \ <<<"${module_content}" >/dev/null 2>&1; then @@ -321,7 +328,7 @@ jobs: fi fi - if index_content="$(curl --connect-timeout 5 --max-time 10 -fsSL "${index_endpoint}?t=${ts}" 2>/dev/null)"; then + if index_content="$(curl --connect-timeout 5 --max-time 10 -fsSL "${index_endpoint}" 2>/dev/null)"; then if [ "${check_index_version}" = "true" ]; then if jq -e --arg ns "${namespace}" --arg ver "${version}" \ '.modules[] | select(.namespace == $ns) | .channels[] | select(.version == $ver)' \ @@ -342,11 +349,17 @@ jobs: exit 0 fi - echo "Waiting for GitHub Pages deployment to serve ${namespace} v${version} (attempt ${attempt}/18)..." - sleep 5 + remaining=$(( deadline - $(date +%s) )) + if [ "${remaining}" -le 0 ]; then + break + fi + pause=$(( remaining < INTERVAL_SECONDS ? remaining : INTERVAL_SECONDS )) + echo "Waiting for GitHub Pages to serve ${namespace} v${version} (attempt ${attempt}, ${remaining}s left)..." + sleep "${pause}" done - echo "::error::The published catalog on GitHub Pages does not serve ${namespace} v${version} in index.json and modules/${namespace}.json" - echo "::error::GitHub Pages skips deployments when two module releases share the same commit SHA (${GITHUB_SHA})" + echo "::error::The published catalog on GitHub Pages does not serve ${namespace} v${version} in index.json and modules/${namespace}.json after ${DEADLINE_SECONDS}s (${attempt} attempts)" + echo "::error::The likely cause is a deduplicated deploy: GitHub Pages skips deployments when two module releases share the same commit SHA (${GITHUB_SHA})" + echo "::error::Re-running failed jobs will not recover a deduplicated deploy, because the re-run deploys the same SHA" echo "::error::Workaround: push a new commit to main and trigger the 'Catalog origin' workflow (pages.yml)" exit 1