Display baseline version name on dashboard instead of date

Hi sonarqubers,

I’m new here. First of all thank you for making sonarqube community edition available for everyone. I’m currently trying to integrate it with our build processes, so I’m using sonar-scanner (4.0.0) and a sonar-project.properties file to trigger my analyses.

Our workflow consists of development sprints, and we git tag the commits at the end of each sprint. At this point I launch a sonar analysis with sonar.projectVersion=Sprint-N.

I would like my CI to set that analysis as the baseline for further commits, so I’m using the web api for this. This seems to work, however this is reflected on the dashboard only by the date of the analysis, not the name of the version Sprint-N (see first part of the image)

Because I have been testing a lot with many of our projects (both with the api and with the webui) i have noticed that SOMETIMES the dashboard does use the name of the version instead of just the date, such as the second part of the image:

sonar%20date%20vs%20version

however, I have not identified what are the conditions that make this happen

I would like the sonar webUI to always use the name of the version instead of just using the date of the baseline. Could someone explain how to achieve this? it is a preference to be set somewhere?

I’m using Sonarqube Community Edition Version 7.9.1 (build 27448).

I hope you can shed some light on this.
thanks again.

Mr Cat

Hi Mr Cat,

Welcome to the community!

When you use the web service to set the baseline to a specific analysis, you’re… setting the baseline to a specific analysis, which may or may not have a version event. So we show the date/time of that analysis. If you want the version to show up on the project homepage, then you need to first clear out your manually-set baseline, and then set your new code period to previous_version.

Make sense?

 
Ann

Hello Ann,

thanks for your reply.

So we show the date/time of that analysis.

Ok I see, this means that I cannot achieve this through the web api. That’s unfortunate.

If you want the version to show up on the project homepage, then you need to first clear out your manually-set baseline

with api/project_analyses/unset_baseline, am I correct?

and then set your new code period to previous_version .

you mean manually through the web ui? any way I can do this for every project through the api?

Thank you again :slight_smile:

Hi,

Yup.

The easiest thing to do is unset every project and then set previous_version at the global level. You can also use your browser’s inspector to see what web service is used when you set the New Code Period at the project level and then just use that. Given the situation you’ve laid out, you shouldn’t have to do this more than once, so even if the web service is marked internal (I’m not sure) this one-time use isn’t risky.

BTW, I should mention that there are changes coming to this in 8.0, but the underlying model should be the same, so previous_version is still what you want.

 
HTH,
Ann

is there any way to set specific version instead of previous_version if so can you share that api with an example. This is much more helpful for the community

Hi @Swamy_M_S,

Welcome to the community!

This thread had been quiet for 3+ years when you resurrected it with a tangential question. Please don’t do that.

If you have a question you can’t find the answer for in the docs, please create a new thread.

 
Ann