ci: build and push grid-wallet-prod image to ECR - #747
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Greptile SummaryAdds an ECR image-publishing workflow for
Confidence Score: 5/5The PR appears safe to merge after its declared component and infrastructure dependencies are in place. No blocking failure remains; the previously reported mutable privileged action references are now pinned to full commit SHAs.
|
| Filename | Overview |
|---|---|
| .github/workflows/grid-wallet-prod-image.yml | Adds the ARM64 ECR publishing workflow and fully addresses the prior mutable-action-reference concern by pinning all actions to immutable commit SHAs. |
Reviews (4): Last reviewed commit: "ci: pin grid-wallet-prod image actions t..." | Re-trigger Greptile
|
@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 |
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
9549323 to
5b58855
Compare
8af3513 to
6a45f19
Compare
|
@greptileai review Rebased along with #746 — commits are now |
This job holds id-token: write and assumes a role that can push to ECR, so an upstream tag move would silently change code running with cloud write access. It is the first workflow in this repo to hold cloud write credentials, which is why it deviates from the repo-wide major-tag convention. actions/checkout @11d5960 # v4.4.0 aws-actions/configure-aws-credentials @7474bc4 # v4.3.1 aws-actions/amazon-ecr-login @d539f09 # v2.1.6 Caveat recorded inline: this repo has no dependabot.yml, so these pins will not update themselves and will go stale. A github-actions ecosystem entry would fix that repo-wide and is worth doing separately. Co-Authored-By: Claude <noreply@anthropic.com>
|
@greptileai review Addressed the mutable-action-reference finding in Reversing my earlier position: this is the first workflow in the repo to hold cloud write credentials ( One caveat noted inline in the workflow: this repo has no |
deff22d
into
grid-wallet-prod-dockerfile-fix
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