How can I complete the build in Jenkins if the number of compiler warnings increases?

In TeamCity, I can add a build failure condition that completes the build if the number of compiler / inspection warnings increases from a previous successful build

https://confluence.jetbrains.com/display/TCD9/Build+Failure+Conditions#BuildFailureConditions-Failbuildonmetricchange

How do I do the same in Jenkins?

+5
source share
2 answers

The Warnings Plug-in should do exactly what you want. It will mark the assembly as unstable or unsuccessful based on the number of warnings or, possibly, new warnings about specific priorities.

Failed to create any new compiler warnings

If you set All Priorities to 0, as shown, it should do what you want. If this is not enough, the plugin also includes the options “Use delta for new alerts”, “Use previous assembly as a reference” and “Use only stable assemblies as a reference” with detailed descriptions of how each of these parameters changes behavior.

+3
source

The warning plugin is deprecated and replaced by the Warnings Next Generation plugin. Equivalent functions are referred to as quality gates.

Use the Quality Gate type "NEW" with a threshold value of 1 to complete the build if new problems have occurred since the last successful build.

If pipelines are used, this step will analyze the results and fail if a new line failure is detected.

stage('lint') { steps { // ..generate eslint report, other types are supported by the plugin... } post { always { // record lint issues found, also, fail the build if there are ANY NEW issues found recordIssues enabledForFailure: true, blameDisabled: true, tools: [esLint(pattern: 'checkstyle-results.xml')], qualityGates: [[threshold: 1, type: 'NEW']] } } } 
0
source

All Articles