fix(deploy): clear stale self-deploy markers on rollback; document env
Re-deploy after a FAILED prod deploy wedged the task on `deploy`: the sentinel markers (approve-requested/initiated/result) are keyed by the stable work_item_id, so after the БАГ-8 rollback (deploy -> development) and a developer fix, Phase B's idempotency-guard saw a STALE `initiated` and became a no-op — the detached hook never re-launched and the finalizer was never enqueued. Add self_deploy.clear_state (never-raise, idempotent) and call it on the check_deploy_status FAILED rollback and at the start of Phase A, so every fresh prod-deploy pass starts clean. Also document the new ORCH_SELF_DEPLOY_* / ORCH_DEPLOY_* descriptors in the canonical .env.example (CLAUDE.md rule #8, ТЗ §2.6), modelled on the ORCH-043 merge-gate block (placeholders only, secrets not committed). Contracts untouched: STAGE_TRANSITIONS, QG_CHECKS, _parse_deploy_status, БАГ-8, merge-gate. Refs: ORCH-036 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
35
.env.example
35
.env.example
@@ -36,3 +36,38 @@ ORCH_MERGE_RETEST_TARGET=tests/
|
||||
ORCH_MERGE_LOCK_TIMEOUT_S=300
|
||||
ORCH_MERGE_DEFER_DELAY_S=60
|
||||
ORCH_MERGE_DEFER_MAX_ATTEMPTS=5
|
||||
# ORCH-036: executable self-deploy of the `deploy` stage. For the self-hosting repo
|
||||
# (orchestrator) the stage REALLY restarts prod (8500) via a detached host hook;
|
||||
# deploy_status: SUCCESS means proven health-ok, not an LLM declaration. Three
|
||||
# deterministic phases (A: request approve, B: human Approved -> detached deploy,
|
||||
# C: finalizer maps hook exit-code -> deploy_status). Non-self repos: unchanged
|
||||
# synchronous ssh deploy. SECRETS / host paths live ONLY on the host — do NOT commit.
|
||||
# SELF_DEPLOY_ENABLED -> global kill-switch (false -> legacy synchronous deploy for all).
|
||||
# SELF_DEPLOY_REPOS -> CSV of repos where Phase A/B/C is REAL; empty -> only the
|
||||
# self-hosting repo (orchestrator); others -> no-op (mirrors ORCH-35).
|
||||
# DEPLOY_REQUIRE_MANUAL_APPROVE -> require a human Plane "Approved" before the prod
|
||||
# deploy (true on rollout; full auto is ORCH-54).
|
||||
# DEPLOY_FINALIZE_DELAY_S -> delay before the first/each finalize poll (>= hook+health).
|
||||
# DEPLOY_FINALIZE_MAX_ATTEMPTS -> bounded finalize-defer budget (anti-livelock).
|
||||
# DEPLOY_SSH_USER / DEPLOY_SSH_HOST -> ssh target for the host hook (DEPLOY_SSH_HOST
|
||||
# empty -> detached deploy will NOT launch; set on the host).
|
||||
# DEPLOY_HOOK_SCRIPT -> path to the hook ON THE HOST (relative to the repo).
|
||||
# DEPLOY_HOST_REPO_PATH -> orchestrator clone path on the host.
|
||||
# DEPLOY_PROD_SOURCE_IMAGE -> staging-validated image, retagged build-once (no rebuild).
|
||||
# DEPLOY_PROD_TARGET_SERVICE / _PORT / _IMAGE / _COMPOSE_PROFILE -> prod compose profile.
|
||||
# DEPLOY_PROD_PREV_IMAGE_FILE -> prod prev-image snapshot (separate from staging's).
|
||||
ORCH_SELF_DEPLOY_ENABLED=true
|
||||
ORCH_SELF_DEPLOY_REPOS=
|
||||
ORCH_DEPLOY_REQUIRE_MANUAL_APPROVE=true
|
||||
ORCH_DEPLOY_FINALIZE_DELAY_S=90
|
||||
ORCH_DEPLOY_FINALIZE_MAX_ATTEMPTS=10
|
||||
ORCH_DEPLOY_SSH_USER=slin
|
||||
ORCH_DEPLOY_SSH_HOST=
|
||||
ORCH_DEPLOY_HOOK_SCRIPT=scripts/orchestrator-deploy-hook.sh
|
||||
ORCH_DEPLOY_HOST_REPO_PATH=/home/slin/repos/orchestrator
|
||||
ORCH_DEPLOY_PROD_SOURCE_IMAGE=orchestrator-orchestrator-staging
|
||||
ORCH_DEPLOY_PROD_TARGET_SERVICE=orchestrator
|
||||
ORCH_DEPLOY_PROD_TARGET_PORT=8500
|
||||
ORCH_DEPLOY_PROD_TARGET_IMAGE=orchestrator-orchestrator
|
||||
ORCH_DEPLOY_PROD_COMPOSE_PROFILE=
|
||||
ORCH_DEPLOY_PROD_PREV_IMAGE_FILE=.deploy-prev-image-prod
|
||||
|
||||
Reference in New Issue
Block a user