ia_dev/deploy/deploy.sh
Nicolas Cantu 0a9d6e001b feat(deploy): generic orchestrator and deploy.sh entry
**Motivations:**
- Single generic orchestration in ia_dev while business logic stays in each project repo

**Root causes:**
- N/A (evolution)

**Correctifs:**
- N/A

**Evolutions:**
- Add orchestrator.sh (deploy.hooks.phases or fallback deploy.deploy_script_path)
- Add deploy.sh <project_id> <env> [options] as canonical entry from ia_dev root
- run-project-hooks.sh execs orchestrator.sh for backward compatibility
- change-to-all-branches.sh and deploy-by-script-to.sh invoke orchestrator.sh when IA_PROJECT_ID is set
- Document orchestration in README.md and deploy/lib/README.md

**Pages affectées:**
- README.md, deploy/orchestrator.sh, deploy/deploy.sh, deploy/run-project-hooks.sh, deploy/change-to-all-branches.sh, deploy/deploy-by-script-to.sh, deploy/lib/README.md
2026-03-23 13:04:18 +01:00

28 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Generic deploy entry from ia_dev: sets IA_PROJECT_ID and runs the orchestrator.
# Business logic remains in the target repository (deploy_script_path, hooks.phases).
# Usage (from ia_dev root): ./deploy/deploy.sh <project_id> <env> [options...]
# Example: ./deploy/deploy.sh lecoffreio test --import-v1 --skipSetupHost
set -euo pipefail
SCRIPT_REAL="$(readlink -f "${BASH_SOURCE[0]:-$0}" 2>/dev/null || realpath "${BASH_SOURCE[0]:-$0}" 2>/dev/null || echo "${BASH_SOURCE[0]:-$0}")"
DEPLOY_DIR="$(cd "$(dirname "$SCRIPT_REAL")" && pwd)"
IA_DEV_ROOT="$(cd "$DEPLOY_DIR/.." && pwd)"
if [[ $# -lt 2 ]]; then
echo "[deploy][ERROR] Missing arguments" >&2
echo "Usage: $0 <project_id> <env> [options passed to each phase / fallback deploy script]" >&2
echo "Example: $0 lecoffreio test --import-v1 --skipSetupHost" >&2
exit 1
fi
CONF="${IA_DEV_ROOT}/projects/${1}/conf.json"
if [[ ! -f "$CONF" ]]; then
echo "[deploy][ERROR] No conf for project '${1}': ${CONF}" >&2
exit 1
fi
export IA_PROJECT_ID="$1"
shift
exec "$DEPLOY_DIR/orchestrator.sh" "$@"