Is version number supported by the autoscan?


(Petter) #1

We update the version number with yarn version. So the current version number will be in package.json aswell as the latest github tag.

The version number in sonarcloud is not updated when the master branch is updated. So is it supported and if it is, how to make it work?

Thanks in advance.

(Chris Adams) #2

I had the same question: we’re using Git tags for versioning so reading those or the matching Github releases would be a nice improvement over “version not provided”, or really even just using the commit ID.

(Chris Adams) #3

I just solved this for my project by providing the version number on the command-line in our CI configuration:

$ sonar-scanner -Dsonar.projectVersion="$(pipenv run python --version)"

I don’t know if there’s a yarn / npm shortcut but at the very least you should be able to do something like this:

$ sonar-scanner -Dsonar.projectVersion="$(jq -r '.version' package.json)"

(Petter) #4

@acdha, I’m asking about if is possible to do with the autoscan. It is not the same.

(Fabrice Bellingard) #5

Hi Petter,

thanks for raising the question! Setting the version is currently not supported with AutoScan. If you don’t mind, I’d like to dig into what you would expect.

From what you say, the version of your code is currently in your package.json file. Let’s say it’s version “1.2.3”. What you also say is that this version also exists as a tag on Git, which definitely makes sense given the way versions are usually managed in the JS world.

  • Ideally, what would you expect to see instead of “version not provided”? I guess “1.2.3”?
  • Would you expect AutoScan to automatically guess this? (from the latest Git tag in the master branch for instance, or from the package.json file) Or would you want to have a way to set it manually? (to control the value)

(Petter) #6
  • Yes, 1.2.3 would be expected.
  • maybe a priority
  1. latest git tag
  2. package.json

For setting it manually, that can be done under acitivity -> edit this event.

On a sidenote, would it be possible to add 24h timestamps?

  • Petter

(Fabrice Bellingard) #7

Thanks for your answer.

What do you mean?

(Petter) #8

An option for changing from 8:44 PM -> 20:44

(Fabrice Bellingard) #9

Unfortunately not :frowning: