0

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 Multi-Job Project (Job) will send a mail which contains the status of the master job

But the Mail content would like to be as below:

Job A: Build number #1 SUCCESS Console output: <console link>
Job B: Build number #1 FAILED     Console output: <console link>
Job C: Build number #1 SUCCESS Console output: <console link>

in Post build Action i have selected the Editable Email notification

Pavan
  • 29
  • 7

1 Answers1

0

There is 2 way to do this

  1. Checking the build status manually

Save the status of the downstream jobs in a var and then pass this var to your template in Editable Email Notification

In job master

statusJob_A = `curl https://jenkins/view/jobA/lastBuild/api/json | grep "\"result\":\"SUCCESS\"" && echo "FAILED"`

statusJob_B = `curl https://jenkins/view/jobB/lastBuild/api/json | grep "\"result\":\"SUCCESS\"" && echo "FAILED"`

Then use statusJob_A and statusJob_B in your editable email as env.statusJob_A and env.statusJob_B

  1. Using 'Trigger/Call build ib other projects' in Build step

When using this step with the option 'Block until triggered projects finish their build' some env vars are created and you can use them in your email

enter image description here

Joao Vitorino
  • 2,976
  • 3
  • 26
  • 55