Monday, April 5, 2021

Azure Devops, Azure, YAML, Conditional Tasks

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml



When we specify Condition, we actually make the execution of step conditional to the outcome of execution of previous step.

You can specify conditions under which a step, job, or stage will run.

  • Only when all previous dependencies have succeeded. This is the default if there is not a condition set in the YAML.

  • Even if a previous dependency has failed, unless the run was canceled. Use succeededOrFailed() in the YAML for this condition.

  • Even if a previous dependency has failed, even if the run was canceled. Use always() in the YAML for this condition.

  • Only when a previous dependency has failed. Use failed() in the YAML for this condition.

  • Custom conditions


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
jobs:
- job: Foo

  steps:
  - script: echo Hello!
    condition: always() # this step will always run, even if the pipeline is canceled

- job: Bar
  dependsOn: Foo
  condition: failed() # this job will only run if Foo fails

No comments:

Post a Comment

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass