ia_dev/deploy/lib/deploy-methodology.sh
Nicolas Cantu f1c53477b0 feat(deploy): methodology lib and project_orchestrator_path
**Motivations:**
- Keep shared methodology, envs, and future quality sequences in ia_dev; single project orchestrator script per repo

**Root causes:**
- N/A

**Correctifs:**
- N/A

**Evolutions:**
- Add deploy/lib/deploy-methodology.sh (test|pprod|prod validation)
- deploy.sh sources methodology before orchestrator
- orchestrator prefers deploy.project_orchestrator_path then legacy phases/deploy_script_path
- conf.json: project_orchestrator_path for lecoffreio, algo, enso; remove hooks where redundant
- Document in README.md, projects/README.md, deploy/lib/README.md

**Pages affectées:**
- deploy/*, projects/*/conf.json, README files
2026-03-23 13:19:03 +01:00

49 lines
1.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# Shared deploy methodology for all ia_devmanaged projects: environments, quality bar, ordering contract.
# Sourced by ia_dev/deploy/deploy.sh and ia_dev/deploy/orchestrator.sh — no project-specific paths here.
# Project-specific sequencing lives only in the repository's project orchestrator (deploy.project_orchestrator_path).
# Environments are fixed across projects; extend only with an explicit decision and conf migration.
IA_DEV_DEPLOY_ENVS=(test pprod prod)
# ia_dev_deploy_env_is_allowed <word> — exit 0 if allowed
ia_dev_deploy_env_is_allowed() {
local e="${1:-}"
local x
for x in "${IA_DEV_DEPLOY_ENVS[@]}"; do
if [[ "$e" == "$x" ]]; then
return 0
fi
done
return 1
}
# ia_dev_deploy_assert_first_arg_env "$@" — first positional must be test|pprod|prod; stderr + exit 1 otherwise
ia_dev_deploy_assert_first_arg_env() {
if [[ $# -lt 1 ]]; then
echo "[ia_dev][deploy][ERROR] Missing <env> (expected: test | pprod | prod)" >&2
return 1
fi
local env_arg="$1"
ia_dev_deploy_assert_env_literal "$env_arg"
}
# ia_dev_deploy_assert_env_literal <env> — validate a single env token
ia_dev_deploy_assert_env_literal() {
local env_arg="${1:-}"
if [[ -z "$env_arg" ]]; then
echo "[ia_dev][deploy][ERROR] Missing <env> (expected: test | pprod | prod)" >&2
return 1
fi
if ! ia_dev_deploy_env_is_allowed "$env_arg"; then
echo "[ia_dev][deploy][ERROR] Invalid env '${env_arg}' (allowed: ${IA_DEV_DEPLOY_ENVS[*]})" >&2
return 1
fi
return 0
}
# ia_dev_deploy_log_methodology_banner — optional trace for support
ia_dev_deploy_log_methodology_banner() {
echo "[ia_dev][deploy] Methodology: envs={${IA_DEV_DEPLOY_ENVS[*]}} ; project orchestrator invoked after conf + secrets export (see orchestrator.sh)."
}