简体   繁体   English

等待Azure DevOps上的声纳Qube质量门

[英]Wait for sonar qube quality gate on Azure DevOps

I'm creating a pipeline as code using a YAML file on Azure DevOps , but i have a 'little' stoper; 我正在使用Azure DevOps上的YAML文件以代码形式创建管道,但是我有一个“小”阻止者; i don't know how to break the build when quality gates fail, on jenkins that option is as easy as this: 我不知道当质量门失败时如何破坏构建,在詹金斯上,这种选择是如此简单:

stage("Quality Gate") {
        steps {
          timeout(time: 1, unit: 'HOURS') {
            waitForQualityGate abortPipeline: true
          }
     }
 }

But, how to do the same but on Azure DevOps using YAML? 但是,如何在使用YAML的Azure DevOps上执行相同的操作?

Thank you so much. 非常感谢。

You can try the UI way of creating build pipeline to learn more Yaml commands 您可以尝试创建构建管道的UI方法,以了解更多Yaml命令

For an instance, 例如

From the below UI, control options helps you to define the condition to success or fail the build 在下面的用户界面中,控制选项可帮助您定义成功或失败构建条件


Condition : Only when all previous taks have succeeded 条件:仅当所有先前的任务成功完成时

在此处输入图片说明

The corresponding yaml for this would be 相应的yaml是

steps:
- task: DotNetCoreCLI@2
  displayName: 'dotnet build'

Condition : Even if a previous task has failed. 条件:即使先前的任务失败了。 unless the build was canceled 除非构建被取消

steps:
- task: DotNetCoreCLI@2
  displayName: 'dotnet build'

  condition: succeededOrFailed()

Condition : Even if a previous task has failed. 条件:即使先前的任务失败了。 even if the build was canceled 即使构建被取消

steps:
- task: DotNetCoreCLI@2
  displayName: 'dotnet build'

  condition: always()

Like this you can find all the yaml commands (or) Syntax using the UI way of building pipeline 像这样,您可以使用构建管道的UI方法找到所有yaml命令(或语法)

You can able to convert the UI -> Yaml by using below way 您可以使用以下方式转换UI-> Yaml

在此处输入图片说明

Hello developers and devops 您好开发人员和开发人员

I have created a little BashScript to break the builds when sonar quality gates fail, this work with any language and any build tool and any CI server https://github.com/carlosdeveloper10/wait-for-sonar-qg 我创建了一个小BashScript,以在声纳质量门失败时中断构建,可以使用任何语言和构建工具以及任何CI服务器https://github.com/carlosdeveloper10/wait-for-sonar-qg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM