Jenkins MultiJob - Send Results e-mail with data from inner Jobs

若如初见. 提交于 2019-12-22 08:22:41

问题


I have a MultiJob Project with 3 inner jobs which needs to be executed in the following sequence

Master MultiJob Project (Job)
 |----- Phase 1
            |------> JOB A 
 |----- Phase 2
            |------> JOB B
 |----- Phase 2
            |------> JOB C

When Job C ends, the Master MultiJob Project (Job) will send a mail (Using the Email-ext plugin) with status about the results from all the inner Jobs (A, B and C) (As a Post Build Step)

I need to find a way to get a the results from each of these inner Jobs (as Parameter or any other way...)

I tried to do it by:

  1. Setting Enviroment Variable and then trying to read it - Failed - the Varaiable is not exisintg anymore after Job A/B/C ends
  2. Tried to do so with SETX, same results
  3. Tried to use the EnvInject Plugin and failed again

isn't there anyway to do so?

Can someone shade some light?


回答1:


Assuming your job is a Multijob, you can add a groovy post build like this:

subBuilds = manager.build.getSubBuilds()
//print the each sub build instance to the console log and its result
subBuilds.each{
    manager.listener.logger.println "${it}, ${it.getResult()}"
}


来源:https://stackoverflow.com/questions/17172927/jenkins-multijob-send-results-e-mail-with-data-from-inner-jobs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!