0

我对声纳云很陌生。我正在尝试将 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:

任何人都可以帮助我如何将此声纳集成到 bitbucket 中?

谢谢你。

4

1 回答 1

2

试试这个步骤脚本:

  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

于 2020-06-18T11:54:02.743 回答