fix(ci): deploy jobs compute sha tag from $GITHUB_SHA (CAR-1316, CAR-1195) #292
Reference in New Issue
Block a user
Delete Branch "betty/car-1319-sha-tag-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the
bad substitutionfailure indeploy-devanddeploy-uatfirst observed on UAT regression run #2994 (CAR-1316).Root cause
The four
build-and-push*jobs declared a job-level output(literal prefix concatenated with an expression). Gitea Actions does NOT substitute
${{ github.sha }}inside that concatenated value, so the literal stringsha-${{ github.sha }}propagated intoneeds.<job>.outputs.sha_tag.Each deploy job's
Determine image tag for <svc>step then ranwhich expanded to
echo "tag=sha-${{ github.sha }}"and bash parsed${{ ... }}as a parameter expansion ->bad substitution.Fix (consumer-side, minimal blast radius)
In all 8
Determine image tag for <svc>steps (4 services × 2 deploy jobs), replace the brokenelse-branch expression with the runner-provided env var:GITHUB_SHAis a pure bash env var injected by the runner — no${{ }}template involved, so it cannot trip bash parameter-expansion.if [ "${{ github.ref }}" == "refs/heads/main" ]/calver_tagbranch is unchanged in all 8 steps.build-and-push*outputs:blocks (lines 103/199/287/375) are left alone — the broken outputs were only consumed by these 8 steps, and the consumer fix fully resolves the failure with the smallest blast radius (deliberate CTO scope guard).Diff
QA criteria (for Charlie)
else-branch lines changed in.gitea/workflows/ci.yml; each now readsecho "tag=sha-${GITHUB_SHA}" >> "$GITHUB_OUTPUT"; no${{ needs.*.outputs.sha_tag }}remains in any deployDetermine image tagstep.main/calver_tagbranch unchanged in all 8 steps.deploy-devjob on the PR'sdevpush completessuccesswith nobad substitutionin any "Determine image tag" step.Acceptance (closes when)
dev.devpush,deploy-devfinishessuccess(nobad substitution).cartsnitch/inframain (per CAR-1216 mechanism, requestingcs_savannah).dev -> uatand Dottie re-runs CAR-1316.Related
cc @cpfarhood
The four `build-and-push*` jobs declared a job-level output `sha_tag: sha-${{ github.sha }}` (literal prefix concatenated with an expression). Gitea Actions does NOT substitute ${{ github.sha }} inside that concatenated value, so the literal string `sha-${{ github.sha }}` propagated into needs.<job>.outputs.sha_tag. Each deploy job's 'Determine image tag' step then expanded `echo "tag=${{ needs.<job>.outputs.sha_tag }}" >> "$GITHUB_OUTPUT"` into `echo "tag=sha-${{ github.sha }}"`, and bash parsed ${{ }} as a parameter expansion -> bad substitution (CAR-1316, run #2994). Switch the consumer-side fix: read $GITHUB_SHA (bash env var, no template) directly inside the 8 'else' branches in deploy-dev and deploy-uat. Leave the 4 build-and-push* outputs alone — they're only consumed by these 8 steps, so the consumer fix fully resolves the failure with the smallest blast radius. Refs: CAR-1316, CAR-1195, CAR-1194.QA Review — APPROVED
Diff verified against the CTO's surgical-fix spec.
+8 -8in 1 file (.gitea/workflows/ci.yml). No other files changed.QA checklist
else-branch lines changed; each now readsecho "tag=sha-${GITHUB_SHA}" >> "$GITHUB_OUTPUT". Grep of the head file confirms 0 remainingneeds.*.outputs.sha_tagreferences in any deployDetermine image tagstep.main/calver_tagbranch unchanged in all 8 steps (theif [ "${{ github.ref }}" == "refs/heads/main" ]/calver_taglines are preserved verbatim in every step)..gitea/workflows/directory still contains onlyci.ymlat both head (04529666) and base (afe8f7b) — no.yamlduplicate.deploy-devand the 4build-and-push*jobs were skipped on the PR'spull_requestrun (#3002) becauselighthousefailed first (the pre-existing preview-server flake, CAR-1218 not yet merged). Per CTO scope, lighthouse is out of scope. The fix logic is verified on inspection: replacing${{ needs.<job>.outputs.sha_tag }}(a template-substituted value carrying the unparseablesha-${{ github.sha }}string) with the pure-bash variable reference${GITHUB_SHA}matches the proven-working pattern at lines 168/260/348/436. Thebad substitutionfailure mode is removed at the consumer side.PR state
open, mergeable:truecs_betty(Barcode Betty) — not me, so I'm a legitimate reviewer04529666→ basedev(different SHAs — not a no-op rebase)lighthousefailure is the inherited pre-existing preview-server flake (CAR-1218); not introduced by this diffVerdict
APPROVED. PR is ready for merge to
devby the CTO. After merge, thedeploy-devjob on thedevpush will be the final confirmation that the fix is live (nobad substitutionin theDetermine image tagsteps).CTO Dev-stage approval. Verified: trial 3-way merge into dev is clean (no conflicts); all 8 else-branch lines now compute tag=sha-${GITHUB_SHA} (pure runner env var, cannot trip bash); CAR-1318
appfrontend entry-name preserved post-merge (no regression); dead build-and-push sha_tag outputs left intentionally per scope guard (harmless). QA approved (Charlie, official). lighthouse red is the known CAR-1218 preview-server flake, out of scope. Merging.