feat(deploy): preserve immutable release manifests and restore pinned images

This commit is contained in:
TakuyaYagam1 committed 2026-10-07 11:24:14 +03:00
1 parent 4ee53d9a74
commit 7df521bd89
7 files changed
+1417 -110

No files matched your search

+16 -11
View File
@@ -24,8 +24,14 @@ RELEASE := PYTHONDONTWRITEBYTECODE=1 python3 "$(RELEASE_SCRIPT)"
RELEASE_PULL ?= missing
# Compose project whose running containers release-manifest-verify compares.
RELEASE_VERIFY_PROJECT ?= $(APP_PROJECT)
# Optional manifest path for release-manifest-verify; empty means the current tag.
# Optional manifest path for release-manifest-check, verify, and restore.
# Empty selects RELEASE_ID when set, otherwise the current commit-based ID.
RELEASE_MANIFEST ?=
# Optional immutable delivery ID; empty keeps the current commit-based ID.
RELEASE_ID ?=
# Optional repository-relative manifest describing bank, policy, and seed inputs.
RELEASE_DATA_MANIFEST ?=
RELEASE_MANIFEST_ARG = $(if $(strip $(RELEASE_MANIFEST)),--manifest "$(RELEASE_MANIFEST)",$(if $(strip $(RELEASE_ID)),--manifest "deploy/release/$(RELEASE_ID)/manifest.json",))
# Recursive on purpose: git is asked only by the targets that use the tag. The
# project-specific name keeps a generic RELEASE_TAG from enabling release mode.
LINCODEX_RELEASE_TAG ?= $(shell PYTHONDONTWRITEBYTECODE=1 python3 "$(RELEASE_SCRIPT)" tag)
@@ -137,23 +143,22 @@ release-smoke: ## Run the smoke against the release images and record passing ev
release-e2e: ## Run the Playwright suite against the release images and record passing evidence
@LINCODEX_RELEASE_TAG="$(LINCODEX_RELEASE_TAG)" bash scripts/e2e.sh
release-manifest: ## Write deploy/release/<tag>/manifest.json from local images and recorded evidence
@$(RELEASE) manifest
release-manifest: ## Publish an immutable deploy/release/<id>/manifest.json from local images and data versions
@$(RELEASE) manifest $(if $(strip $(RELEASE_ID)),--release-id "$(RELEASE_ID)",) $(if $(strip $(RELEASE_DATA_MANIFEST)),--data-manifest "$(RELEASE_DATA_MANIFEST)",)
release-manifest-verify: ## Compare running containers of RELEASE_VERIFY_PROJECT with the manifest (or RELEASE_MANIFEST)
@$(RELEASE) verify --project "$(RELEASE_VERIFY_PROJECT)" $(if $(RELEASE_MANIFEST),--manifest "$(RELEASE_MANIFEST)")
@$(RELEASE) verify --project "$(RELEASE_VERIFY_PROJECT)" $(RELEASE_MANIFEST_ARG)
release-manifest-check: ## Check the manifest structure and scan it for secrets and machine data
@$(RELEASE) check
@$(RELEASE) check $(RELEASE_MANIFEST_ARG)
release-up: ## Start the core stack from the release images without building or pulling
release-up: ## Restore the core stack from an immutable release manifest without building or pulling
@test -f "$(ENV_FILE)" || { printf 'Missing %s. Copy .env.example to .env and replace the placeholder passwords.\n' "$(ENV_FILE)" >&2; exit 2; }
@$(RELEASE) require-images --tag "$(LINCODEX_RELEASE_TAG)"
APP_PROJECT="$(APP_PROJECT)" APP_NETWORK="$(APP_NETWORK)" LINCODEX_RELEASE_TAG="$(LINCODEX_RELEASE_TAG)" $(DOCKER) compose --env-file "$(ENV_FILE)" -p "$(APP_PROJECT)" -f "$(CORE_FILE)" -f "$(RELEASE_FILE)" up -d --no-build --pull never --wait --wait-timeout 180
@$(RELEASE) restore --action up --project "$(APP_PROJECT)" --env-file "$(ENV_FILE)" $(RELEASE_MANIFEST_ARG)
release-down: ## Stop the core stack started by release-up and keep named volumes
release-down: ## Stop the release project selected by the immutable manifest and keep named volumes
@test -f "$(ENV_FILE)" || { printf 'Missing %s.\n' "$(ENV_FILE)" >&2; exit 2; }
APP_PROJECT="$(APP_PROJECT)" APP_NETWORK="$(APP_NETWORK)" LINCODEX_RELEASE_TAG="$(LINCODEX_RELEASE_TAG)" $(DOCKER) compose --env-file "$(ENV_FILE)" -p "$(APP_PROJECT)" -f "$(CORE_FILE)" -f "$(RELEASE_FILE)" down
@$(RELEASE) restore --action down --project "$(APP_PROJECT)" --env-file "$(ENV_FILE)" $(RELEASE_MANIFEST_ARG)
release-clean: ## Remove the local lincodex.invalid/* release images; keep deploy/release files
release-clean: ## Remove local release image references not retained by an immutable manifest
@$(RELEASE) clean-images