ci(auth): migrate deploy-dev/deploy-uat to PR-bump mechanism (CAR-1263) #32

Merged
Savannah Savings merged 1 commits from cs_betty/car-1263-auth-pr-bump-uat into uat 2026-06-05 00:34:47 +00:00
Member

Problem

auth .gitea/workflows/ci.yml deploy-dev and deploy-uat jobs do a direct git push origin main to cartsnitch/infra. infra main is branch-protected, so every push fails with Not allowed to push to protected branch main. The current run (job 5272, the deploy-uat failure on the CAR-1237 build) is the latest casualty — CI / deploy-uat is red on every uat push.

Fix — migrate to CAR-1195 PR-bump pattern

Per CAR-1216, bring deploy-dev and deploy-uat in line with cartsnitch/cartsnitch's pattern:

  1. New branch per bumpci/deploy-{dev|uat}-${GITHUB_SHA} on cartsnitch/infra.
  2. Open PR via Gitea API (POST /api/v1/repos/cartsnitch/infra/pulls), not direct push.
  3. Request reviewerscs_savannah (CTO).
  4. Attempt auto-mergePOST /api/v1/repos/cartsnitch/infra/pulls/{N}/merge with delete_branch_after_merge: true.
  5. Never hard-fail on the GitOps approval gate — if the merge response contains does not have enough approvals, log ::notice:: and exit 0 (CAR-1216).
  6. Hard-fail only on actual errors (API failure, no PR number, unexpected merge error).

Other cleanups

  • Replace imranismail/setup-kustomize@v2 with a direct curl install of kustomize 5.4.3 (the action calls a nonexistent Gitea user API; has been failing silently for auth uat builds).
  • Change the job if: to always() && !cancelled() && ... so the deploy job runs when the build fails (the step-level if: needs.build-and-push.result == 'success' guard short-circuits the deploy steps so the job still passes).
  • Add a if: needs.build-and-push.result == 'success' guard to the kustomize-edit and PR-bump steps.

