4

I'm using Sonarqube 7.9 and Gitlab with a maven docker image that calls my Sonarqube using mvn --batch-mode verify sonar:sonar -DskipTests=true -Drevision=$REVISION_UNSTABLE $SONAR_OPTS -Dsonar.analysis.mode=issues.

The thing is that the parameter sonar.analysis.mode is not used anymore since version 7.4 but I can't find out what parameter do I need to use instead.

At the build development branch I just want to check the issues related to the code and I don't want to publish anything. Only when I publish a tag or a production code I must publish results to Sonarqube interface. So what do I need to run my code with the previous issues and publish parameters? Is there any alternative to sonar.analysis.mode?

R. Karlus
  • 2,094
  • 3
  • 24
  • 48

1 Answers1

0

The direction SonarSource are pushing people in is to use branch/pull-request analysis to detect new issues across branches. I'd suggest you want to be using feature branches for your typical analysis if you're not wanting to retain history for a long time.

The branch analysis feature requires you use Developer Edition to work out-the-box, however there is a plugin that provides branch support on developer edition should you want to try it.

Your build/scan command would then become something similar to:

mvn verify sonar:sonar -DskipTests=true -Drevision=$REVISION_UNSTABLE $SONAR_OPTS -Dsonar.branch.name=develop
mc1arke
  • 1,030
  • 10
  • 22
  • Well, ok, I'm going to use feature branchs but I don't want to publish my analisys results to Sonarqube. I just want to validate code and I want Sonar to write comments on Gitlab when new issues are created. When I publish a new tag, them I want sonar to publish analisys results. How can I do that? – R. Karlus Jul 19 '19 at 12:51
  • You can't. For SonarQube to be able to gather results and publish comments, it has to run its compute engine, which automatically publishes results. Is there any reason you're not wanting to persist the results, even for a short period? – mc1arke Jul 19 '19 at 12:55
  • The reason is that when I run `-Dsonar.analysis.mode=issues` it doesn't publish anything. It just scan my project and the `sonar-maven-plugin` only comment on gitlab the project issues. In this case I don't want those issues to be published on Sonarqube. – R. Karlus Jul 19 '19 at 13:21