We want to ease the setup of quality analysis for BitbucketCloud users who use Bitbucket pipelines.
Currently information to set up quality is dispersed among tutorial, documentation in our doc, and in the doc associated to the step to integrate to Bitbucket pipeline and we want to make it straightforward for the user.
[_Also see why of epic parent_]
We believe that guiding Bitbucket Cloud user to integrate quality in their Bitbucket pipelines will result in decreasing the time to setup quality in Bitbucket pipelines of users and increasing the adoption of SonarCloud for Bitbucket users.
We will know this to be true when we see
- an increase in number of users that set up their BBC project with Bitbucket pipeline
- an increase in the activity of the projects bound to BBC
- number of users initiating the project with BB pipelines vs number of users initiating the project with the "manual mode"
For this first minimal step, we will provide a guided tutorial to help users set up their quality with Bitbucket pipelines.
The user should still have the possibility to manually set up their CI, although we should keep in mind that we don't want to promote manual setup.
- Bitbucket Pipelines
- Does not exist -> yml file and pipeline does not exist
- Already exists -> yml file and pipeline exist, but not the quality step
- Building tools:
- Maven => use mvn-scanner in scan pipe, quality check pipe cannot be used
- Gradle => use SonarScanner for gradle, quality check pipe cannot be used
- MSBuild => use SonarScanner for MSBuild, quality check pipe cannot be used (=> Azure pipelines?)
- Other (for JS, TS, Go, Python, PHP, ...)=> scan pipe, quality check can be used, example of yml file : https://bitbucket.org/globalbbcteam/angularexample/src/master/bitbucket-pipelines.yml
- quality check pipe supports only projects using the scan pipe (so not maven, not gradle)
- Dev workflow (to remember):
- analysing branches
- analysing PR
- default branch
- Visibility of projects
- Public projects
- Private project
Detailed use case :
- As a Bitbucket user :
- I click on analyze a new project
- I can choose to analyze with Bitbucket pipelines, that I see first
- If I don't want to analyse with Bitbucket pipelines, it means that I want to analyze with an external CI or launch manually the analysis, and I'm guided to set up manually the analysis of my project.
- As BBC user who wants to analyse a BBC repo with Bitbucket pipelines, and I don't have a bitbucket-pipelines.yml file already
- I choose to follow the tutorial to analyse with Bitbucket Pipelines
- I activate pipelines in BBC settings
- I put the SONAR_TOKEN in the settings of the account or the repo in BBC
- I create the bitbucket-pipelines.yml in my repo (preferably) directly on BBC and copy the step to launch analysis (step quality scan)
- The content of the file is different whether I'm using maven, gradle (launch the associated scanner) or not (use the pipe scan)
- I commit and push the file on BBC
- I check that the pipelines is launched on BBC
- When results are OK, I can see the results of the analysis on SC :
- Of the master if I configured the master pipeline
- Of the PR if I configured the PR pipeline
- Of the branch if I configured the branch pipeline
- As a BBC user who wants to analyse a BBC repo with Bitbucket pipeline, and I already have a bitbucket-pipelines.yml
- I update my yml file to integrate the quality check step in my pipeline
- Don't forget to update the existing documentation (SC + SC pipe) + update existing projects
Current sources of information to set up a quality in BB pipelines :
- SC documentation : https://sonarcloud.io/documentation/integrations/bitbucketcloud/bitbucket-pipelines/
- Scan pipe : https://bitbucket.org/sonarsource/sonarcloud-scan/src/master/README.md
- Quality Check pipe : https://bitbucket.org/sonarsource/sonarcloud-quality-gate/src/master/README.md
- Project examples : https://bitbucket.org/account/user/sonarsource/projects/SAMPLES
- Documentation in SC pipe : edit a bitbucket-pipeline.yml and search for the SonarCloud pipe