Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Make the manual webhook setup documentation much clearer — actually mention the webhook URL!

Wiki Markup

Github Plugin


This plugin integrates Jenkins with Github projects.

The plugin currently has three major functionalities:

  • Create hyperlinks between your Jenkins projects and GitHub
  • Trigger a job when you push to the repository by groking HTTP POSTs from post-receive hook and optionally auto-managing the hook setup.
  • Report build status result back to github as Commit Status (documented on SO)
  • Base features for other plugins

Table of Contents

Hyperlinks between changes


In this mode, you'll be responsible for registering the hook URLs to GitHub. Click the (question) icon to (under Manage Jenkins > Configure System > GitHub) to see the URL in Jenkins that receives the post-commit POSTs . Just go to — but in general the URL is of the form $JENKINS_BASE_URL/github-webhook/ — for example:

Once you have the URL, and have added it as a webhook to the relevant GitHub repositories, continue to Step 3.

Automatic Mode (Jenkins manages hooks for jobs by itself)


This code will set commit status for custom repo with configured context and message (you can also define same way backref)

Code Block

void setBuildStatus(String message, String state) {
      $class: "GitHubCommitStatusSetter",
      reposSource: [$class: "ManuallyEnteredRepositorySource", url: ""],
      contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"],
      errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
      statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]

setBuildStatus("Build complete", "SUCCESS");

More complex examle (can be used with multiply scm sources in pipeline)

Code Block

def getRepoURL() {
  sh "git config --get remote.origin.url > .git/remote-url"
  return readFile(".git/remote-url").trim()

def getCommitSha() {
  sh "git rev-parse HEAD > .git/current-commit"
  return readFile(".git/current-commit").trim()

def updateGithubCommitStatus(build) {
  // workaround
  repoUrl = getRepoURL()
  commitSha = getCommitSha()

    $class: 'GitHubCommitStatusSetter',
    reposSource: [$class: "ManuallyEnteredRepositorySource", url: repoUrl],
    commitShaSource: [$class: "ManuallyEnteredShaSource", sha: commitSha],
    errorHandlers: [[$class: 'ShallowAnyErrorHandler']],
    statusResultSource: [
      $class: 'ConditionalStatusResultSource',
      results: [
        [$class: 'BetterThanOrEqualBuildResult', result: 'SUCCESS', state: 'SUCCESS', message: build.description],
        [$class: 'BetterThanOrEqualBuildResult', result: 'FAILURE', state: 'FAILURE', message: build.description],
        [$class: 'AnyBuildResult', state: 'FAILURE', message: 'Loophole']


GitHub Releases

Open Issues

JIRA Issues