Skip to content

Instantly share code, notes, and snippets.

@yuriwally
Last active August 29, 2019 03:04
Show Gist options
  • Select an option

  • Save yuriwally/6935a06716f8942d8ab2f930efca9bfd to your computer and use it in GitHub Desktop.

Select an option

Save yuriwally/6935a06716f8942d8ab2f930efca9bfd to your computer and use it in GitHub Desktop.
get git revision ( SHA ) using Jenkins API ( groovy version )
def jobName = ''
def buildNumber =''
Jenkins.instance
.getItemByFullName(jobName)
.getBuildByNumber(buildNumber)
.getAction(jenkins.scm.api.SCMRevisionAction.class)
.getRevision()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment