#!/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. # 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 — 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 } # 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)." }