Reputation: 159
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.
Upvotes: 0
Views: 2064
Reputation: 159
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
Upvotes: 1
Reputation: 10930
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
Upvotes: 1