We added the bitbucket pipeline as specified in the “wizard”:
image: maven:3-jdk-11
clone:
depth: full # SonarQube Cloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarQube Cloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarQube Cloud
caches:
- maven
- sonar
script:
- mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
artifacts:
- target/**
pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
branches:
master:
- step: *build-test-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud
Our “main” branch is set to develop in bitbucket - this is our default branch.
When we do PRs against develop, these are automatically analyzed by sonar via this pipeline. But this only analyses the chagnes, not the main repo.
In the main sonarcloud.io page for our project, it says:
"master" branch has not been analyzed yet.
how do we get sonar to analyze the main repo, not just the PRs , and to use develop, not master?
The docs say the main repo (develop branch in our case) is analyzed on first analysis, but this doesn’t seem to be the case.
Maybe the generated pipeline file should say “develop” instead of “master”?
Or maybe we need to delete the repo and start again?