test
This commit is contained in:
parent
89dd8aeb40
commit
dc1dce2e07
@ -133,12 +133,12 @@ steps:
|
||||
# Detects manual changes made directly on the server between pushes.
|
||||
# Generates structured JSON with sync status, drift count, and changed files.
|
||||
# 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 ──────────────────────────────────────────
|
||||
# Name: gitops_sync_check
|
||||
# Branch: master
|
||||
# Schedule: */2 * * * *
|
||||
# Schedule: */1 * * * * (every 1 minute for testing, adjust as needed)
|
||||
# ---------------------------------------------------------------------------
|
||||
gitops_sync_check:
|
||||
image: alpine/ansible:latest
|
||||
@ -170,36 +170,11 @@ steps:
|
||||
|
||||
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
|
||||
|
||||
# Capture exit code to determine if drift was detected
|
||||
set +e
|
||||
./update-gitops-status.sh
|
||||
SCRIPT_RC=$?
|
||||
set -e
|
||||
|
||||
if [ "$SCRIPT_RC" -ne 0 ]; then
|
||||
echo "==> ERROR: Status update failed"
|
||||
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
|
||||
echo "==> Cron drift check complete. JSON status updated successfully."
|
||||
echo " Pipeline always succeeds. Check gitops-status-server for sync status."
|
||||
when:
|
||||
event: cron
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user