Base on this article Triggering an Azure Devops pipeline from another pipeline, I’m attempting to configure the dependent pipeline to run only when the source pipeline is triggered by a tag push. Below are the configurations for both pipelines:
source pipeline
trigger:
branches:
include: # branch names which will trigger a build
- main
tags:
include:
- '*'
pr: none
steps:
# required to cause pipeline triggering downstream
- task: CopyFiles@2
inputs:
contents: $(System.DefaultWorkingDirectory)/**/*.yml
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: dummy-$(Build.BuildId)
depends pipeline
trigger: none
pr: none
resources:
pipelines:
- pipeline: source
# project: Pipelining
source: source
trigger:
branches:
include:
- main
tags:
- '*'
steps:
- checkout: none
- script: echo 'triggered depends'
The result is the depends pipeline not triggered.
I attempted to adjust the tag trigger configuration for the dependent pipeline, aiming to specify a particular tag instead of using a wildcard character ‘*’ as per the documentation on Azure Pipelines YAML schema https://learn.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=schema#define-a-pipelines-resource.
However, I’m uncertain whether Azure Pipelines supports triggering a pipeline solely based on tags after another pipeline is triggered, or if tags are primarily used for filtering trigger events.
2
Answers
If I’m not mistaken, wildcards such as
*
can be used to filter branches but not tags.So, instead of:
Try:
Please note that if you include more than one tag, the build will be triggered only when ALL the tags are added to the source pipeline.
As far as I understand, the requirement was to trigger source pipeline with the commits in the tags of your repo and upon the completion of the source pipeline, the depends pipeline should be triggered.
Based on your YAML definitions, I could reproduce the issue. This was because the
tags
under thetrigger
property of a pipeline resource was designed to filter source pipeline builds with specific build tags rather than the tagged code in our repo.source pipeline
depends pipeline