I'm creating a pipeline as code using a YAML file on Azure DevOps , but i have a 'little' stoper; 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?
Thank you so much.
You can try the UI way of creating build pipeline to learn more Yaml commands
For an instance,
From the below UI, control options helps you to define the condition to success or fail the build
The corresponding yaml for this would be
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
condition: succeededOrFailed()
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
You can able to convert the UI -> Yaml by using below way
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.