Skip to content

Instantly share code, notes, and snippets.

@kevinkirkup
Created July 8, 2020 15:39
Show Gist options
  • Select an option

  • Save kevinkirkup/c7610bb0f7c4868ca1e58450d891c0fa to your computer and use it in GitHub Desktop.

Select an option

Save kevinkirkup/c7610bb0f7c4868ca1e58450d891c0fa to your computer and use it in GitHub Desktop.
Examples for getting information for Jenkins pipelines
def jenkins = Jenkins.getInstance()
def jobName = "kato"
def job = jenkins.getItem(jobName)
def build = job.getItems()[0].getBuildByNumber(861)
def scmAction = build?.actions.find { action -> action instanceof jenkins.scm.api.SCMRevisionAction }
println "Hash: ${scmAction?.revision?.hash}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment