ia_dev/deploy/lib/deploy-conf-handling.sh
Nicolas Cantu 4d4264fc41 docs(agents+deploy): setup-host agent, deploy flags doc sync
Etat initial
- Agents and project docs still referenced --skipSetupHost, --import-v1 on CLI, and optional log flags.

Motivation du changement
- Align ia_dev agents and mirrored docs with LeCoffre deploy.sh (setup via run-setup-host.sh, business flags in deploy.conf only, logs always on).

Resolution
- Add .cursor/agents/setup-host.md; update change-to-all-branches, deploy-by-script, deploy-pprod-or-prod; refresh agents-scripts-split and WORKFLOWS for lecoffreio and ia_dev projects.

Root cause
- Documentation drift after deploy CLI and pipeline changes.

Fonctionnalités impactées
- Cursor agent instructions only (no runtime code path change in this commit beyond files listed).

Code modifié
- .cursor/agents/*.md, deploy/*.sh, deploy/lib/*.sh, projects/*/docs/*.md as staged.

Documentation modifiée
- projects/lecoffreio/docs/agents-scripts-split.md, WORKFLOWS_AND_COMPONENTS.md; projects/ia_dev/docs/* (same).

Configurations modifiées
- none.

Fichiers dans déploy modifiés
- deploy/change-to-all-branches.sh, deploy-by-script-to.sh, deploy.sh, lib/README.md, deploy-conf-handling.sh, deploy-methodology.sh, orchestrator.sh (pre-existing session changes + doc alignment).

Fichiers dans logs impactés
- none.

Bases de données et autres sources modifiées
- none.

Modifications hors projet
- none.

fichiers dans .cursor/ modifiés
- .cursor/agents/setup-host.md (new), change-to-all-branches.md, deploy-by-script.md, deploy-pprod-or-prod.md.

fichiers dans .secrets/ modifiés
- none.

nouvelle sous sous version dans VERSION
- N/A (ia_dev repo has no VERSION file).

CHANGELOG.md mise à jour (oui/non)
- non
2026-03-23 14:02:58 +01:00

56 lines
2.1 KiB
Bash

#!/usr/bin/env bash
# ia_dev — conf.json handling identical for every managed project (jq, secrets_path → SECRETS_BASE).
# Add here any new deploy.* field that must be read the same way for all projects.
# Do not put project-specific paths, hostnames, or phase ordering here beyond generic keys.
# ia_dev_deploy_require_jq <log_tag> — exit 1 if jq missing (e.g. log_tag="[orchestrator]")
ia_dev_deploy_require_jq() {
local tag="${1:-[ia_dev][deploy]}"
if ! command -v jq >/dev/null 2>&1; then
echo "${tag}[ERROR] jq is required to read deploy.* from conf.json" >&2
exit 1
fi
}
# ia_dev_deploy_secrets_export_from_conf <conf_path> — export SECRETS_BASE + LECOFFRE_SECRETS_BASE when deploy.secrets_path is a directory
ia_dev_deploy_secrets_export_from_conf() {
local conf="${1:?}"
local secrets_path
secrets_path="$(jq -r '.deploy.secrets_path // empty' "$conf")"
if [[ -n "$secrets_path" && "$secrets_path" != "null" && -d "$secrets_path" ]]; then
export SECRETS_BASE="$secrets_path"
export LECOFFRE_SECRETS_BASE="$secrets_path"
fi
}
# ia_dev_deploy_export_runtime_context <repository_root> <env> — required handoff to project orchestrator (blocking checks below)
ia_dev_deploy_export_runtime_context() {
local repo="${1:?}"
local env="${2:?}"
export IA_DEV_DEPLOY_REPO_ROOT="$repo"
export IA_DEV_DEPLOY_ENV="$env"
}
# ia_dev_deploy_assert_handoff_context <repository_root> <env> <log_tag> — exit 1 if exports missing or inconsistent (no fallback)
ia_dev_deploy_assert_handoff_context() {
local repo="${1:?}"
local env="${2:?}"
local tag="${3:-[orchestrator]}"
if [[ -z "$repo" || ! -d "$repo" ]]; then
echo "${tag}[ERROR] Handoff: repository root invalid or not a directory: ${repo}" >&2
exit 1
fi
if [[ -z "$env" ]]; then
echo "${tag}[ERROR] Handoff: env is empty" >&2
exit 1
fi
if [[ "${IA_DEV_DEPLOY_REPO_ROOT:-}" != "$repo" ]]; then
echo "${tag}[ERROR] Handoff: IA_DEV_DEPLOY_REPO_ROOT mismatch or unset (expected ${repo})" >&2
exit 1
fi
if [[ "${IA_DEV_DEPLOY_ENV:-}" != "$env" ]]; then
echo "${tag}[ERROR] Handoff: IA_DEV_DEPLOY_ENV mismatch or unset (expected ${env}, got ${IA_DEV_DEPLOY_ENV:-})" >&2
exit 1
fi
}