I have a Jenkins Maven project that runs a SonarQube analysis for my build. I would like to add quality gate, so that my build fails when quality gate fails. I also would like to do it without Jenkinsfile (so just using Jenkins project configurations). Currently, I use build section to perform SonarQube analysis. The 'Goals and options' field has this code:
clean package -Dmaven.test.skip=true sonar:sonar -Dsonar.projectKey=someName -Dsonar.sources=src/main/java
Here is where I would like quality gate to be defined and implemented:
I tried to add Quality Gate to 'Post Build' section but no available options worked for me (I was thinking to try to make 'SonarQube Analysis with Maven' option to work, but it is deprecated now). I also found 'Quality Gate' plugin available to Jenkins but it has a vulnerability that I do not want to have (but wonder if there are any alternatives to said plugin).
I am thinking that 'Execute SonarQube Scanner' option in 'Pre-Steps' section may do it but I cannot find the right line/lines that I need to add to sonar-project.properties file (is there a line like sonar.qualityGateFailBuild = true
option?)
This question here mentioned that Maven version is an issue. Wonder if it is possible to work around it? (My maven version is 3.8.0 and I cannot change it)
Update
Found an 'Post step' section that allows for sonar.property file to be configured. Currently, it looks as below, but Quality Gate still does not fail my build. What other arguments do I need to add?: