Created
July 8, 2020 15:39
-
-
Save kevinkirkup/c7610bb0f7c4868ca1e58450d891c0fa to your computer and use it in GitHub Desktop.
Examples for getting information for Jenkins pipelines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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