Share the target filter, fix cd-status branch, record deploy status

- enabled_targets/names_for: one implementation of 'a host acts only on its
  own targets'; --host s5 and --host s5.fisher.hu now select the same targets
- shell_value: JSON booleans reach shell consumers as true/false
- cd-status: capture before eval, so the unconfigured-host branch is reachable
- cd-deploy writes a .status record; cd-status reads it instead of grepping
  the log's prose
- cd-render-hooks --list-urls replaces two inline JSON readers
This commit is contained in:
fisher
2026-08-23 08:50:45 +00:00
parent b48e112ed7
commit 62c62baf05
8 changed files with 119 additions and 62 deletions
+11 -1
View File
@@ -107,6 +107,7 @@ eval "$resolved"
mkdir -p "$STATE_DIR"
readonly LOG_FILE="${STATE_DIR}/${CD_NAME}.log"
readonly STATUS_FILE="${STATE_DIR}/${CD_NAME}.status"
exec > >(stdbuf -oL tee -a "$LOG_FILE") 2>&1
log "=============================================================="
@@ -129,6 +130,15 @@ notify() {
fail) icon="❌" ;;
*) icon="️" ;;
esac
# Every terminal outcome notifies, so this is also where the machine-readable
# record of that outcome belongs. cd-status reads this file rather than
# grepping the log's prose, which quietly reported "no completed deploy"
# for a healthy target whenever a log line was reworded.
printf '%s\t%s\t%s\t%s\n' \
"$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$status" "${SHA:0:12}" "$message" \
> "$STATUS_FILE"
topic="${REPO//\//-}"
curl -fsS --max-time 10 \
-H "Title: ${CD_NAME} deploy" \
@@ -299,7 +309,7 @@ fi
# ---------------------------------------------------------------- rollback ---
if [[ "$CD_ROLLBACK_ON_FAILURE" != "True" && "$CD_ROLLBACK_ON_FAILURE" != "true" ]]; then
if [[ "$CD_ROLLBACK_ON_FAILURE" != "true" ]]; then
notify fail "health check failed for ${SHA:0:12}; rollback disabled, stack left on the new image"
die "health check failed and rollback is disabled for this target"
fi