Improve deploy cron to log duration (and log file in case of error)
All checks were successful
Run tests / tests (push) Successful in 1m50s

This commit is contained in:
Benjamin Renard 2024-07-16 09:39:10 +02:00
parent ba0f972b34
commit 73ebd4cddb
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -319,12 +319,14 @@ if [[ $DEPLOY_CRON -eq 1 ]]; then
for container in "${to_deploy[@]}"; do
message " $container: deploying..."
log="$REBUILD_DATA_DIR/$container.log"
if $COMPOSE_BIN -f "$DOCKERCOMPOSE_FILE" up -d --no-deps "$container" > "$log" 2>&1; then
message " $container: done"
start_time=$(current_time)
if $COMPOSE_BIN -f "$DOCKERCOMPOSE_FILE" up -d --no-deps "$container" >> "$log" 2>&1; then
message " $container: done (in $(format_duration "$(( $(current_time)-start_time ))"))"
update_rebuild_status -d "$container"
rm -f "$log"
else
error " $container: fail to deploy new container image"
error " $container: fail to deploy new container image (in" \
"$(format_duration "$(( $(current_time)-start_time ))"), see log: $log)"
update_rebuild_status "$container" "error=fail to deploy new container image"
error=1
fi