0

I have four YAML "release" pipelines where I use the same YAML syntax to define a continuation trigger. Here is the YAML definition for the trigger.

resources:
  pipelines:
  - pipeline: Build  # Name of the pipeline resource
    source: BuildPipeline  # Name of the pipeline as registered with Azure DevOps
    trigger: true

Not really sure about this syntax where I don't specify any branch but everything was working fine till recently. More recently I updated two of the YAML release pipelines and they now are not getting triggered when the build pipeline completes. All pipelines if executed manually work fine.

All release pipelines have the same YAML for the continuation trigger definition (see above) and have the same branch set for "Default branch for manual and scheduled builds".

I don't know how to investigate why some of the release pipelines are not triggered (any log available somewhere?) and I don't see them executed and failing, they simply are not being triggered. How do I investigate this issue?

whatever
  • 2,492
  • 6
  • 30
  • 42
  • Are the two YAML release pipelines in the same project as triggering pipeline BuildPipeline?If the triggering pipeline is in another Azure DevOps project, you must specify the project name using project: OtherProjectName. – Levi Lu-MSFT Mar 08 '21 at 06:48
  • Some project. Same branch. These pipelines all use the same exact syntax for the pipeline continuation trigger (see my initial post) and all of them have the same branch set for "Default branch for manual and scheduled builds". As said some are triggered, others are not. All of them run fine if executed manually (so no errors in the pipelines). All of them use template pipelines via the `extends` keyword and **pipelines that are not being triggered started doing so when I had to update the template pipeline they use**. – whatever Mar 08 '21 at 08:33
  • So you are saying these pipelines were not get triggered after you updated the template pipeline they use? – Levi Lu-MSFT Mar 08 '21 at 09:00
  • Yes. All pipelines using the pipeline continuation trigger worked fine initially. Some of them stopped being triggered after having updated the template pipelines invoked via the `extends` keyword. – whatever Mar 08 '21 at 09:38
  • I wonder, is it possible for a pipeline to start fine if triggered manually and fail at starting when triggered otherwise like via a pipeline completion trigger? – whatever Mar 08 '21 at 17:31
  • I cannot reproduce this issue. Could you share a snippet of your template pipelines and the main pipeline? – Levi Lu-MSFT Mar 09 '21 at 08:28

3 Answers3

0

For your question about investigating the logs - you can see what pipeline runs were created, but unfortunately you can't see what wasn't. So far as Azure DevOps is concerned, if "nothing occurred" to set off a trigger, then there's nothing to log.

As for the pipelines themselves not triggering, from the pipeline editor, check the trigger settings to ensure that nothing is set there - UI and YAML settings tend to cancel one another out:

Trigger settings

Finally, if you want to specify a branch, you can use some combination of the following options:

resources:
  pipelines:
  - pipeline: Build  # Name of the pipeline resource
    source: BuildPipeline  # Name of the pipeline as registered with Azure DevOps
    trigger:
      branches:
        include: # branch names which will trigger a build
        exclude: # branch names which will not
      tags:
        include: # tag names which will trigger a build
        exclude: # tag names which will not
      paths:
        include: # file paths which must match to trigger a build
        exclude: # file paths which will not trigger a build
WaitingForGuacamole
  • 3,744
  • 1
  • 8
  • 22
  • Ok, I don't need and don't want to specify individual branches for the pipeline resource and I asked as I wanted to be sure that the behavior I'm experiencing cannot be reconducted to the used syntax. I did not find any specific example using `trigger: true` for a pipeline resource, I saw it used for defining another resource type so I was not sure it was valid in this context. – whatever Mar 08 '21 at 08:51
  • I understand what you say about logs but here I have pipelines that should be triggered (all valid pipelines, all execute fine when triggered manually, all have the same exact pipeline completion trigger, all have the same branch set for "Default branch for manual and scheduled builds") and yet some are triggered and others are not. How are we supposed to troubleshoot a situation like this? – whatever Mar 08 '21 at 08:59
  • I don't have a specific answer for that - I just try chipping around the edges in the absence of anything clear until something reveals itself. So, from your comments, I see that you're not looking for branch triggers, check. Have you checked to ensure there are no triggers defined in the UI? – WaitingForGuacamole Mar 08 '21 at 12:56
  • I'm the only one touching these pipelines but yes, even so I did check that nothing defined from the UI was overriding anything in the yaml pipelines – whatever Mar 08 '21 at 14:09
  • Other than looking at the fully expanded pipeline (Edit -> Ellipsis Menu -> Download full YAML), sanitizing it for external consumption, I'm not sure where to go. @Levi Lu, any other suggestions? – WaitingForGuacamole Mar 08 '21 at 16:31
0

I believe I found the issue and it's the removal of the following statements from my deploy pipelines

pool:
  vmImage: windows-2019

I removed these statements because I transformed all jobs into deployment jobs as follows

- deployment: MyDeployJob
  displayName: 'bla bla bla'
  environment:
    name: ${{ parameters.AzureDevopsEnv }}
    resourceType: VirtualMachine
    resourceName: ${{ parameters.AzureDevopsVM }}

The pipelines with no pool statement run perfectly well if started manually but I'm convinced fail at being triggered if started via the pipeline completion trigger. I do not understand this behavior but I placed the pool statement back in all deploy pipelines and all are now getting triggered as the build pipeline completes.

whatever
  • 2,492
  • 6
  • 30
  • 42
0

I found that when defining the resource pipeline (trigger) in a template that you extend in the depending pipeline, there are two things that can prevent builds from being triggered:

  • There are syntax errors in the template (or the parent .yaml)
  • The depending pipeline needs to be updated before Azure Devops realizes you made edits to the template it extends

This worked for me:

template.yaml

stages:
    - stage: SomeBuildStage
      displayName: Build The Project
      jobs:
      - job: SomeJob
        displayName: Build NuGet package from Project
        pool:
          name: My Self-hosted Agent Pool # Using Pool here works fine for me, contrary to @whatever 's answer
        steps:
          - pwsh: |
              echo "This template can be extended by multiple pipelines in order to define a trigger only once."

# I still use CI triggers as well here (optional)
trigger:
  branches:
    include:
    - '*'
    
# This is where the triggering pipeline is defined
resources:
  pipelines:
    - pipeline: trigger-all-builds # This can be any string
      source: trigger-all-builds # This is the name defined in the Azure Devops GUI
      trigger: true

depending-pipeline.yaml

extends:
  template: template.yaml

# I still use CI triggers as well here (optional)
trigger:
  paths:
    include:
      - some/subfolder

triggering-pipeline.yaml

stages:
  - stage: TriggerAllBuilds
    displayName: Trigger all package builds
    jobs:
      - job: TriggerAllBuilds
        displayName: Trigger all builds
        pool:
          name: My Self-hosted Agent Pool
        steps:
          - pwsh: |
              echo "Geronimooo!"
            displayName: Geronimo

trigger: none
pr: none
veuncent
  • 1,599
  • 1
  • 20
  • 17