ia_dev/deploy/change-to-all-branches.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

57 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# From branch test only: align origin/test, origin/pprod, origin/prod then deploy to test (see $SECRETS_BASE/test/deploy.conf for RUN_IMPORT_V1 etc.).
# Usage: ./deploy/change-to-all-branches.sh [project_id]
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)"
# Optional first arg: project id (must exist as projects/<id>/conf.json); then re-exec from project root
if [[ -n "${1:-}" && -f "${IA_DEV_ROOT}/projects/${1}/conf.json" ]]; then
export IA_PROJECT_ID="$1"
shift
# shellcheck source=../lib/project_config.sh
source "${IA_DEV_ROOT}/lib/project_config.sh"
[[ -n "${PROJECT_ID:-}" ]] && export IA_PROJECT_ID="$PROJECT_ID"
# shellcheck source=../lib/project_git_root_from_conf.sh
source "${IA_DEV_ROOT}/lib/project_git_root_from_conf.sh"
ia_dev_resolve_project_git_root
PROJECT_ROOT="${IA_PROJECT_GIT_ROOT:-}"
if [[ -z "$PROJECT_ROOT" || ! -d "$PROJECT_ROOT" ]]; then
echo "[change-to-all-branches][ERROR] Could not resolve project root for project_id ${IA_PROJECT_ID}" >&2
exit 1
fi
cd "$PROJECT_ROOT" && exec "${DEPLOY_DIR}/$(basename "${BASH_SOURCE[0]:-$0}")" "$@"
fi
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "[change-to-all-branches][ERROR] Not in a git repository" >&2
exit 1
fi
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
if [[ "$(pwd)" != "$PROJECT_ROOT" ]]; then
cd "$PROJECT_ROOT" && exec "${DEPLOY_DIR}/$(basename "${BASH_SOURCE[0]:-$0}")" "$@"
fi
current="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$current" != "test" ]]; then
echo "[change-to-all-branches][ERROR] Must be on branch 'test' (current: '${current}')" >&2
exit 1
fi
echo "[change-to-all-branches] Aligning branches..."
"$DEPLOY_DIR/branch-align.sh" test
# scripts_v2 lives in the host project's deploy/ (not necessarily under ia_dev)
DEPLOY_SCRIPTS_V2="${PROJECT_ROOT}/deploy/scripts_v2"
echo "[change-to-all-branches] Deploying test (--no-sync-origin; business flags from deploy.conf only)..."
if [[ -n "${IA_PROJECT_ID:-}" && -x "${DEPLOY_DIR}/orchestrator.sh" ]]; then
"${DEPLOY_DIR}/orchestrator.sh" test --no-sync-origin
else
"${DEPLOY_SCRIPTS_V2}/deploy.sh" test --no-sync-origin
fi
echo "[change-to-all-branches] OK"