Useful for building notifications based on build results
This is related to #50 but I'd suggest expanding the scope to also include: NeedsApproval hooks. For a large project with many contributors, it's hard to keep up with what's happening. In addition to knowing about success/failure, it would be nice to be know when someone needs to review and approve a cirrus-ci run.
@cevich there will be 4 types of webhook events pretty soon:
CREATED -> NEEDS_APPROVAL).EXECUTING -> FAILED).馃檶
Oh yay! Def :clap: :clap:
Here is a finalized proposal of webhooks which is almost ready to hit the production:
There will be a per-organization setting to configure a URL where the webhook events will be POSTed. Each delivery will have:
X-Cirrus-Event header with value build or task for updates to builds or tasks respectively.action and dataaction will be either created or updated.data will contain data about repository, build and task (if any) for the corresponding event.data will be created by running the following GraphQL query:
repository(id: $repositoryId) {
id
owner
name
isPrivate
}
build(id: $buildId) {
id
name
branch
changeIdInRepo
status
changeTimestamp
}
task(id: $taskId) {
id
name
status
creationTimestamp
finalStatusTimestamp
}
which will result in a payload like this:
{
"action": "created",
"data": {
"repository": { ... },
"build": { ... },
"task": { ... },
}
}
In future we can consider to add a feature to customize the query. Please take a look if something is missing for your usecase and let me know before this change is deployed in the next few days.
How are delivery failures going to be handled: Will they be retried, i.e. should the receiving service be idempotent? Which criteria determines a successful delivery, e.g. HTTP 200 response?
In terms of security, will the deliveries be signed, or should the endpoint URL remain secret?
There will be a single retry for 500's and 200 will be treated as a success.
Eventually it will mock how GitHub's webhooks are working and there will be X-Cirrus-Signature generated for the payload. At the moment it's not implemented but will be added right after the initial release.
What are the different statuses we will receive ?
Might be useful to have the github username/author. Though I s'pose that could be gleaned by other means. Otherwise LGTM.
Notification are available now to configure on your organization's settings page: https://cirrus-ci.com/settings/github/
Please give it a try. Will close the issue once documentation is added.
Documented in 13828d0cf7ed30da69a042a8ae250d9bd4800d68
Most helpful comment
Here is a finalized proposal of webhooks which is almost ready to hit the production:
There will be a per-organization setting to configure a URL where the webhook events will be POSTed. Each delivery will have:
X-Cirrus-Eventheader with valuebuildortaskfor updates to builds or tasks respectively.actionanddataactionwill be eithercreatedorupdated.datawill contain data about repository, build and task (if any) for the corresponding event.datawill be created by running the following GraphQL query:which will result in a payload like this:
In future we can consider to add a feature to customize the query. Please take a look if something is missing for your usecase and let me know before this change is deployed in the next few days.