I'm looking to find means of obtaining job (console) logs from build steps in a workflow. Any help is greatly appreciated!
// Allocate Node//////////node("MyNode"){ // Set Directory ////////// dir("PathToDirectory") { // Map of builds for parallel execution ///////// def buildMap = [:] // Setup JOB_1 ///////// buildMap["JOB_1"] = { // Start a test job. ///////// def jobInfo = build job: 'TestJenkinsJob', propagate: false if (jobInfo.getResult() == "FAILURE") { // Access logfile of job - NOT EXPOSED in RunWrapper ////////// def failLog = jobInfo.getLogFile() println "FAIL_LOG\n$failLog" // ... Do more work with fail log (save/parse/report/etc.) } } // Setup JOB_2 ////////// buildMap["JOB_2"] = { // ... Setup Job 2 } // Start the parallel job ///////// parallel buildMap }}Hi,
I got the same problem and it can work by thinking a little bit outside the box.
You can get the jobs BUILD_NUMBER value through the getNumber() method. With that you may access the plain log via <Jenkins-server>/job/<jobname>/<buildnumber>/consoleText URL.
Regards
Eric
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/1b15af84-4ec4-415f-8c1d-7391fb4daec8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You can get the jobs BUILD_NUMBER value through the getNumber() method. With that you may access the plain log via <Jenkins-server>/job/<jobname>/<buildnumber>/consoleText URL.
Regards
Eric
I see that the RunWrapper does not expose any api to retrieve Run.getLogFile().