feat(deploy): gate immutable production CI promotion on audited Stage acceptance

This commit is contained in:
Canina Engineering committed 2026-10-25 06:52:32 +00:00
1 parent 5f5c3eb3b9
commit 448c250944
6 files changed
+268 -11

No files matched your search

+11 -3
View File
@@ -1,9 +1,9 @@
#!/bin/bash
set -euo pipefail
set +x
# CI/CD-only Stage rollout; Production awaits separate reviewed authorization.
if [ "${GITHUB_ACTIONS:-${GITEA_ACTIONS:-}}" != true ] || [ "${1:-}" != develop ] || [ "$#" != 1 ]; then
echo 'ERROR: refusing deployment outside CI/CD Stage rollout' >&2
# CI-only boundary: main is a code-only immutable promotion with private receipt.
if [ "${GITHUB_ACTIONS:-${GITEA_ACTIONS:-}}" != true ] || [[ "${1:-}" != develop && "${1:-}" != main ]] || [ "$#" != 1 ]; then
echo 'ERROR: refusing deployment outside authenticated CI/CD rollout' >&2
exit 2
fi
if [[ ! "${DEPLOY_SHA:-}" =~ ^[0-9a-f]{40}$ ]]; then
@@ -11,6 +11,14 @@ if [[ ! "${DEPLOY_SHA:-}" =~ ^[0-9a-f]{40}$ ]]; then
exit 2
fi
# END ROLLOUT GUARD
if [[ $1 == main ]]; then
umask 077
helper=$(mktemp)
trap 'rm -f "$helper"' EXIT
wget --no-proxy -qO "$helper" "https://git.parsaaghayi.ir/parsa/canina/raw/commit/${DEPLOY_SHA}/scripts/rollout-production.sh"
bash "$helper"
exit
fi
exec 9>/opt/services/canina/stage-backend-deploy.lock
flock -n 9 || { echo 'Stage deployment already in progress' >&2; exit 1; }
umask 077