Hello @hasan ,
I’m not sure but it seems that it is complaining about an extra blank
before the -Dsonar.organization=...
.
Might you check out if it works rewriting the script that calls to sonar-scanner
in a single line?
Best,
Javier
Hello @hasan ,
I’m not sure but it seems that it is complaining about an extra blank
before the -Dsonar.organization=...
.
Might you check out if it works rewriting the script that calls to sonar-scanner
in a single line?
Best,
Javier
Hello @Javiner,
Thank you for your suggestion regarding removing extra spaces in the -Dsonar.organization=...
argument. We applied the changes and successfully resolved that part of the issue.
However, we are now facing a new problem. The pipeline still fails with the following error:
✖ Quality Gate failed: Could not get scanner report: [Errno 2] No such file or directory: '/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan/sonarcloud-scan.log'
It seems the scanner is not able to generate or locate the log file as expected.
Here’s a quick summary:
/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan/sonarcloud-scan.log
.Could you please assist us in identifying why the scanner log is not being generated or found?
@hasan None of your Bitbucket Pipelines YML snippets have showed the Quality Gate step in your pipeline. Can you please share your full pipeline configuration?
You’re probably facing a known issue where you try to use both sonar.qualitygate.wait=true
and the sonarcloud-quality-gate.
These ultimately both have the same effect (failing the build in the QG fails), so you should choose one.
## bitbucket-pipelines.yml
image: sonarsource/sonarcloud-scan:2.0.0
clone:
depth: full
definitions:
caches:
sonar: ~/.sonar/cache
steps:
- step: &generate-coverage
name: Generate Coverage Report
image: ghcr.io/cirruslabs/flutter:latest
script:
- flutter pub get
- flutter test --coverage
- step: &sonarcloud-security-scan
name: SonarCloud Security Scan
caches:
- sonar
script:
- sonar-scanner -X -Dsonar.organization="organization-id" -Dsonar.projectKey="project-key" -Dsonar.sources=lib -Dsonar.tests=test -Dsonar.host.url=https://sonarcloud.io -Dsonar.dart.lcov.reportPaths=coverage/lcov.info -Dsonar.qualitygate.wait=true
- echo "Analysis report generated at /opt/atlassian/pipelines/agent/build/.scannerwork/scanner-report"
- cat /opt/atlassian/pipelines/agent/build/.scannerwork/report-task.txt || echo "Report task file not found"
- echo "SonarCloud dashboard https://sonarcloud.io/dashboard?id=wingsfinltd_dhoni-mobile-app&pullRequest=$BITBUCKET_PR_ID"
- echo "Report processing details https://sonarcloud.io/api/ce/task?id=$(grep 'ceTaskId=' /opt/atlassian/pipelines/agent/build/.scannerwork/report-task.txt | cut -d'=' -f2)"
- step: &sonarcloud-quality-gate-check
name: SonarCloud Quality Gate Check
script:
- pipe: sonarsource/sonarcloud-quality-gate:0.1.6
variables:
SONAR_TOKEN: $SONAR_TOKEN
SONAR_EXTRA_ARGS: '-Dsonar.projectKey=project-key'
- step: &bitbucket-secret-scanner
name: Bitbucket Security Secret Scanner
script:
- Dsonar.qualitygate.wait=true
- pipe: atlassian/git-secrets-scan:2.0.0
pipelines:
branches:
master:
- step: *generate-coverage
- step: *sonarcloud-security-scan
- step: *sonarcloud-quality-gate-check
pull-requests:
'**':
- step: *generate-coverage
- step: *sonarcloud-security-scan
- step: *sonarcloud-quality-gate-check
So, confirmed!