Bitbucket Pull Request

  • Bitbucket Cloud
  • Team City
  • mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey.
  • Java

We are using TeamCity as our CI tool.
Our analysis method is the above Maven Command:
Development and other branches are analyzed successfully.
What is required to run an analysis on a pull request?
Do we have to add extra parameters to the above Maven Command that reflect the Pull Request?"

Hey there.

If you’re using TeamCity, I would suggest looking into the Pull Requests feature of their SonarQube extension (which I understand also works with SonarCloud).

You can also reach out to the maintainers here: GitHub - JetBrains/TeamCity.SonarQubePlugin: A plugin for TeamCity server allowing you to configure and run SonarQube analysis from the CI.

Otherwise you will need to manually provide (sonar.pullrequest.key, sonar.pullrequest.branch and sonar.pullrequest.base) when you detect you’re running in a pull request context.

Thank you for the input.

Regarding the input parameters I already had knowledge about but I could not find the pull request key value in bitbucket.
Any hint how to locate it in bitbucket When a pull request is created.

It’s really a question of whether or not that information makes it to TeamCity – you might try printing the environment variables when TeamCity runs your build to see if you can find the pull request key of the PR that triggered TeamCity.

I have located the key.