I’m new to SonarCloud and I just wanted to make sure this config is correct for the bitbucket-pipelines.yml file… The Repo houses Terraform, Python, and Go.
Thank you for the help in advanced.
image: atlassian/default-image:2 #quickest imag
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &sonar
name: Sonar scan
caches:
- docker
- sonar
script:
- pipe: sonarsource/sonarcloud-scan:1.2.0
variables:
EXTRA_ARGS: -Dsonar.organization=testorig -Dsonar.projectKey=testorig_devops -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io
SONAR_SCANNER_OPTS: -Xmx512m
DEBUG: "true"
services:
- docker
pipelines:
branches:
'{master}':
- step: *sonar
pull-requests:
"**":
- step: *sonar
The DEBUG option makes the logs very verbose, I would advise to use it only for investigation, to analyze precisely the scanner behavior if it does not produce the expected results.
You can maybe take inspiration from this sample project. It’s for NodeJS (unfortunately we don’t have any sample for Go and Python yet), but removing the NodeJS specific stuff or changing it by your project build steps may help you.
Do you have some particular reason to use the syntax '{master}' in the branches definition? I would have used master or 'master', without brackets, as suggested in the Bitbucket pipeline branches configuration documentation.