Reputation: 13396
In a multibranch Jenkins job, you can decide to show health metrics and they are obtained from the branch with the worse health. This is fine, except that it is common to have feature branches that fail and thus bring a poor general status to the project. Is it possible to restrict the health metrics to consider only the master and development branches?
Upvotes: 14
Views: 1412
Reputation: 7521
You can try to change the healthMetrics
node over a configure block:
configure { node ->
node.remove(node.get('healthMetrics'))
node / 'healthMetrics' << 'jenkins.branch.PrimaryBranchHealthMetric' {}
}
My approach was to change the health metric manually via the Web UI and compare the resulting XML of the job by appending config.xml
to my job's URL like so: https://jenkins.example.com/job/my-folder/job/my-multibranch-pipeline-job/config.xml
.
This Jenkins Job DSL Playground lets you easily try out the configure block.
Upvotes: 3