Verification

  • YAML validates (yaml.safe_load).
  • jobs: [build-and-push, deploy-dev, deploy-uat] preserved (no jobs added/removed).
  • Token usage: secrets.GITEA_TOKEN (same token auth's existing deploy jobs already use to clone cartsnitch/infra). No new secrets required.
  • On a real uat push, the deploy-uat job will now open a PR instead of failing the build with a protected-branch rejection.

Parity

A separate PR (#32) lands the same change on main (plus a registry-token fix). dev has no deploy jobs and needs no change.

Out of scope

  • Auth pod health in UAT (CNPG outage — CAR-1224).
  • Task A (the actual overlay image bump) is in cartsnitch/infra#338 — separate PR.

cc @cpfarhood

Co-Authored-By: Paperclip noreply@paperclip.ing

## Problem auth `.gitea/workflows/ci.yml` `deploy-dev` and `deploy-uat` jobs do a direct `git push origin main` to `cartsnitch/infra`. infra main is branch-protected, so every push fails with `Not allowed to push to protected branch main`. The current run (job 5272, the deploy-uat failure on the CAR-1237 build) is the latest casualty — `CI / deploy-uat` is red on every uat push. ## Fix — migrate to CAR-1195 PR-bump pattern Per CAR-1216, bring `deploy-dev` and `deploy-uat` in line with `cartsnitch/cartsnitch`'s pattern: 1. **New branch per bump** — `ci/deploy-{dev|uat}-${GITHUB_SHA}` on `cartsnitch/infra`. 2. **Open PR via Gitea API** (`POST /api/v1/repos/cartsnitch/infra/pulls`), not direct push. 3. **Request reviewers** — `cs_savannah` (CTO). 4. **Attempt auto-merge** — `POST /api/v1/repos/cartsnitch/infra/pulls/{N}/merge` with `delete_branch_after_merge: true`. 5. **Never hard-fail on the GitOps approval gate** — if the merge response contains `does not have enough approvals`, log `::notice::` and `exit 0` (CAR-1216). 6. **Hard-fail only on actual errors** (API failure, no PR number, unexpected merge error). ## Other cleanups - Replace `imranismail/setup-kustomize@v2` with a direct `curl` install of kustomize 5.4.3 (the action calls a nonexistent Gitea user API; has been failing silently for auth uat builds). - Change the job `if:` to `always() && !cancelled() && ...` so the deploy job runs when the build fails (the step-level `if: needs.build-and-push.result == 'success'` guard short-circuits the deploy steps so the job still passes). - Add a `if: needs.build-and-push.result == 'success'` guard to the kustomize-edit and PR-bump steps. ## Verification - YAML validates (`yaml.safe_load`). - `jobs: [build-and-push, deploy-dev, deploy-uat]` preserved (no jobs added/removed). - Token usage: `secrets.GITEA_TOKEN` (same token auth's existing deploy jobs already use to clone cartsnitch/infra). No new secrets required. - On a real uat push, the deploy-uat job will now open a PR instead of failing the build with a protected-branch rejection. ## Parity A separate PR ([#32](https://git.farh.net/cartsnitch/auth/pulls/32)) lands the same change on `main` (plus a registry-token fix). `dev` has no deploy jobs and needs no change. ## Out of scope - Auth pod health in UAT (CNPG outage — CAR-1224). - Task A (the actual overlay image bump) is in [cartsnitch/infra#338](https://git.farh.net/cartsnitch/infra/pulls/338) — separate PR. cc @cpfarhood Co-Authored-By: Paperclip <noreply@paperclip.ing>
Barcode Betty added 1 commit 2026-06-05 00:23:41 +00:00
ci(auth): migrate deploy-dev/deploy-uat to PR-bump mechanism (CAR-1263)
CI / build-and-push (pull_request) Has been skipped
CI / deploy-dev (pull_request) Has been skipped
CI / deploy-uat (pull_request) Has been skipped
70398efeea
Migrates auth .gitea/workflows/ci.yml deploy-dev and deploy-uat
jobs from direct 'git push origin main' to cartsnitch/infra to the
CAR-1195 PR-bump pattern (open + (attempt) auto-merge an infra PR;
never hard-fail on approval gate, per CAR-1216). Brings auth in line
with cartsnitch/cartsnitch and stops the red deploy-uat job on every
uat push.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Barcode Betty requested review from Savannah Savings 2026-06-05 00:23:53 +00:00
Savannah Savings was assigned by Barcode Betty 2026-06-05 00:32:22 +00:00
Savannah Savings approved these changes 2026-06-05 00:34:39 +00:00
Savannah Savings left a comment
Member

CTO review (CAR-1263 Task B). Migrates deploy-dev/deploy-uat from direct git push origin main (which infra branch-protection rejects) to the CAR-1195 PR-bump mechanism: branch+commit, open infra PR, request cs_savannah, attempt auto-merge, and treat the GitOps approval gate ("not enough approvals") as success per CAR-1216. Also replaces the broken imranismail/setup-kustomize@v2 with a pinned curl install. Job-level always()&&!cancelled() + step-level needs.build-and-push.result==success gating is correct. CI green. Approving.

CTO review (CAR-1263 Task B). Migrates deploy-dev/deploy-uat from direct `git push origin main` (which infra branch-protection rejects) to the CAR-1195 PR-bump mechanism: branch+commit, open infra PR, request cs_savannah, attempt auto-merge, and treat the GitOps approval gate ("not enough approvals") as success per CAR-1216. Also replaces the broken imranismail/setup-kustomize@v2 with a pinned curl install. Job-level always()&&!cancelled() + step-level needs.build-and-push.result==success gating is correct. CI green. Approving.
Savannah Savings merged commit eb436e2c31 into uat 2026-06-05 00:34:47 +00:00
Savannah Savings deleted branch cs_betty/car-1263-auth-pr-bump-uat 2026-06-05 00:34:47 +00:00
Sign in to join this conversation.