ci: build and push grid-wallet-prod image to ECR#747
Conversation
Triggers on pushes to main touching components/grid-wallet-prod/**, assumes github-actions-grid-wallet-prod via OIDC, and pushes an immutable sha-<gitsha> image to the ECR repo vended by tooling-infra. Builds linux/arm64 because the tooling-prod cluster is Graviton. No other workflow in this repo uses an ARM label yet, so if the first run sits in `queued`, GitHub-hosted ARM runners are not enabled for the org; the fallback is setup-qemu + setup-buildx on ubuntu-latest, noted inline. --build-arg NEXT_PUBLIC_GRID_SANDBOX=true is written literally rather than defaulted in the Dockerfile, so a future production image is a separate workflow against a separate repo and cannot inherit the sandbox affordance. The ECR repo is IMMUTABLE-tagged, so the build is guarded by a describe-images check: a re-run for an already-pushed SHA exits 0 instead of failing on the duplicate tag. No workflow_dispatch: the IAM trust policy pins the sub claim to refs/heads/main, so a dispatch from any other ref could not authenticate. Co-Authored-By: Claude Opus 5 <[email protected]>
The idempotency guard was `if aws ecr describe-images ... >/dev/null 2>&1`. Commands used as an `if` condition are exempt from `set -e`, so an IAM error, a throttle, or a network blip was indistinguishable from "the tag isn't there" — the job would fall through, build, and then die on the immutable push with a misleading duplicate-tag error. Now the exit code and stderr are captured separately: rc 0 means the image exists and the job exits clean, ImageNotFoundException means build, and anything else fails loudly with the underlying AWS error. Co-Authored-By: Claude Opus 5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Greptile SummaryAdds a GitHub Actions workflow that builds the Grid Wallet production component for ARM64 and publishes an immutable commit-tagged image to ECR.
Confidence Score: 4/5The PR is not yet safe to merge because the privileged publishing job still executes actions through mutable references. The previously reported supply-chain path remains at HEAD: code selected by mutable action tags executes with OIDC permission and participates in assuming the ECR-publishing role. Files Needing Attention: .github/workflows/grid-wallet-prod-image.yml
|
| Filename | Overview |
|---|---|
| .github/workflows/grid-wallet-prod-image.yml | Adds the ARM64 ECR image build-and-publish workflow with immutable-tag idempotency handling. |
Reviews (2): Last reviewed commit: "ci: don't treat a failed describe-images..." | Re-trigger Greptile
| # docker/setup-qemu-action + docker/setup-buildx-action on ubuntu-latest. | ||
| runs-on: ubuntu-24.04-arm | ||
| steps: | ||
| - uses: actions/checkout@v4 |
There was a problem hiding this comment.
Mutable privileged action reference
This image-publishing job references executable actions by mutable major-version tags while granting OIDC or inherited AWS credential access. Pinning these actions to full commit SHAs prevents an upstream tag change from altering the code that can assume the publishing role or modify and publish the image.
How this was verified: The referenced actions run in a job with id-token: write, and the workflow subsequently assumes the ECR-publishing role and pushes the checked-out workspace.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/grid-wallet-prod-image.yml
Line: 28
Comment:
**Mutable privileged action reference**
This image-publishing job references executable actions by mutable major-version tags while granting OIDC or inherited AWS credential access. Pinning these actions to full commit SHAs prevents an upstream tag change from altering the code that can assume the publishing role or modify and publish the image.
**How this was verified:** The referenced actions run in a job with `id-token: write`, and the workflow subsequently assumes the ECR-publishing role and pushes the checked-out workspace.
How can I resolve this? If you propose a fix, please make it concise.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!
|
@greptileai review No new commits since your last review — re-triggering for a fresh pass now that the sibling PRs have changed. On the mutable action tags you flagged: keeping |
Stacked on #746 (which makes the image buildable at all).
Builds
components/grid-wallet-prodand pushes it to the ECR repo vended bytooling-infra(terraform/apps/grid-wallet-prod), so the app can be deployed to the internal tooling EKS cluster behind Okta.What it does
On pushes to
maintouchingcomponents/grid-wallet-prod/**: assumegithub-actions-grid-wallet-prodvia GitHub OIDC, buildlinux/arm64, push an immutablesha-<gitsha>tag.Three things worth reviewing
Landing order is mandatory. The path filter includes the workflow's own file, so merging this before the component stack reaches
maintriggers a run against amainwith nocomponents/grid-wallet-prod/directory, and the build fails on a missing working directory. Land the component stack first, this second.linux/arm64because the tooling-prod cluster is Graviton (m8g). No other workflow in this repo uses an ARM label yet — if the first run sits inqueued, GitHub-hosted ARM runners aren't enabled for the org and the fallback issetup-qemu+setup-buildxonubuntu-latest(noted inline). ARC runners are not an option here: they have no Docker daemon.The sandbox flag is a build arg, not config.
NEXT_PUBLIC_*is inlined by Next at build time, so--build-arg NEXT_PUBLIC_GRID_SANDBOX=trueis written literally in the workflow and has no default in the Dockerfile. A future production image would be a separate workflow against a separate ECR repo and cannot inherit the sandbox affordance by accident.Idempotency
The ECR repo is
IMMUTABLE-tagged, so re-pushing an existing tag is a hard failure. The build is guarded by adescribe-imagescheck that distinguishes "tag absent" from "the call failed" — a bareif aws ... >/dev/null 2>&1is exempt fromset -eand would treat an IAM error as a missing image, then die on the immutable push. OnlyImageNotFoundExceptionmeans "go build"; anything else fails loudly.No
workflow_dispatch: the IAM trust policy pins thesubclaim torefs/heads/main, so a dispatch from any other ref could not authenticate.Depends on
tooling-infraPR (ECR repo +github-actions-grid-wallet-prodrole) must be applied before this runs, or the first push has nothing to authenticate against.🤖 Generated with Claude Code