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


Von: [email protected] [mailto:[email protected]] 
Im Auftrag von Vizionz
Gesendet: Mittwoch, 10. Juni 2015 21:37
An: [email protected]
Betreff: [workflow-plugin] Exposing RunWrapper.getLog() methods for workflow 
build step (or alternate way to retrieve build-step logs)

Hi All -

I'm looking to find means of obtaining job (console) logs from build steps in a 
workflow.  Any help is greatly appreciated!

In the workflow script below, I am creating a map that contains that contains a 
build-step of 'TestJenkinsJob'.  After the job is completed, I check the 
results for a failure.  Is there way to access the job's logs?

I see that the RunWrapper does not expose any api to retrieve Run.getLogFile().

Many Thanks!
-Vizionz

// 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

      }
}



--
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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1b15af84-4ec4-415f-8c1d-7391fb4daec8%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/1b15af84-4ec4-415f-8c1d-7391fb4daec8%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/DDB06868916F0342A722619DC460E97B50CF4CF7%40exch-bln01.
For more options, visit https://groups.google.com/d/optout.

Reply via email to