Allow delivery-metrics to receive webhook events from deployment pipeline projects
What does this MR do and why?
Describe in detail what your merge request does and why.
- Add a handler for the job webhook API.
- Currently, 2 webhook routes are added, both for job event webhooks from 2 projects. Separate routes per project allow us to know exactly which token to expect without parsing the body.
- Route
/webhooks/job/ops/gitlab-org/release/tools
for receiving job event webhooks from https://ops.gitlab.net/gitlab-org/release/tools/. - Route
webhooks/job/ops/gitlab-com/gl-infra/deployer
for receiving job event webhooks from https://ops.gitlab.net/gitlab-com/gl-infra/deployer.
- Route
- Webhook API calls contain a token in a request header. The token is checked against an environment variable. Each project uses a different token.
- Parse the webhook event in JSON format received from a webhook API call, using the
github.com/xanzy/go-gitlab
library.
This MR will make it easier to use job event webhooks to update deployment pipeline related metrics like "number of manual job retries". In a follow-up, we will start adding metrics to be updated using the data received by the webhook handlers.
gitlab-com/gl-infra/delivery#2708 (closed)
Author Check-list
-
Has documentation been updated?
Edited by Alessio Caiazza (OOO until 2024-08-26)