Breaking

Tuesday, June 1, 2021

Azure Pipelines–Pipeline Resource Trigger

Yesterday I started blogging about my journey moving from the ‘classic’ build approach to YAML templates. I shared how you can use a Build completion trigger to link your YAML build to a previously completed build. Although this approach works, it is no longer recommended.

A better way is to use ‘Pipeline Resource Triggers’.  This is done by defining a pipelines resource inside your YAML template. pipelines is a dedicated resource only for Azure Pipelines. Let’s have a look at the syntax:

resources:
pipelines:
- pipeline: aks-ci # Name of the pipeline resource(up to you to choose)
source: AKS-CI # Name of the pipeline (case sensitive!)
#project: aks-test # Required only if the source pipeline is in another project
trigger: true # Run app-ci pipeline when any run of AKS-CI completes

In your resource definition, pipeline is a unique value that you can use to reference the pipeline resource later on. source is the name of the pipeline that produces an artifact.

Remark: As I mentioned in the example above, the source name is case sensitive.

More information: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/pipeline-triggers?view=azure-devops

No comments:

Post a Comment