我正在尝试在执行 sonarcloud-scan 后运行 sonarcloud-quality-gate check。我这样做是因为如果质量门检查失败,我希望 bitbucket 构建管道应该失败。
这样做我得到一些像这样的错误质量门失败:无法获得扫描仪报告:[Errno 2]没有这样的文件或目录:'/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes /sonarsource/sonarcloud-scan/sonarcloud-scan.log'
这就是我的 bitbucket.yml 的外观。
image: node:10.15.3
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: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- node
- sonar
script:
- npm install --quiet
- npm run test:coverage
- pipe: sonarsource/sonarcloud-scan:0.1.5
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
EXTRA_ARGS: '-Dsonar.sources=src -Dsonar.tests=src -Dsonar.test.inclusions="**.test.jsx" -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info'
- pipe: sonarsource/sonarcloud-quality-gate:0.1.1
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
pipelines:
default:
- step: *build-test-sonarcloud
虽然 solarcloud-scan 管道运行成功。