fix(ci): broaden graceful-exit on infra PR auto-merge (CAR-1438) [dev→uat] #48
+13
-12
@@ -142,7 +142,8 @@ 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." \
|
TITLE="ci(dev): update auth image (${GITHUB_SHA::12})"
|
||||||
|
PR_BODY=$(jq -n --arg head "cartsnitch:${BRANCH}" --arg base dev --arg title "$TITLE" --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: $base, title: $title, body: $body}')
|
||||||
PR_JSON=$(curl -sS -X POST \
|
PR_JSON=$(curl -sS -X POST \
|
||||||
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||||
@@ -176,12 +177,11 @@ jobs:
|
|||||||
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 dev"
|
||||||
elif echo "$MERGE_RESP" | grep -qi 'does not have enough approvals'; then
|
|
||||||
echo "::notice::infra PR #${PR_NUM} opened and awaiting CTO (cs_savannah) approve+merge — GitOps approval gate, not a failure"
|
|
||||||
exit 0
|
|
||||||
else
|
else
|
||||||
echo "::error::Auto-merge of cartsnitch/infra PR #${PR_NUM} failed: $MERGE_RESP"
|
# CAR-1438: PR opened successfully; any non-merged outcome (empty body,
|
||||||
exit 1
|
# approval-gate, pending checks) is the GitOps gate — not a failure.
|
||||||
|
echo "::notice::infra PR #${PR_NUM} opened — auto-merge not available (${MERGE_RESP:-empty response}); awaiting CTO (cs_savannah) approve+merge"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deploy-uat:
|
deploy-uat:
|
||||||
@@ -243,7 +243,8 @@ 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." \
|
TITLE="ci(uat): update auth image (${GITHUB_SHA::12})"
|
||||||
|
PR_BODY=$(jq -n --arg head "cartsnitch:${BRANCH}" --arg base uat --arg title "$TITLE" --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: $base, title: $title, body: $body}')
|
||||||
PR_JSON=$(curl -sS -X POST \
|
PR_JSON=$(curl -sS -X POST \
|
||||||
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||||
@@ -273,10 +274,10 @@ jobs:
|
|||||||
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 uat"
|
||||||
elif echo "$MERGE_RESP" | grep -qi 'does not have enough approvals'; then
|
|
||||||
echo "::notice::infra PR #${PR_NUM} opened and awaiting CTO (cs_savannah) approve+merge — GitOps approval gate, not a failure"
|
|
||||||
exit 0
|
|
||||||
else
|
else
|
||||||
echo "::error::Auto-merge of cartsnitch/infra PR #${PR_NUM} failed: $MERGE_RESP"
|
# CAR-1438: PR opened successfully; any non-merged outcome (empty body,
|
||||||
exit 1
|
# approval-gate, pending checks) is the GitOps gate — not a failure.
|
||||||
|
echo "::notice::infra PR #${PR_NUM} opened — auto-merge not available (${MERGE_RESP:-empty response}); awaiting CTO (cs_savannah) approve+merge"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user