From d4327bd152ac6c1520f9160360ed384b04c31640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Fri, 12 Jun 2026 07:58:55 +0200 Subject: [PATCH] fix(update): detect real image changes and improve webhook messages Use image ID diff instead of grepping "Pulled" (which appears even when images are already up to date). Add timestamp, stack count, and updated/total ratio to all notification messages. Co-Authored-By: Claude Sonnet 4.6 --- _update/update.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/_update/update.sh b/_update/update.sh index d5016a4..a158c03 100755 --- a/_update/update.sh +++ b/_update/update.sh @@ -18,7 +18,7 @@ notify() { : > "$LOG_FILE" log "Starting image update check" -updated=(); failed=() +updated=(); failed=(); checked=0 for stack_dir in "$STACKS_DIR"/*/; do stack=$(basename "$stack_dir") @@ -27,9 +27,13 @@ for stack_dir in "$STACKS_DIR"/*/; do log "Checking $stack" cd "$stack_dir" - pull_output=$(docker compose pull 2>&1 | tee -a "$LOG_FILE") + checked=$((checked + 1)) - if echo "$pull_output" | grep -q " Pulled"; then + before=$(docker compose images -q 2>/dev/null | sort) + docker compose pull 2>&1 | tee -a "$LOG_FILE" + after=$(docker compose images -q 2>/dev/null | sort) + + if [ "$before" != "$after" ]; then log " Updates found — recreating containers" if docker compose up -d 2>&1 | tee -a "$LOG_FILE"; then updated+=("$stack") @@ -45,12 +49,14 @@ done log "Pruning dangling images" docker image prune -f 2>&1 | tee -a "$LOG_FILE" -if [ ${#updated[@]} -eq 0 ] && [ ${#failed[@]} -eq 0 ]; then - notify "#36a64f" "✅ **Update check complete** — all images up to date" -elif [ ${#failed[@]} -gt 0 ]; then - notify "#cc0000" "❌ **Update failed**\nUpdated: ${updated[*]:-none}\nFailed: ${failed[*]}" +date_str=$(date '+%Y-%m-%d %H:%M') + +if [ ${#failed[@]} -gt 0 ]; then + notify "#cc0000" "❌ **Update failed** — $date_str\nUpdated: ${updated[*]:-none}\nFailed: ${failed[*]}" +elif [ ${#updated[@]} -gt 0 ]; then + notify "#36a64f" "✅ **Updates applied** — $date_str\nStacks updated (${#updated[@]}/$checked): ${updated[*]}" else - notify "#36a64f" "✅ **Updates applied**\nStacks: ${updated[*]}" + notify "#36a64f" "✅ **All up to date** — $date_str ($checked stacks checked)" fi log "Update check complete"