Skip to content

Retry the GitHub Pages deploy when the artifact is not found yet - #5060

Merged
Mpdreamz merged 3 commits into
mainfrom
feature/plagued-github-actions-bug
Nov 27, 2026
Merged

Mpdreamz merged 3 commits into
mainfrom
feature/plagued-github-actions-bug

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

The Pages deploy in the publish action and in prerelease.yml now retries when actions/deploy-pages cannot find the artifact it just uploaded.

Affects: Deploys & previews

Prompt summary: Docs-builder hits the same GitHub Pages artifact bug as other repos. The author asks to apply the same retry fix to the docs-builder actions, and to check elastic/docs-actions and elastic/docs-internal-workflows for the same problem.

Why

actions/deploy-pages can look for the artifact before the lookup API lists it. The deploy then fails with No artifacts named "github-pages" were found, although the upload succeeded. Re-running the job fails too, because the second upload leaves two artifacts. actions/deploy-pages#451 reports delays from under a second to about 46 seconds. The upstream fix, #455, is still open.

What

Deploy retries

The artifact is uploaded once. The deploy step runs with continue-on-error. Up to three retries follow, after waits of 5, 20 and 60 seconds. Each retry runs only if the previous attempt failed. The last retry fails the job if it also fails. A comment marks the steps for removal once #455 ships.

Only fast failures retry

A missing artifact fails within a second, and deploy-pages sets no output that names the cause. Each retry waits behind a gate step that times the previous attempt. A failure after two minutes or more, such as a Pages status timeout, fails the job at once. A slow failure therefore cannot hold the deploy concurrency slot for four attempts.

Page URL output

When a retry succeeds, the first deploy step has no page_url. The page_url output of the publish action and the environment URL in prerelease.yml fall back across all four attempts.

Out of scope: elastic/docs-actions and elastic/docs-internal-workflows do not use the Pages actions, so they need no change.

Verify

ruby -ryaml -e 'ARGV.each { |f| YAML.load_file(f) }' actions/publish/action.yml .github/workflows/prerelease.yml

The retry path itself is untested, because the failure is intermittent. The first real run of the publish action or prerelease.yml after merge exercises the steps. A failed first attempt shows as a tolerated failure followed by a retry.

🤖 Generated with Claude Code

actions/deploy-pages can look for the artifact before it is visible and fail with "No artifacts named github-pages were found" (actions/deploy-pages#451). Re-running the job then fails on duplicate artifacts. The deploy step now retries up to three times after 5, 20 and 60 seconds, and the page URL output falls back across the attempts. Remove the retries once actions/deploy-pages#455 is released.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner November 26, 2026 16:42
@Mpdreamz
Mpdreamz requested a review from akira28 November 26, 2026 16:42
@Mpdreamz Mpdreamz added the automation packaging, ci/cd. label Nov 26, 2026
Comment thread .github/workflows/prerelease.yml Resolved
Comment on lines +69 to +73
- name: Deploy artifact (retry 1)
id: deployment-retry-1
if: steps.deployment.outcome == 'failure'
uses: actions/[email protected]
continue-on-error: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: P3 (Low)

Add a deterministic runner test for the retry path. Parsing the YAML doesn't verify that a tolerated failure actually starts the next attempt, that a successful retry exposes its page_url, or that exhausting retries fails the caller. A stub deploy step can exercise both recovery and exhaustion without waiting for the artifact race.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not adding one here. The behaviour that matters is how the runner treats continue-on-error, outcome and step if conditions, and the repo has no workflow-runner test harness to stub deploy-pages against. I tested the gate's time check on its own. The first real deploy after merge exercises the rest.

A missing artifact fails within a second. A deploy that ran for 30 seconds or more, such as a Pages status timeout, is not a lookup miss, and retrying it could hold the deploy concurrency slot for four attempts. Each retry now waits behind a gate that fails the job when the previous attempt ran that long.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comment thread .github/workflows/prerelease.yml Resolved
@github-actions

Copy link
Copy Markdown
Contributor

The gate infers the cause from elapsed time, because deploy-pages sets no output on failure. A 30 second cutoff could treat a fast lookup miss as slow after a runner pause. Two minutes sits far above a lookup miss and far below the 10 minute deploy timeout.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
STARTED: ${{ steps.deploy-start.outputs.t }}
run: |
elapsed=$(( $(date +%s) - STARTED ))
if [ "$elapsed" -ge 120 ]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: P3 (Low)

The 120-second cutoff lets both the prerelease workflow and the publish action retry failures that happen after Pages has already found the artifact and started deploying. For example, a deployment that fails during status polling after 60 seconds now triggers another deployment; if all attempts fail the same way, the prerelease job holds its concurrency slot for over five minutes instead of failing after one. If artifact lookup needs a two-minute window, retry the lookup itself rather than widening the retry window for the entire deploy.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the trade-off the cutoff has to make, and the previous review comment pulled the other way (30 seconds was too tight). The cutoff is the only signal available: deploy-pages has no output for the cause, so a step cannot retry just the lookup. Worst case, a deploy that fails at 119 seconds on every attempt holds the slot for about nine minutes (four attempts plus 85 seconds of waits). A status timeout (10 minutes) still stops after one attempt. I would rather bound that cost than risk skipping the retry for the failure this PR targets. Once actions/deploy-pages#455 ships, the retries and the gate go away. Leaving the cutoff at two minutes.

@Mpdreamz
Mpdreamz merged commit 7f490cb into main Nov 27, 2026
47 checks passed
@Mpdreamz
Mpdreamz deleted the feature/plagued-github-actions-bug branch November 27, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation packaging, ci/cd.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants