forked from cartsnitch/cartsnitch
Merge pull request 'promote: CAR-1216 deploy never hard-fail on infra-PR merge (dev → uat)' (#290) from dev into uat
This commit is contained in:
+24
-20
@@ -577,6 +577,16 @@ jobs:
|
|||||||
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 (immutable
|
||||||
|
# branch protection); the CI bot (`CI_GITEA_TOKEN`) can never self-
|
||||||
|
# approve, so this merge call structurally cannot succeed in the
|
||||||
|
# general case. Any non-merged outcome (approvals pending, checks
|
||||||
|
# pending, any other Gitea message) is the GitOps approval gate, not
|
||||||
|
# a CI failure — the PR is already opened and `cs_savannah` is
|
||||||
|
# requested as reviewer above. Surface the response as a notice and
|
||||||
|
# exit success. The only hard-fail (`exit 1`) in this step remains
|
||||||
|
# the empty-`PR_NUM` check (PR could not be created at all).
|
||||||
MERGE_RESP=$(curl -sS -X POST \
|
MERGE_RESP=$(curl -sS -X POST \
|
||||||
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
@@ -585,17 +595,9 @@ 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 main"
|
echo "PR #${PR_NUM} merged into cartsnitch/infra main"
|
||||||
elif echo "$MERGE_RESP" | grep -qi 'does not have enough approvals'; then
|
|
||||||
# GitOps approval gate: the PR is correctly opened and surfaces in
|
|
||||||
# the CTO queue via the reviewers request above. Treat as success
|
|
||||||
# (exit 0) so the deploy job does not hard-fail on the approvals
|
|
||||||
# requirement that only a human maintainer can satisfy.
|
|
||||||
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"
|
echo "::notice::infra PR #${PR_NUM} opened and awaiting CTO (cs_savannah) approve+merge — GitOps approval gate, not a failure: $MERGE_RESP"
|
||||||
echo "::error::Reassign to cs_savannah (authorized merger for cartsnitch/infra main) for backstop merge."
|
exit 0
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deploy-uat:
|
deploy-uat:
|
||||||
@@ -721,6 +723,16 @@ jobs:
|
|||||||
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 (immutable
|
||||||
|
# branch protection); the CI bot (`CI_GITEA_TOKEN`) can never self-
|
||||||
|
# approve, so this merge call structurally cannot succeed in the
|
||||||
|
# general case. Any non-merged outcome (approvals pending, checks
|
||||||
|
# pending, any other Gitea message) is the GitOps approval gate, not
|
||||||
|
# a CI failure — the PR is already opened and `cs_savannah` is
|
||||||
|
# requested as reviewer above. Surface the response as a notice and
|
||||||
|
# exit success. The only hard-fail (`exit 1`) in this step remains
|
||||||
|
# the empty-`PR_NUM` check (PR could not be created at all).
|
||||||
MERGE_RESP=$(curl -sS -X POST \
|
MERGE_RESP=$(curl -sS -X POST \
|
||||||
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
@@ -729,15 +741,7 @@ 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 main"
|
echo "PR #${PR_NUM} merged into cartsnitch/infra main"
|
||||||
elif echo "$MERGE_RESP" | grep -qi 'does not have enough approvals'; then
|
|
||||||
# GitOps approval gate: the PR is correctly opened and surfaces in
|
|
||||||
# the CTO queue via the reviewers request above. Treat as success
|
|
||||||
# (exit 0) so the deploy job does not hard-fail on the approvals
|
|
||||||
# requirement that only a human maintainer can satisfy.
|
|
||||||
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"
|
echo "::notice::infra PR #${PR_NUM} opened and awaiting CTO (cs_savannah) approve+merge — GitOps approval gate, not a failure: $MERGE_RESP"
|
||||||
echo "::error::Reassign to cs_savannah (authorized merger for cartsnitch/infra main) for backstop merge."
|
exit 0
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user