Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a6190a805 | |||
| a2d18c18d8 | |||
| b5151db0ac | |||
| 5cd46571f2 | |||
| 9c4f9b95a9 | |||
| e22010a907 | |||
| 5cdb4c63b8 | |||
| 4819d9c7ac | |||
| 76254d0dbb | |||
| c4536afa5f | |||
| 72f2568b68 | |||
| a0be839632 | |||
| 0977a7c3b3 | |||
| 21fba7a842 |
+25
-15
@@ -59,11 +59,21 @@ jobs:
|
||||
type=raw,value=${{ steps.calver.outputs.version }},enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
load: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
provenance: false
|
||||
sbom: false
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
@@ -83,7 +93,7 @@ jobs:
|
||||
with:
|
||||
repository: cartsnitch/infra
|
||||
token: ${{ secrets.CI_GITEA_TOKEN }}
|
||||
ref: ${{ github.ref == 'refs/heads/main' && 'main' || (github.ref == 'refs/heads/uat' && 'uat' || 'dev') }}
|
||||
ref: main
|
||||
path: infra
|
||||
|
||||
- name: Install kustomize
|
||||
@@ -132,8 +142,8 @@ jobs:
|
||||
echo "::notice::Refusing to push directly to protected branch — falling back to contents API"
|
||||
exit 0
|
||||
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." \
|
||||
'{head: $head, base: $base, title: $title, body: $body}')
|
||||
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: "main", title: ("ci(dev): update auth image (" + env.GITHUB_SHA[:12] + ")"), body: $body}')
|
||||
PR_JSON=$(curl -sS -X POST \
|
||||
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -153,11 +163,6 @@ jobs:
|
||||
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"
|
||||
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 \
|
||||
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -165,8 +170,11 @@ jobs:
|
||||
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge")
|
||||
MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false')
|
||||
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
|
||||
# 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"
|
||||
exit 0
|
||||
else
|
||||
@@ -184,7 +192,7 @@ jobs:
|
||||
with:
|
||||
repository: cartsnitch/infra
|
||||
token: ${{ secrets.CI_GITEA_TOKEN }}
|
||||
ref: ${{ github.ref == 'refs/heads/main' && 'main' || (github.ref == 'refs/heads/uat' && 'uat' || 'dev') }}
|
||||
ref: main
|
||||
path: infra
|
||||
|
||||
- name: Install kustomize
|
||||
@@ -233,8 +241,8 @@ jobs:
|
||||
echo "::notice::Refusing to push directly to protected branch — falling back to contents API"
|
||||
exit 0
|
||||
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." \
|
||||
'{head: $head, base: $base, title: $title, body: $body}')
|
||||
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: "main", title: ("ci(uat): update auth image (" + env.GITHUB_SHA[:12] + ")"), body: $body}')
|
||||
PR_JSON=$(curl -sS -X POST \
|
||||
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -254,7 +262,6 @@ jobs:
|
||||
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"
|
||||
fi
|
||||
# CAR-1216: see deploy-dev — same never-fail on merge outcome.
|
||||
MERGE_RESP=$(curl -sS -X POST \
|
||||
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -262,8 +269,11 @@ jobs:
|
||||
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge")
|
||||
MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false')
|
||||
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
|
||||
# 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"
|
||||
exit 0
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user