Child pages
  • GitHub Issues Plugin
Skip to end of metadata
Go to start of metadata

Plugin Information

Plugin ID

github-issues

Changes

In Latest Release
Since Latest Release

Latest Release
Latest Release Date
Required Core
Dependencies

1.2.3 (archives)
Jul 23, 2017
1.625.3
github (version:1.22.3)
token-macro (version:2.0)
github-api (version:1.77)

Source Code
Issue Tracking
Pull Requests
Maintainer(s)

GitHub
Open Issues
Pull Requests
Daniel Lo Nigro (id: daniel15)

Usage

Installations

2016-Nov 213
2016-Dec 352
2017-Jan 474
2017-Feb 530
2017-Mar 669
2017-Apr 691
2017-May 767
2017-Jun 841
2017-Jul 845
2017-Aug 938
2017-Sep 974
2017-Oct 1036

GitHub Issues Plugin

This plugin allows you to create a GitHub issue whenever your build fails. Once the build starts passing again, the issue will automatically be closed.

Report bugs here: http://dl.vc/jenkins-github-issues-bug (you will need to first create a Jenkins account at https://accounts.jenkins.io/)

Getting Started

In Manage Jenkins → Configure System → GitHub → GitHub Servers, ensure at least one GitHub server is configured and the "Test connection" button works.

Once this has been configured, add "Create GitHub issue on failure" as a post-build action:

When your build fails, a GitHub issue will be opened.

Customization

The default template used for the issue title and body can be changed in the GitHub Issue Notifier section in the Jenkins settings:

This template can also be modified per job. The "Content Token Reference" section at the bottom of the settings pane can be used to get information about all the available tokens.

Advanced Usage

Usage with job-dsl

When using the great job-dsl plugin, you can configure a publisher step as follows:

job(String name) {
  publishers {
    gitHubIssueNotifier {
    }
  }
}

All the advanced settings are available as optional configuration properties. To see all the available properties, go to the Job DSL API viewer at JENKINS_URL/plugin/job-dsl/api-viewer/index.html and search for gitHubIssueNotifier.

Automating global configuration

You can modify the global config using a system groovy script, i.e. add a init.groovy to the JENKINS_HOME dir.

import org.jenkinsci.plugins.githubissues.GitHubIssueNotifier
def descriptor = Jenkins.instance.getDescriptorByType(GitHubIssueNotifier.DescriptorImpl)
descriptor.issueTitle = 'ISSUE TITLE TEMPLATE`
descriptor.issueBody = 'ISSUE BODY TEMPLATE`
descriptor.issueLabel = 'LABELA LABELB`
descriptor.save()

In the templates you can use all available tokens using ${TOKEN} notation. To see all available tokens, click the help button on the right of the `Content Token Reference` label in the GitHub Issues section of the global configuration UI.

To configure the global GitHub config and the credential config, see the init.groovy example in the repo.

Usage in a Jenkinsfile

Configure a publisher step in a Jenkinsfile as follows:

script {
    properties([[$class: 'GithubProjectProperty',
                projectUrlStr: '<GitHub repo URL>']])
}

...

step([$class: 'GitHubIssueNotifier',
      issueAppend: true,
      issueLabel: '',
      issueTitle: '$JOB_NAME $BUILD_DISPLAY_NAME failed'])

Changelog

1.2.4 - 4th November 2017

  • Upgrade to GitHub API 1.90 to fix JENKINS-47601

1.2.3 - 22nd July 2017

1.2.2 - 4th March 2017

1.2.1 - 26th February 2017

  • Fixed JENKINS-42329: Support for multi-config projects was broken in v1.2
  • Renamed "Customize issue template" to "Advanced settings"

1.2 - 26th November 2016

  • Added some optional new features. Thanks to Felix Simmendinger and Daniel Zabel for the pull request.
    • Appending a comment on recurring failures (disabled by default)
    • Reopening issue if build starts failing again (instead of creating a new issue)
    • Allow custom GitHub repo to be used for issues

1.1 - 12th November 2016

  • Fixed JENKINS-39662: NullPointerException for multi-config projects
  • Fixed JENKINS-39687: Configuration section didn't appear correctly
  • Implemented JENKINS-39663 - Allow issue template to be customised per-job instead of just having one server-wide template
  • Added help for merge tokens
  • Include changes since last successful build in default body content

1.0 - 5th November 2016

  • Initial release

2 Comments

  1. very useful plugin, is there a way to customise it to publish issues if builds are unstable?

    1. Not at the moment, but a pull request to implement this would be appreciated (smile)

Write a comment…