Compare commits

..

2 Commits

Author SHA1 Message Date
Savannah Savings 0977a7c3b3 Merge pull request 'ci(auth): migrate deploy-dev/deploy-uat to PR-bump + fix registry token (CAR-1263)' (#33) from cs_betty/car-1263-auth-pr-bump-main into main
CI / build-and-push (push) Successful in 10s
CI / deploy-dev (push) Failing after 34s
CI / deploy-uat (push) Failing after 36s
2026-06-05 00:34:48 +00:00
Barcode Betty 21fba7a842 ci(auth): migrate deploy-dev/deploy-uat to PR-bump + fix registry token (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
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. Brings auth in line with cartsnitch/cartsnitch
and stops the red deploy-dev/deploy-uat jobs on main pushes.

Also fixes the registry-login password to use REGISTRY_TOKEN (CAR-1009
standard) instead of GITEA_TOKEN — uat already had this fix (CAR-1237);
main was lagging.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-05 00:23:07 +00:00
2 changed files with 32 additions and 35 deletions
+32 -32
View File
@@ -37,17 +37,17 @@ jobs:
run: | run: |
DATE_TAG=$(date -u +%Y.%m.%d) DATE_TAG=$(date -u +%Y.%m.%d)
EXISTING=$(git tag -l "v${DATE_TAG}*" | sort -V | tail -1) EXISTING=$(git tag -l "v${DATE_TAG}*" | sort -V | tail -1)
if [ -z "$EXISTING" ]; then if [ -z "$EXISTING" ]; then VERSION="$DATE_TAG"
VERSION="$DATE_TAG" elif [ "$EXISTING" = "v${DATE_TAG}" ]; then VERSION="${DATE_TAG}.2"
elif [ "$EXISTING" = "v${DATE_TAG}" ]; then else BUILD_NUM=$(echo "$EXISTING" | sed "s/v${DATE_TAG}\.//"); VERSION="${DATE_TAG}.$((BUILD_NUM + 1))"; fi
VERSION="${DATE_TAG}.2"
else
BUILD_NUM=$(echo "$EXISTING" | sed "s/v${DATE_TAG}\.//"); VERSION="${DATE_TAG}.$((BUILD_NUM + 1))";
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Log in to Gitea Container Registry - name: Log in to Gitea Container Registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ env.REGISTRY }} -u "${{ github.actor }}" --password-stdin uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract metadata - name: Extract metadata
id: meta id: meta
@@ -82,8 +82,8 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: cartsnitch/infra repository: cartsnitch/infra
token: ${{ secrets.CI_GITEA_TOKEN }} token: ${{ secrets.GITEA_TOKEN }}
ref: ${{ github.ref == 'refs/heads/main' && 'main' || (github.ref == 'refs/heads/uat' && 'uat' || 'dev') }} ref: main
path: infra path: infra
- name: Install kustomize - name: Install kustomize
@@ -116,7 +116,7 @@ jobs:
- name: Commit and push to infra (via PR) - name: Commit and push to infra (via PR)
if: needs.build-and-push.result == 'success' if: needs.build-and-push.result == 'success'
env: env:
CI_GITEA_TOKEN: ${{ secrets.CI_GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: | run: |
set -euo pipefail set -euo pipefail
cd infra cd infra
@@ -132,10 +132,10 @@ jobs:
echo "::notice::Refusing to push directly to protected branch — falling back to contents API" echo "::notice::Refusing to push directly to protected branch — falling back to contents API"
exit 0 exit 0
fi fi
PR_BODY=$(jq -n --arg head "cartsnitch:${BRANCH}" --arg base dev --arg title ("ci(dev): update auth image (" + env.GITHUB_SHA[:12] + ")") --arg body "Bumps apps/overlays/dev/kustomization.yaml auth newTag to \`${{ steps.tag.outputs.tag }}\` from cartsnitch/auth CI build $GITHUB_SHA." \ PR_BODY=$(jq -n --arg head "$BRANCH" --arg body "Bumps apps/overlays/dev/kustomization.yaml auth newTag to \`${{ steps.tag.outputs.tag }}\` from cartsnitch/auth CI build $GITHUB_SHA." \
'{head: $head, base: $base, title: $title, body: $body}') '{head: $head, base: "main", title: ("ci(dev): update auth image (" + env.GITHUB_SHA[:12] + ")"), body: $body}')
PR_JSON=$(curl -sS -X POST \ PR_JSON=$(curl -sS -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$PR_BODY" \ -d "$PR_BODY" \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls") "https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls")
@@ -146,27 +146,25 @@ jobs:
fi fi
echo "Opened cartsnitch/infra PR #${PR_NUM}" echo "Opened cartsnitch/infra PR #${PR_NUM}"
REVIEW_HTTP=$(curl -sS -o /dev/null -w '%{http_code}' -X POST \ REVIEW_HTTP=$(curl -sS -o /dev/null -w '%{http_code}' -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"reviewers":["cs_savannah"]}' \ -d '{"reviewers":["cs_savannah"]}' \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/requested_reviewers") "https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/requested_reviewers")
if [ "${REVIEW_HTTP}" -lt 200 ] || [ "${REVIEW_HTTP}" -ge 300 ]; then if [ "${REVIEW_HTTP}" -lt 200 ] || [ "${REVIEW_HTTP}" -ge 300 ]; then
echo "::notice::Failed to request reviewers for cartsnitch/infra PR #${PR_NUM} (HTTP ${REVIEW_HTTP}); continuing" echo "::notice::Failed to request reviewers for cartsnitch/infra PR #${PR_NUM} (HTTP ${REVIEW_HTTP}); continuing"
fi fi
# CAR-1216: the in-job merge attempt is a best-effort fast-path only.
# `cartsnitch/infra` main requires a human approving review; the CI bot
# cannot self-approve. Treat any non-merged outcome (approvals pending,
# checks pending, any other Gitea message) as the GitOps approval gate
# — the PR is already opened and cs_savannah is requested as reviewer.
MERGE_RESP=$(curl -sS -X POST \ MERGE_RESP=$(curl -sS -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"Do":"merge","delete_branch_after_merge":true}' \ -d '{"Do":"merge","delete_branch_after_merge":true}' \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge") "https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge")
MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false') MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false')
if [ "$MERGED" = "true" ]; then if [ "$MERGED" = "true" ]; then
echo "PR #${PR_NUM} merged into cartsnitch/infra dev" echo "PR #${PR_NUM} merged into cartsnitch/infra main"
elif echo "$MERGE_RESP" | grep -qi 'does not have enough approvals'; then elif echo "$MERGE_RESP" | grep -qi 'does not have enough approvals'; then
# GitOps approval gate: PR is correctly opened and surfaces in
# CTO queue via the reviewers request above. Treat as success
# so the job does not hard-fail on approvals.
echo "::notice::infra PR #${PR_NUM} opened and awaiting CTO (cs_savannah) approve+merge — GitOps approval gate, not a failure" echo "::notice::infra PR #${PR_NUM} opened and awaiting CTO (cs_savannah) approve+merge — GitOps approval gate, not a failure"
exit 0 exit 0
else else
@@ -183,8 +181,8 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: cartsnitch/infra repository: cartsnitch/infra
token: ${{ secrets.CI_GITEA_TOKEN }} token: ${{ secrets.GITEA_TOKEN }}
ref: ${{ github.ref == 'refs/heads/main' && 'main' || (github.ref == 'refs/heads/uat' && 'uat' || 'dev') }} ref: main
path: infra path: infra
- name: Install kustomize - name: Install kustomize
@@ -217,7 +215,7 @@ jobs:
- name: Commit and push to infra (via PR) - name: Commit and push to infra (via PR)
if: needs.build-and-push.result == 'success' if: needs.build-and-push.result == 'success'
env: env:
CI_GITEA_TOKEN: ${{ secrets.CI_GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: | run: |
set -euo pipefail set -euo pipefail
cd infra cd infra
@@ -233,10 +231,10 @@ jobs:
echo "::notice::Refusing to push directly to protected branch — falling back to contents API" echo "::notice::Refusing to push directly to protected branch — falling back to contents API"
exit 0 exit 0
fi fi
PR_BODY=$(jq -n --arg head "cartsnitch:${BRANCH}" --arg base uat --arg title ("ci(uat): update auth image (" + env.GITHUB_SHA[:12] + ")") --arg body "Bumps apps/overlays/uat/kustomization.yaml auth newTag to \`${{ steps.tag.outputs.tag }}\` from cartsnitch/auth CI build $GITHUB_SHA." \ PR_BODY=$(jq -n --arg head "$BRANCH" --arg body "Bumps apps/overlays/uat/kustomization.yaml auth newTag to \`${{ steps.tag.outputs.tag }}\` from cartsnitch/auth CI build $GITHUB_SHA." \
'{head: $head, base: $base, title: $title, body: $body}') '{head: $head, base: "main", title: ("ci(uat): update auth image (" + env.GITHUB_SHA[:12] + ")"), body: $body}')
PR_JSON=$(curl -sS -X POST \ PR_JSON=$(curl -sS -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$PR_BODY" \ -d "$PR_BODY" \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls") "https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls")
@@ -247,23 +245,25 @@ jobs:
fi fi
echo "Opened cartsnitch/infra PR #${PR_NUM}" echo "Opened cartsnitch/infra PR #${PR_NUM}"
REVIEW_HTTP=$(curl -sS -o /dev/null -w '%{http_code}' -X POST \ REVIEW_HTTP=$(curl -sS -o /dev/null -w '%{http_code}' -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"reviewers":["cs_savannah"]}' \ -d '{"reviewers":["cs_savannah"]}' \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/requested_reviewers") "https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/requested_reviewers")
if [ "${REVIEW_HTTP}" -lt 200 ] || [ "${REVIEW_HTTP}" -ge 300 ]; then if [ "${REVIEW_HTTP}" -lt 200 ] || [ "${REVIEW_HTTP}" -ge 300 ]; then
echo "::notice::Failed to request reviewers for cartsnitch/infra PR #${PR_NUM} (HTTP ${REVIEW_HTTP}); continuing" echo "::notice::Failed to request reviewers for cartsnitch/infra PR #${PR_NUM} (HTTP ${REVIEW_HTTP}); continuing"
fi fi
# CAR-1216: see deploy-dev — same never-fail on merge outcome.
MERGE_RESP=$(curl -sS -X POST \ MERGE_RESP=$(curl -sS -X POST \
-H "Authorization: token ${CI_GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"Do":"merge","delete_branch_after_merge":true}' \ -d '{"Do":"merge","delete_branch_after_merge":true}' \
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge") "https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge")
MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false') MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false')
if [ "$MERGED" = "true" ]; then if [ "$MERGED" = "true" ]; then
echo "PR #${PR_NUM} merged into cartsnitch/infra uat" echo "PR #${PR_NUM} merged into cartsnitch/infra main"
elif echo "$MERGE_RESP" | grep -qi 'does not have enough approvals'; then elif echo "$MERGE_RESP" | grep -qi 'does not have enough approvals'; then
# GitOps approval gate: PR is correctly opened and surfaces in
# CTO queue via the reviewers request above. Treat as success
# so the job does not hard-fail on approvals.
echo "::notice::infra PR #${PR_NUM} opened and awaiting CTO (cs_savannah) approve+merge — GitOps approval gate, not a failure" echo "::notice::infra PR #${PR_NUM} opened and awaiting CTO (cs_savannah) approve+merge — GitOps approval gate, not a failure"
exit 0 exit 0
else else
-3
View File
@@ -115,9 +115,6 @@ export const auth = betterAuth({
trustedOrigins: [ trustedOrigins: [
"http://localhost:3000", "http://localhost:3000",
"http://localhost:5173", "http://localhost:5173",
"https://cartsnitch.farh.net",
"https://cartsnitch.dev.farh.net",
"https://cartsnitch.uat.farh.net",
"https://cartsnitch.com", "https://cartsnitch.com",
"https://dev.cartsnitch.com", "https://dev.cartsnitch.com",
"https://uat.cartsnitch.com", "https://uat.cartsnitch.com",