Skip to content

chore: build images through the rootless buildkit sidecar - #57

Merged
muhammad-tahir-nawaz merged 1 commit into
prodfrom
chore/build-with-rootless-buildkit
Oct 6, 2026
Merged

muhammad-tahir-nawaz merged 1 commit into
prodfrom
chore/build-with-rootless-buildkit

Conversation

@muhammad-tahir-nawaz

Copy link
Copy Markdown
Contributor

Summary

The shared deployment and shared-registry-push workflows build images through the ARC runner's rootless BuildKit sidecar ($BUILDKIT_HOST) instead of a Docker daemon. The image is built to a tarball, scanned by Trivy, and pushed only if clean. Runners without the sidecar fall back to buildx's default driver.

Why

Security review follow-up: the Docker-in-Docker sidecar on the runners is privileged. Building through rootless BuildKit removes the last reason to keep it. The sidecar is already deployed on the dev, stage and prod runners.

QA Report

  • No QA report required — CI workflow change, no user-facing API.

Integration Tests

  • No integration tests required — CI workflow only; exercised by the next run of the workflow.

Dependencies

  • Merge before the per-repo BuildKit PRs (RDE, kde, asset-bulk-uploader, catalog-bulk-uploader, worker-systems).
  • Docker-in-Docker is removed from the runners in a later infrastructure change, after all of these have merged.

The privileged Docker-in-Docker sidecar is being removed from the ARC runners.
Images are built to a tarball, scanned by Trivy, then pushed from the warm
BuildKit cache. A non-ARC runner falls back to buildx's default driver.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 13:42

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The pushed deployment artifact is not the scanned artifact, and the shared-registry path lacks the described Trivy gate.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 2 Low severity

Open (4)
What changed in this PR

Routes container builds through rootless BuildKit sidecars, with a Docker-backed fallback.

Changes:

  • Selects remote or Docker-container Buildx drivers.
  • Scans a deployment image tarball before rebuilding and pushing.
File Description
.github/​workflows/​deployment.yaml Adds rootless building and tarball scanning.
.github/​workflows/​shared-registry-push.yaml Adds Buildx builder selection.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/deployment.yaml Resolved
Comment thread .github/workflows/deployment.yaml Resolved
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[High risk] Changes how container images are built in CI pipelines.

The PR is not safe to merge until deployment pushes the image that passed the vulnerability scan.

Fix All in Claude CodeFindings

  1. P1 Pushed image bypasses scan ▶
  2. P2 Security Mutable Buildx action reference ▶
Fix with agent prompt
### Issue 1
.github/workflows/deployment.yaml:182-186
If a floating base image or another build input changes between builds, Trivy approves `image.tar`, but this step builds again from the context and pushes a different image. The registry image can then contain dependencies that never passed the vulnerability scan. Push the scanned artifact instead of rebuilding it.

### Issue 2
.github/workflows/deployment.yaml:150
The new Buildx setup action uses the mutable `@v3` tag here and in the shared-registry workflow. If that tag is repointed, different code can run in credentialed build jobs without a workflow change. Pinning the action to a commit SHA would make the executed code reviewable.

**How this was verified:** Both setup steps use `@v3`, and the deployment job grants write and OIDC permissions before running the action.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The workflows select the ARC runner’s rootless BuildKit sidecar when available, with a docker-container fallback. Deployment now exports an image tarball for Trivy and performs a separate build to push; the shared-registry workflow adds the builder selection while retaining its best-effort push.

  • The deployment push does not publish the artifact that Trivy scanned.
  • The new Buildx setup references use mutable tags.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Deployment source] --> B[Build to image.tar]
  B --> C[Trivy scan]
  C -->|passes| D[Build again from source]
  D --> E[Push registry image]
Loading

Reviews (1) · Last reviewed commit: "chore: build images through the runner's..."

Comment thread .github/workflows/deployment.yaml Resolved
Comment thread .github/workflows/deployment.yaml Resolved
@muhammad-tahir-nawaz
muhammad-tahir-nawaz merged commit 4a3518f into prod Oct 6, 2026
4 of 5 checks passed
@muhammad-tahir-nawaz
muhammad-tahir-nawaz deleted the chore/build-with-rootless-buildkit branch October 7, 2026 13:57

This branch was successfully deployed

No deployments
development — 1d5be896 Deployed Oct 6, 2026 by muhammad-tahir-nawaz via Run Trivy Scan and Go Tests #79
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.

3 participants