Repository navigation
feat: notifications to webhooks, Ascender and AWX - #12
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A new
notificationsitem tells another system what happened to an application. Every send goes out from this instance; nothing has to reach in.Events (one per run, so one change never arrives twice):
drift_detected(withrevertedwhen auto_sync put it back),out_of_sync,sync_succeeded(withcause: commit or rollback),sync_failed,back_in_sync. Drift and commits are told apart by the commit the application was last in sync at. State-like events fire on entering the state, not on every check.Types, each with its own block (a block of another type fails the configuration):
webhook: any receiver;authbearer, basic, none or{header: Name}; fixed headers; abodytemplate with{{field}}placeholders checked at load; optional HMAC-SHA256 signing.ascenderandawx: a job template or workflow job template, through its own webhook receiver (GitLab mode: the template's key, no user) or its launch API (a user's token,extra_vars, and a send that fails when the controller ignored them for lack of "Prompt on launch"). Checked against the receiver code of ctrliq/ascender and ansible/awx.Message: event, application, status before and after, cause, commit, applied count, changes (kind, key, operation, names of changed fields, never values), first errors, time, UI link.
Sending: a bounded queue and a worker (8 at a time) so a run never waits; retries with backoff on no answer, 429 and 5xx, not on 4xx; redirects never followed; errors never carry the URL.
GET /api/v1/notificationslists each with its last send,POST /api/v1/notifications/{id}/testsends a test now. Metricsunified_gitops_notifications_totaland_duration_seconds. Notifications reload like applications and appear in the config API's summary and reload report.Docs:
docs/notifications.md, plus configuration, API, observability, README and CHANGELOG. 24 new tests (event detection, message, templates, each type's request, launch answers, retries, loader, end to end through the router, the real HTTP client against a local receiver).