mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 01:39:51 +01:00
331e1a9fd3891b5be21d6bb1cd7edab58cd29fce
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3b3c6e4f5f |
ci: pre-warm base image layers during docker build for PID 1 probe (#22945)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Master Docker image publication in `.github/workflows/docker.yml` verifies that PID 1 reaps orphaned processes on the exact pushed digest (`docker run --pull always "$IMAGE_NAME@$IMAGE_DIGEST"`) > - Because `Build and push by digest` runs inside BuildKit (`docker-container` driver) on a fresh runner, the local Docker daemon starts empty and the PID 1 probe spends ~2m 50s–3m 06s downloading and extracting unchanged base layers before running the 8-second probe > - Pre-warming the local Docker daemon in the background from the newest already-published ancestor master image while Buildx builds and pushes hides ~2+ minutes of layer download and extraction behind the 4–5 minute build > - This pull request adds `scripts/docker-pid1-prewarm.sh` (`start`/`stop`) and wires it into `build-and-push` on AWS master pushes without changing BuildKit, image digests, or the `--pull always` verification check > - The benefit is cutting ~2+ minutes off master image publication on both `amd64` and `arm64` legs while preserving every provenance and PID 1 safety check ## Linked Issues or Issue Description **What existing behavior does this improve?** The `Verify PID 1 reaps orphaned processes` step in `.github/workflows/docker.yml` (`build-and-push`). **Subsystem affected** Cross-cutting (multiple of the above) **Current behavior** After `Build and push by digest` pushes the new digest from BuildKit to GHCR, `Verify PID 1 reaps orphaned processes` runs `docker run --rm -i --pull always "$IMAGE_NAME@$IMAGE_DIGEST"` on an empty local Docker daemon, spending ~2m 50s–3m 06s downloading and extracting unchanged base layers before running the 8-second orphan-reaping script. **Proposed behavior** On canonical AWS master pushes (when not promoting a merge-queue image), `docker.yml` starts a non-blocking background `docker pull` of the newest published ancestor master image (checking `HEAD~1`..`HEAD~10` with `docker manifest inspect`) right before `Build and push by digest`. Before `docker run --pull always` (and in an `if: always()` cleanup step), `scripts/docker-pid1-prewarm.sh stop` waits briefly or stops the background `docker pull` process cleanly. **Reason and benefit** Hides ~2+ minutes of base-layer download and extraction behind `Build and push by digest` on both `amd64` and `arm64`, speeding up master Docker image publication while still verifying the exact pushed digest from GHCR. **Breaking changes** None. BuildKit inputs, image digests, and the `--pull always "$IMAGE_NAME@$IMAGE_DIGEST"` probe are unchanged. ## What Changed - Added `scripts/docker-pid1-prewarm.sh` with `start` (finds newest published `HEAD~1`..`HEAD~10` `:sha-<commit>` image via `docker manifest inspect` and starts a detached background `docker pull --quiet --platform "$PLATFORM"`) and `stop [wait_seconds]` (verifies the recorded PID is still a `docker pull` process via `ps -o args=`, waits up to `wait_seconds`, stops it if still running, and removes the pidfile). - Wired `Pre-warm base layers for PID 1 probe` (`timeout-minutes: 1`, `continue-on-error: true`, gated on `CORE_RELEASE_AWS_ENABLED == 'true'` canonical master pushes with `steps.promote.outputs.digest == ''`), `stop 15` before the PID 1 probe, and `stop 0` in an `if: always()` cleanup step in `.github/workflows/docker.yml`. - Added `.github/scripts/tests/docker-pid1-prewarm.test.mjs` testing workflow gating/ordering and executing `scripts/docker-pid1-prewarm.sh` with fake `git`/`docker` binaries across ancestor discovery, clean skip, non-docker PID protection, and active-process termination. ## Verification - `node --test .github/scripts/tests/docker-pid1-prewarm.test.mjs scripts/merge-group-image.test.mjs .github/scripts/tests/cloud-readiness.test.mjs .github/scripts/tests/docker-canary-promotion.test.mjs .github/scripts/tests/post-merge-runner-routing.test.mjs scripts/docker-image-metadata.test.mjs` — all tests passed (14/14 in `docker-pid1-prewarm` + `merge-group-image`; 361/361 across the full docker/readiness workflow suite). ## Risks - Low risk: pre-warm is gated to the spacious AWS release fleet (`CORE_RELEASE_AWS_ENABLED == 'true'`), bounded to 1 minute with `continue-on-error: true`, verifies process command arguments before signaling any PID, and never modifies BuildKit or weakens `docker run --pull always "$IMAGE_NAME@$IMAGE_DIGEST"`. ## Model Used - Google Gemini (Antigravity agent, high reasoning, with tool use and code execution). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> |