azure-devopsazure-pipelines-yamlazure-devops-serverazure-devops-server-2020

"Configuring the trigger failed, edit and save the pipeline again" with no noticeable error and no further details


I have run in to an odd problem after converting a bunch of my YAML pipelines to use templates for holding job logic as well as for defining my pipeline variables. The pipelines run perfectly fine, however I get a "Some recent issues detected related to pipeline trigger." warning at the top of the pipeline summary page and viewing details only states: "Configuring the trigger failed, edit and save the pipeline again."

The odd part here is that the pipeline works completely fine, including triggers. Nothing is broken and no further details are given about the supposed issue. I currently have YAML triggers overridden for the pipeline, but I did also define the same trigger in the YAML to see if that would help (it did not).

I'm looking for any ideas on what might be causing this or how I might be able to further troubleshoot it given the complete lack of detail that the error/warning provides. It's causing a lot of confusion among developers who think there might be a problem with their builds as a result of the warning.

Here is the main pipeline. the build repository is a shared repository for holding code that is used across multiple repos in the build system. dev.yaml contains dev environment specific variable values. Shared holds conditionally set variables based on the branch the pipeline is running on.

name: ProductName_$(BranchNameLower)_dev_$(MajorVersion)_$(MinorVersion)_$(BuildVersion)_$(Build.BuildId)
resources:
  repositories:
    - repository: self
    - repository: build
      type: git
      name: Build
      ref: master

# This trigger isn't used yet, but we want it defined for later.
trigger: 
  batch: true
  branches:
    include: 
    - 'dev'

variables:
- template: YAML/variables/shared.yaml@build
- template: YAML/variables/dev.yaml@build

jobs:
- template: ProductNameDevJob.yaml
  parameters:
    pipelinePool: ${{ variables.PipelinePool }}
    validRef: ${{ variables.ValidRef }}

Then this is the start of the actual job yaml. It provides a reusable definition of the job that can be used in more than one over-arching pipeline:

parameters:
- name: dependsOn
  type: object
  default: {}
- name: pipelinePool
  default: ''
- name: validRef
  default: ''
- name: noCI
  type: boolean
  default: false
- name: updateBeforeRun
  type: boolean
  default: false

jobs:
- job: Build_ProductName
  displayName: 'Build ProductName'
  pool:
    name: ${{ parameters.pipelinePool }}
    demands: 
    - msbuild
    - visualstudio
  dependsOn: 
  - ${{ each dependsOnThis in parameters.dependsOn }}:
    - ${{ dependsOnThis }}
  condition: and(succeeded(), eq(variables['Build.SourceBranch'], variables['ValidRef']))

  steps:
**step logic here

Finally, we have the variable YAML which conditionally sets pipeline variables based on what we are building:

variables:
- ${{ if or(eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['Build.SourceBranch'], 'refs/heads/users/ahenderson/azure_devops_build')) }}:
  - name: BranchName
    value: Dev
** Continue with rest of pipeline variables and settings of each value for each different context.

Solution

  • I think I may have figured out the problem. It appears that this is related to the use of conditionals in the variable setup. While the variables will be set in any valid trigger configuration, it appears that the proper values are not used during validation and that may have been causing the problem. Switching my conditional variables to first set a default value and then replace the value conditionally seems to have fixed the problem.

    It would be nice if Microsoft would give a more useful error message here, something to the extent of the values not being found for a given variable, but adding defaults does seem to have fixed the problem.