test
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/cron/woodpecker Pipeline was successful

This commit is contained in:
dvirlabs 2026-04-24 15:21:04 +03:00
parent 89dd8aeb40
commit dc1dce2e07

View File

@ -133,12 +133,12 @@ steps:
# Detects manual changes made directly on the server between pushes. # Detects manual changes made directly on the server between pushes.
# Generates structured JSON with sync status, drift count, and changed files. # Generates structured JSON with sync status, drift count, and changed files.
# Sends JSON to gitops-status-server for continuous GitOps monitoring. # Sends JSON to gitops-status-server for continuous GitOps monitoring.
# Pipeline marked FAILED when drift found so it is visible in the UI. # Pipeline always succeeds - check Grafana dashboard for drift status.
# #
# ─── Woodpecker Cron UI settings ────────────────────────────────────────── # ─── Woodpecker Cron UI settings ──────────────────────────────────────────
# Name: gitops_sync_check # Name: gitops_sync_check
# Branch: master # Branch: master
# Schedule: */2 * * * * # Schedule: */1 * * * * (every 1 minute for testing, adjust as needed)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
gitops_sync_check: gitops_sync_check:
image: alpine/ansible:latest image: alpine/ansible:latest
@ -170,36 +170,11 @@ steps:
echo "==> [cron] Running continuous GitOps drift check..." echo "==> [cron] Running continuous GitOps drift check..."
# Make script executable and run it # Make script executable and run it (always succeeds - just updates JSON)
chmod +x update-gitops-status.sh chmod +x update-gitops-status.sh
# Capture exit code to determine if drift was detected
set +e
./update-gitops-status.sh ./update-gitops-status.sh
SCRIPT_RC=$?
set -e
if [ "$SCRIPT_RC" -ne 0 ]; then echo "==> Cron drift check complete. JSON status updated successfully."
echo "==> ERROR: Status update failed" echo " Pipeline always succeeds. Check gitops-status-server for sync status."
exit 1
fi
# Check sync status to determine pipeline result
# Read the generated JSON or re-run drift check
echo "==> Verifying drift status for pipeline result..."
set +e
ANSIBLE_FORCE_COLOR=false \
ansible-playbook -i ansible/inventory/hosts.yml ansible/playbooks/drift-check.yml > /dev/null 2>&1
DRIFT_RC=$?
set -e
if [ "$DRIFT_RC" -eq 0 ]; then
echo "==> Pipeline SUCCESS: Server is SYNCED with Git"
exit 0
else
echo "==> Pipeline FAILED: OUT OF SYNC - manual drift detected on server"
echo " Check gitops-status-server for detailed file-level drift information"
exit 1
fi
when: when:
event: cron event: cron