我对sonarcloud非常陌生。我正在尝试将sonarcloud实施到bitbucket管道中。
我按照sonarcloud的教程分析新项目,然后运行以下代码。
sonar-scanner.bat -D"sonar.projectKey=mywebsite" -D"sonar.organization=xxxxxxxx-bitbucket" -D"sonar.sources=." -D"sonar.host.url=https://sonarcloud.io" -D"sonar.login=xxxxxxxxxxxxxxxxx"
运行此命令时,它在代码中显示错误并在末尾显示一些消息。
INFO: ANALYSIS SUCCESSFUL, you can browse https://sonarcloud.io/dashboard?id=mywebsite
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=XXXXXXXXXXXXXXXXX
但是当我查看给定的链接时,它显示为空。
我的bitbucket-pipeline.yml文件中有以下几行
image: atlassian/default-image:2
definitions:
caches:
sonar: ~/.sonar/cache
steps:
- step: &sonarcloud
name: Analyze on SonarCloud
caches:
- sonar
- composer
script:
- apt-get update
- composer update --no-interaction --no-suggest --no-progress
- vendor/bin/phpunit --coverage-clover=coverage-report.clover --log-junit=test-report.xml
- sonar-scanner
- pipe: sonarsource/sonarcloud-scan:0.1.5
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
pipelines:
任何人都可以帮助我如何将声纳集成到位桶中吗?
谢谢。
答案 0 :(得分:1)
尝试此步骤脚本:
services:
docker:
memory: 2560
steps:
- step: &sonarcloud
name: Analyze on SonarCloud
caches:
- docker
script:
- pipe: sonarsource/sonarcloud-scan:1.0.1
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
services:
- docker
更多信息:https://gist.github.com/GetoXs/e2b323b048aad88c12a10aceba3cc6cd