Must-share information (formatted with Markdown):
- which versions are you using: 8.9 Developer Edition
- what are you trying to achieve: Default branch in gitlab is ‘develop’ but sonarqube says ‘master’
Per 8.9 LTS release notes:
Q. How can I specify the default branch for each repository? We frequently have master identifed in Github but would like to treat the dev branch as the default one in SonarQube.
A. With project import, new projects show the same name for the main branch that’s used in your DevOps platform. So if it’s ‘Develop’ in GitHub, it’ll be ‘Develop’ in SonarQube.
This should mean that if in gitlab we have develop as default branch, on initial project scan via the docker sonar-scanner, it will create the project and then set develop to be the default branch. However, this is not the case. It is still utilizing the old method of setting master as default, and just adding develop as a new branch.
This is the code we are using to run scans/initialize
- sonar-scanner -Dsonar.qualitygate.wait=true -Dsonar.projectKey=${CI_PROJECT_NAMESPACE}-${CI_PROJECT_NAME} -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.login=${SONAR_TOKEN}