Skip to content

Build/Test Tools: Cache and retry WP-CLI downloads - #14789

Draft
lucatume wants to merge 1 commit into
WordPress:trunkfrom
lucatume:wp-cli-install-cache
Draft

lucatume wants to merge 1 commit into
WordPress:trunkfrom
lucatume:wp-cli-install-cache

Conversation

@lucatume

Copy link
Copy Markdown

Installs WP-CLI in dedicated steps instead of the shivammathur/setup-php tools input in install-testing.yml, reusable-upgrade-testing.yml and reusable-performance-test-v2.yml:

  • The phar is cached with actions/cache in 6 hour windows (<os>-wp-cli-<version>-<window>), so jobs keep getting the latest WP-CLI without each downloading it.
  • On a cache miss it's downloaded with curl --fail --retry 5 --retry-all-errors.
  • If the download keeps failing, the previous window's phar (via restore-keys) is used with a warning; with none, the step fails with an error.
  • PHP 5.4/5.5 install jobs keep WP-CLI 2.4.0.

setup-php downloads the phar with a single unauthenticated curl -sL (unix.sh) and on failure only logs ✗ wp-cli Could not setup wp-cli, leaving the step green (add_tools.sh). Jobs then fail on the first wp command with wp: command not found (exit 127). The HTTP status is discarded, so the logs don't show the cause; failures come in bursts (22/24 "Upgrade from" jobs in run 38059129117). Other examples: 38055702872, 39166479056.

Testing on a fork preview (lucatume/wordpress-develop#29, with the repository guards pointed at the fork):

  • Upgrade Tests: 236 jobs installed WP-CLI 2.12.0; the first 24 missed the cache and downloaded, 212 restored it. The one failed job is unrelated (cURL error 35 from downloads.w.org during wp core update --minor).
  • Installation Tests: all 70 jobs restored the cache.
  • Not exercised there: the Performance "base" jobs and the PHP 5.4/5.5 (2.4.0) install jobs, and the retry/fallback paths, which were tested locally against a server returning 503s.

Trac ticket: TBD

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Investigating the failures, implementing the change and verifying it on the fork; reviewed by me.


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.

The install, upgrade, and performance test jobs installed WP-CLI
through the setup-php `tools` input. setup-php downloads the phar with
a single unauthenticated curl call, and when that returns an error it
only logs "Could not setup wp-cli" and lets the step pass. The job then
fails on the first `wp` command with "command not found". Bursts of
these failures have broken most jobs of whole upgrade testing runs.

Install WP-CLI in dedicated steps instead. The phar is cached in
6 hour windows, so jobs still pick up new WP-CLI releases without each
of them downloading it. A cache miss downloads with curl retries; if
that keeps failing, the previous window's phar is used with a warning,
and without one the step fails, reporting the error where it happens.
PHP 5.4 and 5.5 install jobs keep using WP-CLI 2.4.0.
@lucatume lucatume self-assigned this Oct 23, 2026
@lucatume
lucatume requested a review from adimoldovan October 23, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant