Skip to content

Build E2E image within build_artifacts to skip base-image re-pull#28471

Open
9larsons wants to merge 4 commits into
mainfrom
ci/e2e-image-warm-cache
Open

Build E2E image within build_artifacts to skip base-image re-pull#28471
9larsons wants to merge 4 commits into
mainfrom
ci/e2e-image-warm-cache

Conversation

@9larsons

Copy link
Copy Markdown
Contributor

What

Folds the separate Build E2E Docker Image job into job_build_artifacts. The ghost-e2e image is now built FROM the production full image while it is still warm in that job's BuildKit cache, then pushed — instead of a separate runner that re-pulled the entire production image just to add a trivial layer and re-push it.

Why

On the E2E critical path (Setup → Build & Publish Artifacts → Build E2E Docker Image → E2E Tests), the E2E image job spent ~2 min almost entirely moving data: ~54s docker pull of the freshly-built production image, ~30s fresh-runner setup, and ~39s build/push — all to apply e2e/Dockerfile.e2e, which is just a COPY of the public-app UMD bundles plus 6 ENV vars. The base image already existed in the prior job's BuildKit cache.

Changes

  • Delete job_build_e2e_image; build & push ghost-e2e at the end of job_build_artifacts.
  • Registry path: reuse the same buildx builder so FROM resolves the just-pushed full layers from cache (no re-pull).
  • Fork / artifact path: build the e2e image on a host docker-driver builder so FROM resolves the locally-loaded image; the docker-image-e2e tarball is saved/uploaded as before.
  • job_build_artifacts downloads the e2e-public-apps artifact at the late e2e step and is not added to needs (that would delay the job's start ~1.4 min and cancel the saving; public-apps finishes ~3 min, well before the step is reached).
  • Rewire job_e2e_tests and job_required_tests off the deleted job.
  • The deployed production image is unchanged — ghost-e2e stays a separate tag.

Expected impact

~90–110s off the E2E-lane critical path.

Verify on a real run

  • Registry path: the in-job "Build & push E2E image" BuildKit log should show the full base served from cache, not a full re-pull.
  • Fork path: the host-driver e2e build resolves the locally-loaded image and the docker-image-e2e artifact is produced and consumed by job_e2e_tests.

The separate Build E2E Docker Image job re-pulled the entire production image
(~54s) onto a fresh runner just to add a trivial COPY layer (public-app UMD
bundles + env) and re-push it. Fold that build into job_build_artifacts, where
the production 'full' image is still warm in the BuildKit cache, so the e2e
image resolves its base from cache instead of a full re-pull.

- Delete job_build_e2e_image; build & push ghost-e2e at the end of
  job_build_artifacts (registry path) / save as artifact (fork path).
- Preserve both distribution paths; use a host docker-driver buildx builder on
  the artifact path so FROM resolves the locally-loaded image.
- Rewire job_e2e_tests and job_required_tests to the new source.
- ghost-e2e stays a separate tag; the deployed production image is unchanged.
- Do not gate job_build_artifacts start on public-apps; download that artifact
  at the late e2e step to avoid delaying the job's start.
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 00849dfe-6b46-4a5d-b049-fd6e738545c8

📥 Commits

Reviewing files that changed from the base of the PR and between 13bca09 and d452ffc.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Walkthrough

The CI workflow now builds the ghost-e2e Docker image inside job_build_artifacts (resolving the production full-image base, extracting e2e-public-apps, optionally configuring Buildx for artifact paths), exposes the resulting tags as job_build_artifacts.outputs.image-e2e-tags, and rewires job_e2e_tests to depend on and consume that output. job_build_e2e_image is removed and job_required_tests.needs is updated to drop the removed job.

Possibly related PRs

  • TryGhost/Ghost#28105: Modifies the same CI workflow’s image build/load logic around job_build_artifacts and full-image inspection.
  • TryGhost/Ghost#28001: Rewires E2E-related job gating and needs/if conditions in the CI workflow.
  • TryGhost/Ghost#28206: Updates job_required_tests dependency wiring in the same workflow area.

Suggested reviewers

  • rob-ghost
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving E2E image building into the build_artifacts job to avoid re-pulling the base image.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the what, why, changes, and expected impact of folding the E2E image job into build_artifacts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/e2e-image-warm-cache

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.75%. Comparing base (e74ebb9) to head (d452ffc).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #28471      +/-   ##
==========================================
- Coverage   73.75%   73.75%   -0.01%     
==========================================
  Files        1541     1541              
  Lines      132219   132193      -26     
  Branches    15825    15819       -6     
==========================================
- Hits        97516    97494      -22     
+ Misses      33737    33732       -5     
- Partials      966      967       +1     
Flag Coverage Δ
e2e-tests 75.91% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@9larsons 9larsons requested a review from rob-ghost June 10, 2026 01:13
@9larsons

Copy link
Copy Markdown
Contributor Author

@rob-ghost I'll clean up the comments after review. Mind taking a pass? I suspect you kept these separate in order to speed up the CD workflows.

@rob-ghost rob-ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm following correctly, we were waiting around for public UMD apps to build the docker images, when in reality we don't need them except for e2e images, so split them up so we can leverage the build cache.

I don't think this has downstream impact because only the e2e bakes in the UMD apps, public and pro use NPM CDN to deliver these IIRC.

@9larsons 9larsons marked this pull request as ready for review June 12, 2026 00:13
@nx-cloud

nx-cloud Bot commented Jun 12, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit d452ffc

Command Status Duration Result
nx run ghost:test:ci:integration ✅ Succeeded 2m 25s View ↗
nx run ghost:test:ci:e2e ✅ Succeeded 11m 45s View ↗
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 10m 21s View ↗
nx build @tryghost/announcement-bar ✅ Succeeded <1s View ↗
nx build @tryghost/sodo-search ✅ Succeeded <1s View ↗
nx build @tryghost/signup-form ✅ Succeeded <1s View ↗
nx build @tryghost/portal ✅ Succeeded 1s View ↗
nx build @tryghost/admin-toolbar ✅ Succeeded <1s View ↗
Additional runs (15) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-12 00:58:31 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 1047-1053: The "Download public app artifacts (e2e)" step races
with the producer; add a readiness guard by depending on or polling for the
producer job/artifact before downloading: either add an explicit needs:
job_build_e2e_public_apps dependency to the job that contains the "Download
public app artifacts (e2e)" and "Extract public app artifacts (e2e)" steps, or
insert a short retry/poll step (using e.g. actions/github-script or a curl loop
against the Actions artifacts API) that waits for the e2e-public-apps artifact
to exist and succeeds before running the download step, so the download step
always finds the artifact and avoids flakes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 12053f89-4244-4f38-b9df-e39e349eac74

📥 Commits

Reviewing files that changed from the base of the PR and between 700746d and a0f2aca.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/ci.yml
9larsons added 2 commits June 11, 2026 19:35
The E2E image build now runs inside the artifacts job, so the public app artifact can be requested before its producer finishes. Polling keeps the artifacts job's early start while ensuring download-artifact only runs once the artifact exists.
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.

2 participants