Change version of the code

Must-share information (formatted with Markdown):

  • SonarQube Version 7.6 (build 21501)
  • Try to show actual information in the Sonar app about code version
  • what have you tried so far to achieve this:

We are using Gitlab CI/CD to deploy and to check via SonarQube. Our flow:
dev branch -> merge into release with preview mode ON -> accumulate new code in release branch -> create tag when finished -> merge into master without preview.
So far it was okay, Sonar recognized somehow current version (from tag) and showed it in the app


But then it becomes weird and it went back from 1.6.0 to 1.5.0, same time showing “new code from 1.6”

I tried to pass along -Dsonar.projectVersion or -Dsonar.scm.revision during our Gradle tasks, but nothing changes. How can I manually (via Gradle task) set this version to the one I desire?

Hi,

Welcome to the community!

This is all and only about what you’re passing in as the sonar.projectVersion value. I have no experience with GitLab, so I can only guess but I think it must still have the old version number stored somewhere & it passing that in. The values you set on the analysis command line should override those set elsewhere.

The best thing I can recommend at this stage is to add sonar.scanner.dumpToFile=[file name] (details here) to see the net property values the scanner is ending up with, and you can work backward from there.

 
HTH,
Ann

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.