A pipeline step to notify a status for any GitHub commit
Clone or download
raul-arabaolaza Small update of README
To clarify that you can use a password or a PAT
Latest commit 56bc4b2 Apr 30, 2018
Permalink
Failed to load latest commit information.
src Fix some typos Jan 23, 2018
Jenkinsfile Create Jenkinsfile Sep 6, 2017
LICENSE Initial commit Nov 29, 2016
README.md Small update of README Apr 30, 2018
pom.xml Add proper maven repo to pom.xml Mar 9, 2018

README.md

Pipeline GitHub Notify Step Plugin

This step allows a pipeline job to notify a status for any GitHub commit.

Intended for jobs that want to notify GitHub of any desired event with complete control over the notification content. Including context, status or target url.

The available parameters are:

  • credentialsId: The id of the github's credentials to use, must be of type UsernameAndPassword and contain the password or a personal access token. Which one of them depends on the server configuration
  • status: The status to send, one of SUCCESS, FAILURE, ERROR or PENDING
  • description: The description that will appear at the notification
  • context: The notifications context, GH uses the context to diferentiate notifications (optional, jenkins/githubnotify is used by default)
  • sha: The sha that identifies the commit to notify status
  • repo: The repo that ows the commit we want to notify
  • account: The account that owns the repository;
  • gitApiUrl: GitHub Enterprise instance API URL (optional, https://api.github.com is used by default)
  • targetUrl: The targetUrl for the notification

Inferring parameter values

It may be cumbersome to specify all parameters, so this step will try to infer some of them if and only if are not provided. The parameters that can be inferred are:

  • credentialsId Is inferred from the SCM used on the parent project
  • repo is inferred from the Git Build Data of the current build
  • sha is inferred from the Git Build Data of the current build
  • account is inferred from the Git Build Data of the current build

Please note that infer will only work if you have Git Build Data and the parent of the Build has one and only one SCM, for example you created a Multibranch Pipeline project and you are using a Jenkinsfile build mode. If you find problems when inferring please specify the required data explicitly. (You can access this data on your Jenkinsfile by using the appropriate env variables)

Example

githubNotify account: 'raul-arabaolaza', context: 'Final Test', credentialsId: 'raul-github',
    description: 'This is an example', repo: 'acceptance-test-harness', sha: '0b5936eb903d439ac0c0bf84940d73128d5e9487'
    , status: 'SUCCESS', targetUrl: 'https://my-jenkins-instance.com'

Example with data inference and default values

githubNotify description: 'This is a shorted example',  status: 'SUCCESS'