Until recently, we created our Jenkins jobs by hand. We have a policy that the code is checked using FindBugs, Checkstyle and PMD, and any project that exceeds certain thresholds is considered unstable and is not allowed to deploy its artifact to our Maven repository.
In Jenkins, when I create a "Maven project", I get the metrics configuration under "Build Settings". If any threshold is exceeded, the build is considered unstable, and the Post-Build Action "Deploy artifacts to Maven repository" is not executed. This is how it should be.
However, in our generated jobs, which are generated using mavenJob()
, the situation is different. Here, the metrics are added to the publisherContext
, and thus if the threshold is exceeded, the build is still considered unstable, but nothing prevents the artifact to be deployed to the Maven repository.
Did I miss something? How can I add the metrics to the Build Settings as before?