ci: cache orchestrator-runtime image build via GHA cache#97
ci: cache orchestrator-runtime image build via GHA cache#97renecannao merged 1 commit intomasterfrom
Conversation
The previous change moved `apt-get install curl sqlite3` from runtime into the Dockerfile, but still re-ran apt on every matrix job on every run. That still hits Canonical's mirror every time, and a PR already caught a ~116s hang on `archive.ubuntu.com` in one of the 12 matrix jobs (docker build exit 100). Switch to docker/build-push-action with type=gha cache. After the first successful build, subsequent jobs restore the image from the GitHub Actions cache and skip apt entirely unless the Dockerfile changes.
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
📝 WalkthroughWalkthroughThe pull request replaces Docker build commands in GitHub Actions workflow with a modern two-step process: setting up Docker Buildx and using the Docker build-push action with caching capabilities. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/functional.yml (2)
58-69: Consider deduplicating the repeated Buildx/build step block.The same block appears in three jobs; extracting it into a reusable workflow/composite action (or YAML anchor) would reduce drift risk when you tweak cache/tag/build settings later.
Also applies to: 202-213, 336-347
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/functional.yml around lines 58 - 69, The "Set up Docker Buildx" and "Build orchestrator runtime image" steps are duplicated across multiple jobs; refactor them into a single reusable unit (either a reusable workflow or a composite action / YAML anchor) and replace the repeated blocks with calls to that unit to avoid drift. Locate the steps named "Set up Docker Buildx" and "Build orchestrator runtime image" in the workflow, extract their uses: docker/setup-buildx-action@v3 and docker/build-push-action@v6 configuration (context, file, tags, load, cache-from, cache-to) into the new reusable workflow/composite action (or anchor), then update each job to invoke the reusable workflow or reference the anchor so cache/tag/build settings are maintained in one place.
58-69: If you want deterministic first-run cache hits, add a dedicated cache-prewarm job.Because matrix jobs run in parallel, Line 68–69 cache population/restore timing can race on the first run. A small prewarm job (build runtime image once, then
needsfor matrix jobs) makes the “one job warms, others hit cache” behavior consistent.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/functional.yml around lines 58 - 69, Add a small dedicated cache-prewarm job that builds the orchestrator runtime image once to populate the GHA cache before matrix jobs run; create a job (e.g., name it cache-prewarm) using docker/build-push-action@v6 with the same context/tests/functional/orchestrator-runtime.Dockerfile, the same tags and cache-to: type=gha,mode=max,scope=orchestrator-runtime so it writes the cache, and then make your existing matrix job(s) that currently run the "Build orchestrator runtime image" step declare needs: cache-prewarm so they run after the prewarm and get deterministic first-run cache hits.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/functional.yml:
- Around line 58-69: The "Set up Docker Buildx" and "Build orchestrator runtime
image" steps are duplicated across multiple jobs; refactor them into a single
reusable unit (either a reusable workflow or a composite action / YAML anchor)
and replace the repeated blocks with calls to that unit to avoid drift. Locate
the steps named "Set up Docker Buildx" and "Build orchestrator runtime image" in
the workflow, extract their uses: docker/setup-buildx-action@v3 and
docker/build-push-action@v6 configuration (context, file, tags, load,
cache-from, cache-to) into the new reusable workflow/composite action (or
anchor), then update each job to invoke the reusable workflow or reference the
anchor so cache/tag/build settings are maintained in one place.
- Around line 58-69: Add a small dedicated cache-prewarm job that builds the
orchestrator runtime image once to populate the GHA cache before matrix jobs
run; create a job (e.g., name it cache-prewarm) using
docker/build-push-action@v6 with the same
context/tests/functional/orchestrator-runtime.Dockerfile, the same tags and
cache-to: type=gha,mode=max,scope=orchestrator-runtime so it writes the cache,
and then make your existing matrix job(s) that currently run the "Build
orchestrator runtime image" step declare needs: cache-prewarm so they run after
the prewarm and get deterministic first-run cache hits.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 93260ffc-a096-406c-b71f-2e6d0fc8a6a6
📒 Files selected for processing (1)
.github/workflows/functional.yml
Summary
apt-get installon every CI run, and we already saw one PR fail whenarchive.ubuntu.comhung for 116s on a single job (exit code 100 from docker build).Build orchestrator runtime imagesteps from rawdocker buildtodocker/build-push-action@v6withcache-from/cache-to: type=gha,scope=orchestrator-runtime. After the first successful build, every subsequent job restores the image from the GitHub Actions cache and skips apt entirely — apt only runs again when the Dockerfile changes.Test plan
Summary by CodeRabbit