Last active
October 1, 2016 19:24
-
-
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.
This file contains 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
// 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 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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