Template for a good new topic, formatted with Markdown:
- ALM used : Bitbucket
- CI system used : Jenkins
- Scanner command used when applicable (private details masked)
mvn -B sonar:sonar -Dsonar.projectKey=gohbf-backend -Dsonar.organization=teamhbf -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONARCLOUD_APIKEY -Dsonar.branch.name=$BRANCH_NAME
- Languages of the repository : Java
- Only if the SonarCloud project is public, the URL
- And if you need help with pull request decoration, then the URL to the PR too
- Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
- Steps to reproduce
- Potential workaround
Here’s how we do things today:
- We have one Bitbucket repo named X which contains a top-level Maven module. Inside X are 6 other Maven modules, call them a…f.
- When a X code change is pushed to a branch for PR, 6 builds are kicked off, each via a Jenkinsfile (Jenkins pipeline build).
- Each of the above builds reports separately to SonarCloud, one per module.
I believe that the disconnect is that Bitbucket in a PR wants SonarCloud numbers on a per repo basis, but we’re generating 6 different numbers that do not roll up to the repository level. Ideally, if I change only module, say c, only a c build would be kicked off, and only c numbers would be reported back to Bitbucket for display on the PR.
Should we be building (always) the entire repo in a Jenkins pipeline (rather than 6), or can we cause Bitbucket to trigger one of the 6 submodule builds specific to the change? It seems that Bitbucket only wants to integrate with Jenkins at the whole repo level, not at the submodule level. Same with SonarCloud.
Ideas?