【问题标题】:How to include sonarqube scan step in Google Cloud Build steps如何在 Google Cloud Build 步骤中包含 sonarqube 扫描步骤
【发布时间】:2019-05-23 20:17:23
【问题描述】:

我有一个在 Azure 上运行的 sonarqube 服务器和一个使用 Google 云构建在 GCP 之上配置的 CICD 管道。您是否知道如何在我的 cloudbuild 文件中包含 sonarqube 连接信息作为自定义构建步骤?我正在使用 gradle 构建我的构建并测试我的图像。

【问题讨论】:

    标签: sonarqube sonarqube-scan google-cloud-build


    【解决方案1】:

    【讨论】:

    • 完美!感谢您的回复。
    • 但是,如果该步骤未通过质量门,我该如何使该步骤失败?
    【解决方案2】:

    以下示例代码对我有用

    #static code analysis by sonarqube
    - name: 'maven:3.6.1-jdk-8'
      entrypoint: 'bash'
      args:
        - -c
        - |
          unset MAVEN_CONFIG \
          && echo "104.199.71.165 sonarqube.ct.blue.cdtapps.com" > /etc/hosts \
          && mvn sonar:sonar -q -Dsonar.login=5531b1a2d571c0482a3d45f605830e08ccf5f245 \
          '-Dsonar.projectKey=odp.df.pubsub-sftp' \
          '-Dsonar.projectName=ODP-DF-PUBSUB-SFTP' \
          '-Dsonar.host.url=https://sonarqube.ct.blue.cdtapps.com' \
          '-Dsonar.qualitygate.wait=true' \
          'allow_failure: true'
      dir: 'dataflows/generic/pubsub-sftp/src'
      id: 'sonarqube-analysis'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-23
      • 2023-03-07
      • 1970-01-01
      • 2019-12-21
      • 2022-01-22
      • 2021-11-20
      • 1970-01-01
      • 2020-02-02
      相关资源
      最近更新 更多