I want to use bitbucket pipelines and sonar to analyze my code. In my bibucket pipelines there are 2 analysis steps, the first one runs fine, I can see every results and analysis, but in the second step - which runs only on the main branch – the build in sonar quality gate doesn’t work.
If I redefine the quality gate, where I selected line coverage and code duplication it is calculated successfully. What is the problem with my setup?
This is my butbucket pipelines:
image: python:3.8 clone: depth: full # SonarCloud scanner needs the full history to assign issues properly definitions: services: docker: memory: 3000 # if you got an EOF file error, it can be caused by the caches: sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build steps: - step: &build-test-sonarcloud name: Build, test and analyze on SonarCloud caches: - docker # See https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html - sonar script: # create environment - python3 -m venv env - source env/bin/activate - apt-get update && apt-get install -y python3 default-jre - pip install pytest pytest-cov -r requirements.txt - pytest --cov=src --cov-report xml:coverage-reports/coverage-all.xml - pipe: sonarsource/sonarcloud-scan:1.2.1 variables: EXTRA_ARGS: "-Dsonar.sources=src" DEBUG: 'false' - step: &check-quality-gate-sonarcloud name: Check the Quality Gate on SonarCloud script: - pipe: sonarsource/sonarcloud-quality-gate:0.1.4 pipelines: default: - step: *build-test-sonarcloud branches: main: - step: *build-test-sonarcloud - step: *check-quality-gate-sonarcloud pull-requests: '**': - step: *build-test-sonarcloud - step: *check-quality-gate-sonarcloud