Reputation: 1909
I want to mail one report from pipeline. Pipeline executing different jobs each of which have reports. I'm looking at "Snippet Generator" but can't set multiply report collection
Upvotes: 0
Views: 1313
Reputation: 914
Ok So first let assume you have job A job B and Job C (that calls job A and Job B)
In each Job A and Job B you need to archive their log file , so you will need to add this script into your pipeline:
def jenkins = Jenkins.getInstance()
def job = jenkins.getItem(jobName)
def bld = job.getBuildByNumber(buildNumber)=
//use the method that suits you
bld.getLog(100) //number of lines to read
bld.getLogFile()
bld.getLogReader()
Now that your logs are being archived in each of the jobs , you can go to Job C at the post stage and use copyArtifact plugin to copy the archived logs example:
//copyArtifacts filter: 'logs.log', fingerprintArtifacts: true, projectName: 'pathtoyourjob/job A', selector: lastSuccessful(), target: 'temp1'
//copyArtifacts filter: 'logs.log', fingerprintArtifacts: true, projectName: 'pathtoyourjob/job B', selector: lastSuccessful(), target: 'temp1'
This is the only workaround I was able to use before. Hope it helps!
Upvotes: 1