perf(ci): cache the release image locally during the crane copy#9702
Open
eliotlim wants to merge 1 commit into
Open
perf(ci): cache the release image locally during the crane copy#9702eliotlim wants to merge 1 commit into
eliotlim wants to merge 1 commit into
Conversation
The ECR copy uses crane (registry-to-registry), so the image never lands on the runner's docker daemon. The static-assets step extracts apps/frontend/dist with `docker run`, so it then pulled the whole ~22-layer image itself — a ~12s extract became ~96s (run 28495610216, step 13). crane hadn't removed the pull, only moved it downstream. Pull the image in the background while crane copies to ECR (independent transfers of the same image), then tag it as the ECR ref locally. By the time the static-assets step runs the image is already on the daemon, so `docker run` does no pull and the extract drops back to ~12s. The pull is now hidden behind the ~37s crane copy instead of adding to the deploy's critical path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Improves release-tag deploy CI performance by ensuring the release image is present on the GitHub Actions runner’s local Docker daemon while still doing a fast registry-to-registry copy to ECR.
Changes:
- Starts a background
docker pullof the GHCR release image whilecrane copyruns to ECR. - Waits for the pull to finish, then tags the locally pulled image with the ECR reference used by later steps.
- Expands inline documentation explaining why both transfers are needed and how this reduces the critical path.
Comment on lines
+230
to
+234
| docker pull "$SRC_IMAGE" & | ||
| pull_pid=$! | ||
| crane copy "$SRC_IMAGE" "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | ||
| wait "$pull_pid" | ||
| docker tag "$SRC_IMAGE" "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" |
Comment on lines
232
to
+234
| crane copy "$SRC_IMAGE" "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | ||
| wait "$pull_pid" | ||
| docker tag "$SRC_IMAGE" "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
crane landed in #9690, but it copies the release image GHCR to ECR registry-to-registry, so the image never lands on the runner's docker daemon. The "Copy Static Assets" step extracts
apps/frontend/distwithdocker run, which then pulls the whole ~22-layer image itself. That turned a ~12s extract into ~96s on release 7.34.4 (run 28495610216, step 13). The Datadog sourcemaps step beside it is only ~1s, so the cost is entirely the pull, not the uploads.Solution
Pull the image in the background while
crane copyruns (independent transfers of the same image), thendocker tagit as the ECR ref locally. By the time the static-assets step runs the image is already on the daemon, sodocker rundoes no pull and the extract drops back to ~12s. The pull now hides behind the ~37s crane copy instead of adding to the deploy's critical path.Breaking Changes
Improvements:
Tests
This only runs on release-tagged deploys (the crane reuse path), so a branch push can't exercise it (stg-alt2 builds from scratch). Watch the next release's app deploy: "Copy pre-built image to ECR" should show a
docker pullrunning alongside crane, and "Copy Static Assets" should have no "Pulling fs layer" lines.Deploy Notes
None.