How to mark build as unstable when warning trend h

2019-02-22 10:21发布

问题:

So we use Jenkins in conjunction with MS Build to build our projects. We also have a warnings plugin and a large number of warnings in our projects. I am trying to fight with these warnings. One of the steps which I would like to take is to mark build as unstable when number of warnings in the last build is greater than in the previous one. Maybe I should go even further and mark such build as a failure but I guess the mechanizm will be the same for both of marks.

An example screenshot:

I could not find any info on the web how to do this. I know that some plugins for scanning log files exist, but those plugins would have to also scan logs from previous build and allow me to calculate difference in warnings.

Thanks for any help.

回答1:

The warnings plugin does have some capability to do some of this. Under the "Advanced..." settings, there are two configuration options to look at:

  • Health Thresholds - "Configure the thresholds for build health"
  • Status Thresholds - "If the number of total warnings is greater than one of these thresholds then a build is considered as unstable or failed."

If you then check the "Compute new warnings" checkbox, you will get an option to set the status thresholds based on new warnings.