cathive / concourse-sonarqube-resource

performs SonarQube analyses and checks quality gates https://concourse-ci.org/ https://sonarqube.org/
Apache License 2.0
46 stars 50 forks source link

sonar.branch.name is incompatible with pull-request analysis #62

Closed sooncj closed 3 years ago

sooncj commented 4 years ago

This change enables correctly performing pull request analysis where the base branch is not the repository's default branch. sonar.pullrequest.base is configured based on pull request resource metadata instead of sonar.branch.name.

Previously, sonar.branch.name was used to set sonar.pullrequest.base and both parameters were passed to sonar-scanner. However, sonar.branch.name is incompatible with pull-request analysis resulting in scan failure. Not supplying sonar.pullrequest.base results in using the repository's default branch, which causes warnings and potentially incorrect diffs to be displayed in SonarQube when the base branch is not the repository's default branch.

xsorifc28 commented 4 years ago

This might also fix the problem I mentioned here:

https://github.com/cathive/concourse-sonarqube-resource/issues/61#issuecomment-636877065

🤞