svn plugin v.1.2 is not collecting measures in sonarqube 5.2

106 views
Skip to first unread message

Victor Breygin

unread,
Dec 4, 2015, 9:38:47 AM12/4/15
to SonarQube
Hello,  I am developing a customized quality gate plugin. One of the measures we want to include in our decision tree is number of SVN revisions of the file.
in my property file I have the following settings:

sonar.scm.provider=svn
# the following authentication may or may not be required, just keep it for testing purposes only
sonar.svn.username=user
sonar.svn.password.secured=password

SQ 5.1.2. Everything works fine.  SCM sensor runs and the data is populated in the database. I successfully integrated revision_by_line measure,  the data collected in PROJECT_MEASURES.TEXT_VALUE (e.g. something like this

1=703;2=703;3=703;4=703;5=2229;6=703;7=703;8=1036;9=703;10=703  .... )  is parsed to give me the desired number of revisions:

 svn_revisions =resource.measure('revisions_by_line')

revisions= svn_revisions ? svn_revisions.data_as_line_distribution() : {}

if !revisions.empty?

    number_of_revisions= ((revisions.values).uniq).size

end


SQ 5.2: SCM sensor seems to run fine on a client machine against the same code base, but no data to be found in database. SCM server URL and authentication info is set properly on the server.  Am I missing something else? Does anybody have a success with sonarqube-5.2 and sonar-scm-svn-plugin-1.2.jar??


any help will be greatly appreciated.


thanks

victor


Julien HENRY

unread,
Dec 7, 2015, 3:21:18 AM12/7/15
to SonarQube
Hi Victor,

We have deeply changed storage strategy in 5.2. SCM data are still there but no more stored as measures. Those metrics were deprecated in 5.0 so I admit it is a bit short to have dropped support for them according to our deprecation strategy. But we had to take some decisions to manage to release 5.2.

Depending on your use case you may get the info you need using api/sources/scm WS.

++

Julien

Victor Breygin

unread,
Dec 7, 2015, 3:28:49 PM12/7/15
to SonarQube
Thank you for quick reply, Julien. Your help is very much appreciated.
may I ask you where do you store that data? If you tell me which table it is in, I would be able to fetch it.
I didn't think about WS, I will have to look into this. But in the mean time, if you point me to where the data is, it will be perfect.
thanks again,
regards,
victor

Julien HENRY

unread,
Dec 8, 2015, 4:17:36 AM12/8/15
to SonarQube
Hi Victor,

In 5.2 per line details (including SCM) are stored in file_sources table. But this is a binary storage (using protobuf) since it is also indexed in Elastic Search. All that to say you should better invest on WS.

++

Julien

Victor Breygin

unread,
Dec 8, 2015, 10:17:33 AM12/8/15
to SonarQube
Ok, then.
Thanks Julien!

is this an API that I should be looking into: GET api/sources/lines   ?
Could you recommend an example that showcases usage of WS from custom widget written in Ruby?

thanks again, it was really helpful, much appreciated!
victor
Reply all
Reply to author
Forward
0 new messages