I’m working on getting SonarQube analysis and and decoration set up for each new pull request.
We use Bitbucket server and bamboo for CI. Our project is written in C#
So for every pull request going into our master branch we currently run a bamboo build plan. This build must pass before a pull request can be merged. So along with this we’d like the SonarQube analysis to pass before merging in.
I’ve read the documentation for this. However the documentation that describes Analysis Parameters is confusing. Where and how do I set these parameters?
This is what the documentation states:
Analysis Parameters
These parameters enable PR analysis:
|Parameter Name|Description|
sonar.pullrequest.key Unique identifier of your PR. Must correspond to the key of the PR in GitHub or TFS. example: sonar.pullrequest.key=5
sonar.pullrequest.branch The name of the branch that contains the changes to be merged.
example: sonar.pullrequest.branch = feature/my-new-feature
sonar.pullrequest.base The long-lived branch into which the PR will be merged.
Default: master, example: sonar.pullrequest.base=master
Welcome to the community forum!
To be able to help you, we would need a bit more information such as the version of SonarQube and the edition you are running (Community, Developer, Enterprise, Data Center).
And the version of Bitbucket Server as well.
I’m using the Enterprise Edition version 7.7. The version of Bitbucket is 6.4.0. And yes I’ve read that page in your documentation. My confusion is where and how I need to set those Analysis Parameters.
Below is the begin step for a github repository (but except the sonar.pullrequest.github.repository , everything should work for your BitBucket integration)
Hi, how did you get around this failing on the master branch when the PR variables are no longer available? I am a bit stuck. I create a plan branch when a PR is created and insert the required variables from bamboo in the sonar properties file which are needed for PR decoration but when any other branch runs those variables do not exist and the build fails.
I have this in a script: