issue-bot

command module
v0.0.0-...-12fdf3b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 6 Imported by: 0

README

issue-bot

Bot to manage issues for CI pipelines failures.

GoDoc Go Report Card

How it works

  1. The 'issue-bot' job is triggered (on_failure)
  2. issue-bot creates an issue with the branch name and commit SHA in the title
  3. issue-bot fills in the issue description with a link to failed pipeline, related commit, and list of links to failed jobs
  4. 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

  1. Create an access token with api scope.
  2. Add a project variable named API_TOKEN and paste your access token. Be sure it is masked.
  3. 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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL