deploy: source LeCoffre deploy-log-filename.sh for tee log path

**Motivations:** Single source of truth with lecoffre_ng_test deploy/scripts_v2/_lib/deploy-log-filename.sh.

**Correctives:** Source project_root/deploy/scripts_v2/_lib/deploy-log-filename.sh; return 1 if missing.

**Page affectées:** deploy/lib/deploy-log.sh.
This commit is contained in:
Nicolas Cantu 2026-04-23 02:53:15 +02:00
parent 983cf9135e
commit f8b0e9240d

View File

@ -11,26 +11,19 @@ deploy_script_tee_log_if_requested() {
if [[ -z "$log_to_dir" ]]; then if [[ -z "$log_to_dir" ]]; then
return 0 return 0
fi fi
local _lecoffre_deploy_log_fn="${project_root}/deploy/scripts_v2/_lib/deploy-log-filename.sh"
if [[ ! -f "$_lecoffre_deploy_log_fn" ]]; then
echo "[deploy-log] missing shared helper (expected LeCoffre repo layout): ${_lecoffre_deploy_log_fn}" >&2
return 1
fi
# shellcheck source=/dev/null
source "$_lecoffre_deploy_log_fn"
mkdir -p "${project_root}/${log_to_dir}" mkdir -p "${project_root}/${log_to_dir}"
local site_slug="${SITE_CODE:-${LECOFFRE_SITE_CODE:-${DEPLOY_SITE_CODE:-}}}"
if [[ "$site_slug" == "notary" ]]; then
site_slug="lecoffreio"
fi
local ts
ts="$(date +%Y%m%d_%H%M%S)"
local log_file local log_file
if [[ -n "$deploy_env" ]]; then log_file="$(lecoffre_deploy_log_file_path_for_tee "$project_root" "$log_to_dir" "${deploy_env:-}")"
if [[ -n "$site_slug" ]]; then
log_file="${project_root}/${log_to_dir}/deploy_${deploy_env}_${site_slug}_kogus_${ts}.log"
else
log_file="${project_root}/${log_to_dir}/deploy_${deploy_env}_${ts}.log"
fi
else
log_file="${project_root}/${log_to_dir}/deploy_${ts}.log"
fi
{ {
printf '%s\n' "=== LeCoffre deploy log ===" printf '%s\n' "=== LeCoffre deploy log ==="
printf '%s\n' "environment=${deploy_env:-<unset>} site=${site_slug:-<unset>} started_at=${DEPLOY_STARTED_AT:-} project_root=${project_root}" lecoffre_deploy_log_tee_header_metadata_line "$project_root" "${deploy_env:-}"
} >"$log_file" } >"$log_file"
_IA_DEV_DEPLOY_LOG="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" _IA_DEV_DEPLOY_LOG="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
if [[ -f "${_IA_DEV_DEPLOY_LOG}/lib/smart_ide_logs.sh" ]]; then if [[ -f "${_IA_DEV_DEPLOY_LOG}/lib/smart_ide_logs.sh" ]]; then