feat(P41): per-environment CI jobs + environment workflow input

---ci---
project: acdl
phase: 41
milestone: v1.9
status: execute
---/ci---

Phase 41 — per-environment-ci-jobs (REQ-105, REQ-106, D-082):

Per-env contracts (REQ-105):
- contracts/static-assets.{dev,qa,prod,dr}.yaml + microservice.{dev,qa,prod,dr}.yaml
  (8 files, each sets environment: to its own name, uses interpolation).
- Default contracts/static-assets.yaml + microservice.yaml preserved (backwards compat).

Deploy workflow environment input (REQ-106):
- .github/workflows/deploy.yml + .gitea/workflows/deploy.yml (byte-identical):
  new 'environment' workflow_call input (default empty, override).
- scripts/run_platform.sh: --environment <name> flag; exports
  ACDL_ENVIRONMENT_OVERRIDE; re-runs env check against the override.
- core/contract_resolver.py: resolve(environment_override=...) (D-088);
  CLI honors --environment flag + ACDL_ENVIRONMENT_OVERRIDE env var.

Consumer guide (REQ-106):
- docs/consumer-guide.md: 'Per-environment deployment' section with 4
  caller-workflow examples (dev/qa/prod/dr), HITL gate structure
  (approve_qa/approve_prod/approve_dr, D-042), interpolation reference table.
- Documents promotion-without-editing + hybrid model (per-env contracts
  OR single contract + env input).

Tests: +40 (test_per_env_contracts.py, test_deploy_workflow_env_input.py,
test_consumer_guide_per_env_section.py). 446 passed; run_ci.sh green;
deploy workflows byte-identical.
This commit is contained in:
Jon Chery
2026-07-23 04:34:10 +00:00
parent 481cfe760c
commit cd637808f5
17 changed files with 438 additions and 10 deletions
+18 -1
View File
@@ -42,15 +42,26 @@ QUIET=0
DEPLOY_UPTIME=0
DECOMMISSION=0
CHANGE_REQUEST_ID=""
ENVIRONMENT_OVERRIDE=""
CONTRACT=""
# Parse args; --environment takes a value (either --environment=VALUE or
# --environment VALUE). The contract / changeRequestId are the remaining
# positional args.
_prev=""
for arg in "$@"; do
if [ "$_prev" = "--environment" ]; then
ENVIRONMENT_OVERRIDE="$arg"; _prev=""
continue
fi
case "$arg" in
--check-only) CHECK_ONLY=1 ;;
--plan-only) PLAN_ONLY=1 ;;
--quiet) QUIET=1 ;;
--deploy-uptime) DEPLOY_UPTIME=1 ;;
--decommission) DECOMMISSION=1 ;;
--environment=*) ENVIRONMENT_OVERRIDE="${arg#*=}" ;;
--environment) _prev="--environment" ;;
--*) echo "FAIL: unknown flag: $arg" >&2; exit 1 ;;
*)
if [ "$DECOMMISSION" = "1" ] && [ -z "$CHANGE_REQUEST_ID" ]; then
@@ -102,7 +113,13 @@ TF_DIR="$WORK/tf"
rm -rf "$WORK"; mkdir -p "$TF_DIR"
echo "=== Step 0: environment onboarding check ==="
if [ -f "$CONTRACT" ]; then
if [ -n "$ENVIRONMENT_OVERRIDE" ]; then
export ACDL_ENVIRONMENT_OVERRIDE="$ENVIRONMENT_OVERRIDE"
python3 core/environment_check.py --env="$ENVIRONMENT_OVERRIDE" || {
echo "FAIL: environment not bound — see the onboarding prompt above" >&2
exit 1
}
elif [ -f "$CONTRACT" ]; then
python3 core/environment_check.py "$CONTRACT" || {
echo "FAIL: environment not bound — see the onboarding prompt above" >&2
exit 1