#!/usr/bin/env bash # Shared deploy methodology for all ia_dev–managed projects: environments, quality bar, ordering contract. # Sourced by ia_dev/deploy/deploy.sh and ia_dev/deploy/orchestrator.sh — no project-specific paths here. # # Boundary (approved workflow): # - Everything strictly identical across projects (allowed envs, shared tooling checks, shared conf.json # field handling) lives in deploy-methodology.sh and siblings under deploy/lib/ (e.g. deploy-conf-handling.sh). # - The repository’s project orchestrator (deploy.project_orchestrator_path) only sequences project-specific # work (e.g. LeCoffre: _lib/deploy-phase-*.sh, remote layout, Prisma, systemd unit names). # When a step is candidate for hoisting, move it here or into a small deploy/lib/*.sh peer; shrink the project script. # 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 — 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 (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 — 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 (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 }