Move env:pull auto-retry logic to docker.js - #12937
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
irozum
left a comment
There was a problem hiding this comment.
This cleanly generalizes the retry-on-pull logic from the CI-only bash loop (r62857) into docker.js itself, so it benefits env:pull wherever it's invoked, not just the reusable PHPUnit workflow. It also correctly leaves every other docker.js subcommand (down, run, exec, etc.) untouched, since maxAttempts is only >1 when the first arg is pull.
Since a real registry timeout isn't reliably reproducible, I stubbed a fake docker binary on PATH to exercise the loop directly: a fail-fail-succeed sequence retries at 10s then 20s and exits 0 on the third attempt, an always-failing pull exhausts exactly 3 attempts and exits non-zero, and a non-pull command (down) fails immediately with no retry/sleep at all. All three matched the ticket's spec exactly. The synchronous Atomics.wait sleep is a reasonable choice here given this is a blocking CLI wrapper with no concurrent I/O to preserve.
No blocking concerns. I couldn't run the JS lint step — wp-scripts lint-js is currently broken in my checkout on an unrelated zod dependency resolution error that reproduces on trunk too — but the diff's style (tabs, single quotes, template literals) matches the rest of the file.
This moves the retry mechanism added in r62857 from the GitHub Actions workflow to the
env:pullcommand, which is a benefit any time the command is run, not just in the PHPUnit workflow.Trac ticket: Core-65722
Use of AI Tools
Claude Code created the initial draft of this PR.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.