Add retries_count to job events webhook payload
What does this MR do and why?
Describe in detail what your merge request does and why.
Currently, the job event webhook contains no indication if a job is running for the first time or is being retried for the nth time.
This MR adds retries_count
to the job events payload.
When retries_count
> 0, it means that this build is a retry. If
retries_count
is 2, this build is the 2nd retry of a job.
build.retries_count
generates the following SQL query: https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/12918/commands/45384.
This change is behind a feature flag called job_webhook_retries_count
.
Issue: #382045 (closed)
This change will help achieve gitlab-com/gl-infra/delivery#2466 (closed).
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Enable the
job_webhook_retries_count
feature flag by running the following in a Rails console:Feature.enable(:job_webhook_retries_count)
. - Allow webhook and service requests to local network.
- In your browser open https://test1.requestcatcher.com/.
- In a project, open the webhooks page (project settings > webhooks), and enter the following URL
https://test1.requestcatcher.com/
. - Enter a random string as secret token.
- Check job events, and uncheck everything else. You can keep SSL verification enabled.
- Now start a CI pipeline in the same project.
- Check the page opened to
https://test1.requestcatcher.com/
and see if the payload containsretries_count
.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.