Implementing Gates in Azure YAML Pipelines

Viewed 6505

I have seen and used Azure Release Pipelines.

We look to use YAML based pipelines as it is easy to version control in Git. Is there any way to split pipelines in Stages and each stage have approver and manual trigger of subsequent stage.

1 Answers

In YAML it works in a different way. To use approvals and check you need to define environment first. Once you have an enviroment you can define approvals and checks.

enter image description here

Important thing is

Approvals and other checks are not defined in the yaml file. Users modifying the pipeline yaml file cannot modify the checks performed before start of a stage. Administrators of resources manage checks using the web interface of Azure Pipelines.

Then in deployment job you can selected enviroment:

jobs:
- deployment: string   # name of the deployment job, A-Z, a-z, 0-9, and underscore
  displayName: string  # friendly name to display in the UI
  pool:                # see pool schema
    name: string
    demands: string | [ string ]
  dependsOn: string 
  condition: string 
  continueOnError: boolean                # 'true' if future jobs should run even if this job fails; defaults to 'false'
  container: containerReference # container to run this job inside
  services: { string: string | container } # container resources to run as a service container
  timeoutInMinutes: nonEmptyString        # how long to run the job before automatically cancelling
  cancelTimeoutInMinutes: nonEmptyString  # how much time to give 'run always even if cancelled tasks' before killing them
  variables: { string: string } | [ variable | variableReference ]  
  environment: string  # target environment name and optionally a resource-name to record the deployment history; format: <environment-name>.<resource-name>
  strategy: [ deployment strategy ] # see deployment strategy schema

You can also check this topic on github

No plans to add approvals in YAML. However, we do plan to support configuring approvals on various resources for example, service connections, variable groups, agent pools etc.

And there is no gates (at least yet). So you can't protect with approval specific stages, but you can protect some resources (like environmets) used in jobs.

Related