Adding a GitHub repository to MoJ SonarCloud
SonarCloud
SonarCloud performs a code analysis on a repository when a pull request is created. The information can be seen within the pull request or on the SonarCloud project page for the repository.
The Ministry of Justice has a SonarCloud Organisation account which Operations Engineering has taken ownership of.
All public repositories on the Ministry of Justice GitHub Organisation and the moj-analytical-services GitHub Organisation can use the SonarCloud analysis for free.
This runbook is for the Operations-Engineering team members on how to add a GitHub repository to SonarCloud and how to start an analysis of the repository.
Prerequisites
- The repository being added must be a public repository
- You are a GitHub MoJ Org Admin
Steps to add repository to the SonarCloud GitHub Integration
- Navigate to the SonarCloud MoJ GitHub App
- Press the “Select repositories” dropdown in the Repository access section
- Select the repository you wish to add to SonarCloud
- Press “Save”
Steps to import a repository in SonarCloud and to start a newly imported repository analysis
- Open SonarCloud
- Log in with GitHub SSO if not already
- Press the “+”“ sign at the top right of the screen
- Press "Analyze new project”
- Select the repository you wish to add to SonarCloud
- Press “Set Up” on the right hand side of the screen to start the analysis
Steps to start an analysis of an already imported repository in SonarCloud
- Open SonarCloud
- Log in with GitHub SSO if not already
- Open the Ministry of Justice section
- Find the repository from the list of available repositories
- Click Administration in bottom left corner
- Go to the Automatic Analysis settings
- Click on the swipe button to enable an Automatic Analysis
- SonarCloud should interact with the repository and fill out the SonarCloud project page for the repository
Steps to set up a manual SonarCloud CI integration
- Open SonarCloud
- Log in with GitHub SSO if not already
- Open the Ministry of Justice section
- Find the repository from the list of available repositories
- Click on Configure analysis
- Pick the CI the repository will use
- Follow the steps provided by SonarCloud
- Send the env var via Slack or email to the repository user
Links
This page was last reviewed on 5 September 2024.
It needs to be reviewed again on 5 December 2024
by the page owner #operations-engineering-alerts
.
This page was set to be reviewed before 5 December 2024
by the page owner #operations-engineering-alerts.
This might mean the content is out of date.