Skip to content

ci: build and push grid-wallet-prod image to ECR - #747

Merged
mariano-macri merged 3 commits into
grid-wallet-prod-dockerfile-fixfrom
grid-wallet-prod-image-workflow
Jul 28, 2026
Merged

ci: build and push grid-wallet-prod image to ECR#747
mariano-macri merged 3 commits into
grid-wallet-prod-dockerfile-fixfrom
grid-wallet-prod-image-workflow

Conversation

@mariano-macri

Copy link
Copy Markdown
Contributor

Stacked on #746 (which makes the image buildable at all).

Builds components/grid-wallet-prod and pushes it to the ECR repo vended by tooling-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 main touching components/grid-wallet-prod/**: assume github-actions-grid-wallet-prod via GitHub OIDC, build linux/arm64, push an immutable sha-<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 main triggers a run against a main with no components/grid-wallet-prod/ directory, and the build fails on a missing working directory. Land the component stack first, this second.

linux/arm64 because the tooling-prod cluster is Graviton (m8g). No other workflow in this repo uses an ARM label yet — if the first run sits in queued, GitHub-hosted ARM runners aren't enabled for the org and the fallback is setup-qemu + setup-buildx on ubuntu-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=true is 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 a describe-images check that distinguishes "tag absent" from "the call failed" — a bare if aws ... >/dev/null 2>&1 is exempt from set -e and would treat an IAM error as a missing image, then die on the immutable push. Only ImageNotFoundException means "go build"; anything else fails loudly.

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.

Depends on

tooling-infra PR (ECR repo + github-actions-grid-wallet-prod role) must be applied before this runs, or the first push has nothing to authenticate against.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
grid-flow-builder Ignored Ignored Preview Jul 27, 2026 6:33pm
grid-wallet-demo Ignored Ignored Preview Jul 27, 2026 6:33pm

Request Review

@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds an ECR image-publishing workflow for grid-wallet-prod.

  • Runs on relevant pushes to main using a native ARM64 runner.
  • Assumes the publishing role through GitHub OIDC.
  • Skips immutable tags already present in ECR and fails on unexpected lookup errors.
  • Builds the sandbox-configured ARM64 image and pushes a commit-SHA tag.
  • Pins every executable GitHub Action to a full commit SHA.

Confidence Score: 5/5

The 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.

Important Files Changed

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

Comment thread .github/workflows/grid-wallet-prod-image.yml Outdated
@mariano-macri

Copy link
Copy Markdown
Contributor Author

@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 @v4/@v2 deliberately. All three are first-party (actions/checkout from GitHub; configure-aws-credentials and amazon-ecr-login from AWS), and this repo has no Dependabot config — so SHA pins would have no update path, freeze, and stop receiving upstream security fixes. That's a worse posture than tracking the major tag, not a better one. Pinning is right once there's a mechanism keeping pins current; that's a repo-wide change worth doing deliberately rather than inside a CI-wiring PR.

mariano-macri and others added 2 commits July 27, 2026 11:26
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>
@mariano-macri
mariano-macri force-pushed the grid-wallet-prod-dockerfile-fix branch from 9549323 to 5b58855 Compare July 27, 2026 18:26
@mariano-macri
mariano-macri force-pushed the grid-wallet-prod-image-workflow branch from 8af3513 to 6a45f19 Compare July 27, 2026 18:26
@mariano-macri

Copy link
Copy Markdown
Contributor Author

@greptileai review

Rebased along with #746 — commits are now c6a8a5e and 6a45f19, content unchanged (1 file, +81).

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>
@mariano-macri

Copy link
Copy Markdown
Contributor Author

@greptileai review

Addressed the mutable-action-reference finding in 61bf04b1 — all three actions are now pinned to full commit SHAs with version comments:

actions/checkout                      @11d5960 # v4.4.0
aws-actions/configure-aws-credentials @7474bc4 # v4.3.1
aws-actions/amazon-ecr-login          @d539f09 # v2.1.6

Reversing my earlier position: this is the first workflow in the repo to hold cloud write credentials (id-token: write + ECR push), so it's worth deviating from the repo-wide major-tag convention here.

One caveat noted inline in the workflow: this repo has no dependabot.yml, so these pins won't update themselves. A github-actions ecosystem entry would keep them current repo-wide — worth doing separately rather than in this PR.

@mariano-macri
mariano-macri merged commit deff22d into grid-wallet-prod-dockerfile-fix Jul 28, 2026
8 checks passed
@mariano-macri
mariano-macri deleted the grid-wallet-prod-image-workflow branch July 28, 2026 16:06
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.

2 participants