issue-bot
Bot to manage issues for CI pipelines failures.
How it works
- The 'issue-bot' job is triggered (
on_failure
)
- issue-bot creates an issue with the branch name and commit SHA in the title
- issue-bot fills in the issue description with a link to failed pipeline, related commit, and list of links to failed jobs
- issue-bot labels the issue with:
pipeline failure
pipeline failure::needs investigation
If for some reason the same pipeline is retried (meaning that a pipeline ran for the same combination of branch name and commit SHA), then issue-bot will recognize that an issue already exists and will not create a duplicate issue.
If the issue exists but is closed, then it will reopen the issue.
Using scoped labels, an issue board can be made using the pipeline failure
labels:
pipeline failure::needs investigation
pipeline failure::under investigation
pipeline failure::resolved
Examples
Example issues generated from CI can be viewed in https://gitlab.com/mnielsen/issue-bot-examples.
How to use it
- Create an access token with
api
scope.
- Add a project variable named
API_TOKEN
and paste your access token. Be sure it is masked.
- Add the following snippet to your CI configuration file:
issue-bot:
stage: report
image: registry.gitlab.com/mnielsen/issue-bot:latest
script: /issue-bot
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
when: on_failure
The next time the pipeline fails, this job will run and create an issue in the project. The logs in this job will include a link to this issue.