Skip to content

Instantly share code, notes, and snippets.

@ysb33r
Last active October 1, 2016 19:24
Show Gist options
  • Save ysb33r/5876086 to your computer and use it in GitHub Desktop.
Save ysb33r/5876086 to your computer and use it in GitHub Desktop.
If you are working with Jenkins BuildFlow plugin you can get some useful information of the returned build() call.
// Given that you have kicked off a build according to the DSL syntax
def results = build('RUN_THIS_JOB')
// Get out the name of the job again
println results.name
// Get the build ID
println results.id
// Get the build URL
println results.buildUrl
// Get the build result - SUCCESS, UNSTABLE etc.
println results.build.result.toString()
// Get the build number
println results.build.number
// Get a list of artifacts
results.build.artifacts.each {
// Get access to an artifact as a File Object
File f = it.file
// Get just the filename
println it.fileName
}
// Get hold of the build log - specifiy the maximum number of lines
println results.build.getLog( 1234 )
@anudeeplalam
Copy link

Hi,

This is not working for me. I am getting below error. Can you please whats wrong

groovy.lang.MissingPropertyException: No such property: name for class: org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper Possible solutions: number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment