fix(ci): prepare fail-closed exact-SHA code-only Stage release
This commit is contained in:
1 parent
af32ec14e1
commit
52a7aebb51
6 files changed
+141
-10
No files matched your search
+16
-7
@@ -1,6 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ "${1:-develop}" = develop ] && [ "${2:-}" = "" ]; then
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
exec bash "$SCRIPT_DIR/release-cache-stage.sh"
|
||||
fi
|
||||
|
||||
# Explicit no-data-write stage rollout. Run only after testing and pushing HEAD.
|
||||
if [ "${2:-}" = "stage-backend-only" ]; then
|
||||
[ "${1:-}" = "develop" ] || exit 2
|
||||
@@ -105,12 +110,16 @@ if [ ! -s .support-chat.env ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure .revalidation.env exists and is properly provisioned with valid secret
|
||||
if [ -f "scripts/provision-revalidation-env.py" ]; then
|
||||
python3 scripts/provision-revalidation-env.py --environment "${BRANCH:-stage}" --source .revalidation.env --output .revalidation.env.tmp 2>/dev/null && mv .revalidation.env.tmp .revalidation.env && chmod 600 .revalidation.env || touch .revalidation.env
|
||||
else
|
||||
touch .revalidation.env
|
||||
fi
|
||||
# Legacy main path must fail closed rather than deploy an empty secret file.
|
||||
ENVIRONMENT=prod
|
||||
[ "$BRANCH" = develop ] && ENVIRONMENT=stage
|
||||
exec 9>"${TARGET_DIR}/../${ENVIRONMENT}-revalidation-deploy.lock"
|
||||
flock -n 9 || exit 1
|
||||
[ -f scripts/provision-revalidation-env.py ] || exit 1
|
||||
python3 scripts/provision-revalidation-env.py --environment "$ENVIRONMENT" \
|
||||
--source .revalidation.env --output .revalidation.env.tmp
|
||||
# The operational source remains unchanged; this validated copy is disposable.
|
||||
rm .revalidation.env.tmp
|
||||
|
||||
# ✅ فایلهای کانفیگ را از پوشهی scripts مخزن به TARGET_DIR کپی میکنیم
|
||||
echo "Copying configuration files in $TARGET_DIR..."
|
||||
@@ -138,7 +147,7 @@ BOT_ENV="${TARGET_DIR}/.support-bot.runtime.env"
|
||||
docker inspect -f '{{range .Config.Env}}{{println .}}{{end}}' canina-bot > "${BOT_ENV}"
|
||||
chmod 600 "${BOT_ENV}"
|
||||
echo "Starting containers..."
|
||||
docker compose up -d --remove-orphans --force-recreate backend_stage frontend_stage
|
||||
docker compose up -d --no-deps --force-recreate "backend_${ENVIRONMENT}" "frontend_${ENVIRONMENT}"
|
||||
echo "Starting support-chat bot container..."
|
||||
docker rm -f canina-bot >/dev/null 2>&1 || true
|
||||
docker run -d --name canina-bot --restart unless-stopped --env-file "${BOT_ENV}" -e HERMES_HOME=/opt/data -e HERMES_RUNTIME_DIR=/opt/hermes/tools -e API_SERVER_HOST=0.0.0.0 -e API_SERVER_PORT=8642 --network traefik_public -v canina_bot_data:/opt/data "${BOT_IMAGE}" gateway run
|
||||
|
||||
Reference in new issue
Block a user