Make WordPress Core

Opened 2 days ago

Closed 36 hours ago

#65722 closed task (blessed) (fixed)

Retry transient Docker image pull failures in PHPUnit workflows

Reported by: lancewillett Owned by: lancewillett
Priority: normal Milestone: 7.1
Component: Build/Test Tools Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

The reusable PHPUnit workflow starts its Docker environment through npm run env:start. Docker Compose pulls the required images during that step.

Problem

A transient Docker Hub connection timeout currently aborts the job immediately. Reported errors include:

Client.Timeout exceeded while awaiting headers
context deadline exceeded

The affected image varies, indicating a registry or network failure rather than an image-specific problem. A large matrix increases the chance that one failed pull fails the run.

Proposed change

Add an explicit image-pull step immediately before environment startup.

The step:

  • Pulls wordpress-develop, php, mysql, and cli.
  • Adds memcached only when enabled.
  • Makes at most three pull attempts.
  • Waits 10 seconds after the first failure and 20 seconds after the second.
  • Reports the error and exits after the third failure.

Successfully pulled images remain locally cached for env:start.

Verification

A real Docker Hub timeout cannot be triggered reliably.

Verification completed:

  • Simulated a failed first attempt followed by a successful real pull.
  • Confirmed three simulated failures stopped after exactly three attempts.
  • Confirmed memcached was included only when enabled.
  • Started a PHP 8.4 and MySQL 8.4 environment using the cached images.
  • Completed npm run env:install.
  • Passed actionlint and workflow whitespace checks.

Possible follow-up

Docker Hub authentication could provide stronger protection and higher pull limits. That requires repository credentials and should be considered separately.

Change History (3)

This ticket was mentioned in PR #12703 on WordPress/wordpress-develop by @lancewillett.


2 days ago
#1

  • Keywords has-patch added

## Summary

This pre-pulls the Docker images used by the reusable PHPUnit workflow before env:start.

The pull retries at most three times, waiting 10 seconds after the first failure and 20 seconds after the second.

The service list matches the existing Compose context. It pulls wordpress-develop, php, mysql, and cli, adding memcached only when enabled.

## Why

Transient Docker Hub connection timeouts currently fail the affected matrix job immediately. The affected image varies, indicating a registry or network failure rather than an image-specific
problem.

Successfully pulled images remain cached for environment startup.

The real timeout is nondeterministic and was not reproduced.

## Testing

  • Passed actionlint and workflow whitespace checks.
  • Simulated a failed first attempt followed by a successful real pull.
  • Confirmed three simulated failures stopped after exactly three attempts.
  • Confirmed memcached was included only when enabled.
  • Started a PHP 8.4 and MySQL 8.4 environment using the pre-pulled images.
  • Confirmed MySQL became healthy.
  • Completed npm run env:install.

## Possible follow-up

Docker Hub authentication could provide stronger protection and higher pull limits. That requires repository credentials and should be considered separately.

#2 @johnbillion
36 hours ago

  • Milestone Awaiting Review7.1
  • Type defect (bug)task (blessed)

#3 @lancewillett
36 hours ago

  • Owner set to lancewillett
  • Resolutionfixed
  • Status newclosed

In 62857:

Build/Test Tools: Retry Docker image pulls in PHPUnit workflows.

Transient Docker registry failures (Docker Hub / GHCR pull timeouts and "premature close" errors) intermittently fail the PHPUnit jobs. Wrap the image pulls in a bounded retry with backoff.

Developed in: https://github.com/WordPress/wordpress-develop/pull/12703

Props barry, adrianmoldovanwp
Fixes #65722

Note: See TracTickets for help on using tickets.