Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mark build as unstable when warning trend has arisen?

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:

Warnings trend

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.

like image 796
Wodzu Avatar asked Jul 30 '13 10:07

Wodzu


People also ask

Why does Jenkins Mark build unstable?

In Jenkins Terminology, an unstable build is defined as: A build is unstable if it was built successfully and one or more publishers report it unstable. For example if the JUnit publisher is configured and a test fails then the build will be marked unstable.


1 Answers

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.

like image 95
jwernerny Avatar answered Nov 15 '22 07:11

jwernerny