skip to Main Content

Trying to trigger an Azure YAML pipeline using Tag when another YAML pipeline has been completed.
There’s documentation indicating that you can add a pipeline resource with:

resources:
  pipelines:
  - pipeline: MyCIAlias
    source: Farbrikam-CI
    trigger:
      tags:        # This filter is used for triggering the pipeline run
      - Production # Tags are AND'ed
      - Signed

This is my code which I am adding in my 2nd pipeline which I want to trigger using tag automatically:

resources:
  pipelines:
  - pipeline: POCPipeline
    source: ******
    trigger:
      tags:
      - Tagtest

Can someone please help me with this if anything is wrong as it is not triggering my 2nd pipeline with Tagtest?

2

Answers


  1. I can reproduce the same issue that the Tag filters for pipeline resource does not work with below configurations. The current pipeline cannot be triggered by the pipeline resource completed on tage ‘tag01‘.

    resources:
      pipelines:
      - pipeline: resPipe1
        source: resPipe1-CI
        trigger:
          tags:
          - tag01
    

    or

    resources:
      pipelines:
      - pipeline: resPipe1
        source: resPipe1-CI
        trigger:
          tags:
          - refs/tags/tag01
    

    When I change the configuration of pipeline resource like as below, the current pipeline can be triggered by the pipeline resource.

    resources:
      pipelines:
      - pipeline: resPipe1
        source: resPipe1-CI
        trigger: true
    

    However, this configuration will let the current pipeline be triggered when the pipeline resource runs is completed on any branch or any tag.


    Looks like, there is problem on the Tag filters for pipeline resource. I recommend you try open a ticket on Developer Community to report this issue. If the support engineer who handles your ticket also can reproduce the same issue, your ticket generally will be reported to the appropriate product team for further investigation and fix.


    Login or Signup to reply.
  2. In my case, your sample works fine. The pipelines:

    enter image description here

    The trigger for the second pipeline:

    resources:
      pipelines:
      - pipeline: MyCIAlias
        source: MyNewPipelinesMySourceTriggerPipline
        trigger:
          tags:        # This filter is used for triggering the pipeline run
          - Tagtest
    

    If you add the tag to the source build during the build process, the second pipeline starts fine:

    enter image description here

    You may add the tag manually or through the logging command: AddBuildTag: Add a tag to the build

    Example for the first pipeline to add a tag through variables and logging command:

    - task: Bash@3
      inputs:
        targetType: 'inline'
        script: |
          echo "##vso[build.addbuildtag]$(tagtoadd)"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search