**Motivations:** - Single source for ssh helpers; export secrets base from conf; centralize lecoffre secrets under ia_dev. **Evolutions:** - deploy/lib/ssh.sh, deploy-log.sh; run-project-hooks + deploy-by-script-to export SECRETS_BASE from secrets_path; lecoffreio conf secrets_path ia_dev; deploy/lib README. **Pages affectées:** - deploy/lib/*, deploy/run-project-hooks.sh, deploy/deploy-by-script-to.sh, projects/lecoffreio/conf.json
17 lines
499 B
Bash
17 lines
499 B
Bash
#!/usr/bin/env bash
|
|
# Optional tee of deploy output to a log file under the project root.
|
|
|
|
# Args: project_root log_to_dir_relative (empty = skip)
|
|
deploy_script_tee_log_if_requested() {
|
|
local project_root="${1:?}"
|
|
local log_to_dir="${2:-}"
|
|
if [[ -z "$log_to_dir" ]]; then
|
|
return 0
|
|
fi
|
|
mkdir -p "${project_root}/${log_to_dir}"
|
|
local log_file
|
|
log_file="${project_root}/${log_to_dir}/deploy_$(date +%Y%m%d_%H%M%S).log"
|
|
info "[deploy] Teeing output to ${log_file}"
|
|
exec > >(tee "$log_file")
|
|
}
|