To get the console output of job B.
I haven't found a better approach than displaying the job log file with cat
. You'll have to make the "job B trigger" step as a block
. So that job A won't finish until job B does. Then after the "job B trigger" step, add a step to execute a shell script.
cat "$JENKINS_HOME/jobs/<PATH_TO_YOUR_JOB>/builds/$TRIGGERED_BUILD_NUMBER_<FOLDER_AND_JOB_NAME>/log"
Note that $TRIGGERED_BUILD_NUMBER_<FOLDER_AND_JOB_NAME>
is an environment variable injected by Jenkins dynamically.
To decide whether job A fails or not based on job B.
You don't have to parse the downstream job's console output. In the upstream job's configuration, when triggering job B, you have the options to choose from. Like:
- Fail this build step if the triggered build is worse or equal to
- Mark this build as failure if the triggered build is worse or equal to
- Mark this build as unstable if the triggered build is worse or equal to