Bitbucket 管道读取质量门结果

dav*_*e79 5 java maven sonarqube bitbucket-pipelines quality-gate

我们正在尝试将 Bitbucket Pipelines (Cloud) 与 SonarQube (6.4) 集成。

特别是,如果 SonarQube 分析在我们的Java代码中检测到一些质量门违规,我们希望管道构建失败。

目前,我们正在使用 Jenkins(多分支项目),由于waitForQualityGate()Jenkinsfile 文件(我在其中定义了要执行的管道)中包含的命令,我们设法实现了这种行为。

现在,我们想尝试一下 Bitbucket Pipelines 功能,因为我们的 Git 存储库托管在Bitbucket Cloud 中,并继续使用我们当前的 SonarQube 服务器实例。

为了完整起见,我们的项目是用 Java 编写并由 maven 管理的;我们还在构建过程中使用声纳扫描仪插件。

谁能给我一个提示?或者有没有人知道如何实现这种行为?

我知道声纳插件在 BitBucket 中创建报告作为拉取请求的评论,但这不是我们需要的。

在此先感谢您的帮助。

N1n*_*ngu 1

我认为现在可以使用 SonarSource 管道开箱即用。它归结为类似的事情

pipelines:
  default:
    - step:
        clone:
          depth: full
        script:
          - pipe: sonarsource/sonarqube-scan:1.2.0
            variables:
              SONAR_HOST_URL: ${SONAR_HOST_URL}
              SONAR_TOKEN: ${SONAR_TOKEN}
          - pipe: sonarsource/sonarqube-quality-gate:1.0.0
            variables:
              SONAR_TOKEN: ${SONAR_TOKEN}

Run Code Online (Sandbox Code Playgroud)

但最好查看管道文档https://bitbucket.org/product/features/pipelines/integrations?&search=sonar