Open datasmurfen opened 6 years ago
Hi @datasmurfen, which version and edition of SQ are you using? In general SonarSource is trying to move users to it's own Branch Plugin, with which sonar-stash is incompatible. It may very well be that sonar-stash will have no non-deprecated of operation.
Also, please try to resolve questions that can be solved by reading the SQ docs and trying different settings yourself. If the solution could be relevant for different users (like this issue) feel free to document it here.
I'm using sonar-stash 1.4.0
with SonarQube Server 7.2.0.13530
and Branch analysis
feature from developer edition. I do have a warning but it doesn't currently prevent this plugin to work:
WARN: The use of the issues mode (sonar.analysis.mode=issues) is deprecated. This mode will be dropped in the future.
@manuc66 so you have both the sonar-stash report on the PR and the branch analysis inside the SQ web frontend from a single sonar scanner run?
@t-8ch With TeamCity
I managed to configure it to build branches and pull requests (which are kind of hidden branches that contains the target branch source and the incoming changes). The branch build publish for SonarQube
and the pull-request build use sonar-stash
.
Wen a new branch is published or updated a build start and publish its result too the corresponding branch on SonarQube
web frontend. Once the pull request is created a new build start as well as every time a new commit is published to the pull-request or the target branch changes.
This has the "drawback" of triggering two builds if a new commit is published to a branch that is involved in a pull-request, but those two builds do not build/asse the same things.
Here is the run script:
SONAR_PR=""
if [[ $BRANCH == "pull-requests"* ]] ;
then
PR_ID=`echo $BRANCH | sed 's/pull-requests\///g'`
SONAR_PR="-Dsonar.analysis.mode=issues -Dsonar.stash.notification=true -Dsonar.stash.project=%bitbucket.project% -Dsonar.stash.repository=%MODULE_NAME% -Dsonar.stash.pullrequest.id=$PR_ID -Dsonar.stash.password=%BITBUCKET_PASSWORD%"
fi
SONAR_BRANCH=""
if [[ $BRANCH != "master" ]] ;
then
SONAR_BRANCH="-Dsonar.branch.target=master -Dsonar.branch.name=$BRANCH"
fi
./sonar-scanner -Dsonar.host.url=%sonar.host.url% -Dsonar.login=%sonar.login% $SONAR_BRANCH $SONAR_PR
@manuc66 Can you confirm that you can see the branch in the branch selection UI as seen in the screenshot? I was not aware that sonar.analysis.mode=issues
would show up there.
I will test it myself too soon.
I can confirm that I see branches:
but bear in mind that in my setup those branches are not published with the
sonar-stash
run
@manuc66 Their was the incompatibility I was referring to previously. You can either use sonar-stash or the branch plugin on a single build. The pure installations should be compatible though.
It has been finally removed in SonarQube 7.7. Some alternative should be a paid Developer Edition, but it definitely doesn't support GitLab and most likely also Stash (I haven't found any related information in their documentation. As I understood correctly without that mode it is problematic to keep this plugin functional in 7.7+.
Update. I've just found the "Important note" added in README...
That's somehow sad that they kill that feature without bringing instead (even for paid customers)...
Sonarqube 7.7 removed the end this plugin was using, so in its current form it has no chance of working there. (This is also documented in the Readme.) Otoh the new versions support bitbucket cloud and server.
[WARNING] The use of the issues mode (sonar.analysis.mode=issues) is deprecated. This mode will be dropped in the future.
Please consider to replace, or find another way to handle this in next version.