Skip to content

feat(ci): allow re-running tests without recreating docker images - #4676

Draft
hsuan-lun-chiang wants to merge 3 commits into
mainfrom
rerun-docker-tests
Draft

feat(ci): allow re-running tests without recreating docker images#4676
hsuan-lun-chiang wants to merge 3 commits into
mainfrom
rerun-docker-tests

Conversation

@hsuan-lun-chiang

Copy link
Copy Markdown
Collaborator

Overview

Addresses b/408067759: Re-run tests without having to recreate image.

When MaxText tests fail or flake, Docker images were previously deleted or required an unconditional slow rebuild. This PR introduces three user-selectable modes for running Docker tests locally and on XPK:

  1. Re-run all steps including building image (--mode=build-all, default):
    Rebuilds both the base dependency image and the runner image before executing tests.
  2. Re-run just the tests, using the same image (including same code) (--mode=test-only or --reuse-image):
    Skips all image building and directly re-runs tests inside the existing Docker image without deleting it on failure.
  3. Rebuild the image using the same dependencies, only new code (--mode=fast-rebuild or --fast-rebuild):
    Skips rebuilding the slow base dependency layer and rebuilds only the runner code image (maxtext_runner.Dockerfile) without --no-cache.

Changes Included

  • New script: src/dependencies/scripts/run_docker_test.sh & Python wrapper src/dependencies/scripts/run_docker_test.py (registered as run_maxtext_docker_test in pyproject.toml).
  • Fast rebuild support: Updated docker_upload_runner.sh and build_upload_colocated_python_image.sh to support FAST_REBUILD=true (and CLEANUP_IMAGE=false) to reuse Docker layer cache.
  • XPK Workload support: Added reuse_image=True and fast_rebuild=True flags to WorkloadConfig in benchmarks/maxtext_xpk_runner.py.
  • Unit Tests: Added tests/unit/run_docker_test_test.py verifying CLI flags and XPK command generation.
  • Documentation: Updated docs/tutorials/build_maxtext.md with a dedicated section on re-running tests without rebuilding images.

Implements the three user-selectable modes for running MaxText tests in Docker containers without recreating or deleting images:
1. build-all: re-run all steps including building base and runner image
2. test-only: re-run just the tests using existing image without rebuild
3. fast-rebuild: rebuild runner image over cached dependencies without --no-cache

Fixes b/408067759.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

…ution

Allows users running GitHub Actions test workflows via workflow_dispatch to select the execution mode from a dropdown:
- build-all: rebuild all docker images and run tests
- test-only: skip image building and run CI tests against existing image
- fast-rebuild: rebuild docker image without --no-cache to reuse dependency cache
Allows manually triggering ci_pipeline with mode=test-only to skip package building and run tests directly.
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