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

6

20

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.
Kharif answered 17/8, 2021 at 14:36 Comment(0)
K
5

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.

Kharif answered 17/8, 2021 at 14:58 Comment(1)
Could you show us an image of the updated pipeline after after solving the problem? Thanks by the wayKisung
V
14

You can check my post here : Azure DevOps pipeline trigger issue message not going away

As I can see in your YAML file, you are using this branch : 'refs/heads/users/ahenderson/azure_devops_build'.

I think some YAML files you are refering are missing from the branch defined as default in your build there : enter image description here

Switch to your branch

Vendace answered 7/12, 2021 at 15:22 Comment(3)
That's not the branch being used though. That's just one possible branch that could potentially be used. The default branch is dev and has all the files as well as all the variable definitions. The issue is that it does not actually use any branchname when evaluating this logic, which is why a default set of variable values was needed.Kharif
This solved my problem. I was using a secondary branch with the yaml, and master(default) didn't have, so was getting this error. Thank you ChristopheDarleen
This was my issue, as well. I removed master from my triggers in the YAML, but I still had the master branch as my source branch in the UI. Thanks for the assist!Novella
K
5

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.

Kharif answered 17/8, 2021 at 14:58 Comment(1)
Could you show us an image of the updated pipeline after after solving the problem? Thanks by the wayKisung
G
2

For me it was this causing the problem...

The following pipeline.yaml causes the error “Configuring the trigger failed, edit and save the pipeline again”. It has to do with the environment name name: FeatureVMs.${{ variables.resourceName }}, if i replace ${{ variables.resourceName }} with something else e.g. FeatureVMs.develop then the error does not occur. The strange thing is, if i once save the pipeline with all triggers I want and a valid environment FeatureVMs.develop then it saves the triggers, if i then change it to what i actually want a dynamic environment resource selection FeatureVMs.${{ variables.resourceName }} then the error occurs but Azure Dev Ops the pipeline works as i expect it. So the workaround is to save it once without a variable and the triggers you want and then with the variable and live with the error on top of the pipeline

This causes the error

trigger: none

variables:
- name: resourceName
  value: $(Build.SourceBranchName)
- name: sourcePipeline
  value: vetsxl-ci

resources:
  pipelines:
    - pipeline: vetsxl-ci
      source: vetsxl-ci
      trigger:
        branches: 
          include: 
            - develop
            - feature/F*
            - release/*
            - review/*
            - demo/*
            - hotfix/H*
            - tests/*
            - test/*

stages:
- stage: Deploy
  displayName: 'Deploy'
  condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
  jobs:
  - deployment: DeployVM
    displayName: 'Deploy to develop VM'
    environment:
      name: FeatureVMs.${{ variables.resourceName }}
    strategy:
      rolling:
        deploy:
          steps:
          - template: deploy.yml
            parameters:
              sourcePipeline: ${{ variables.sourcePipeline }}

This works without any errors.

trigger: none

variables:
- name: resourceName
  value: $(Build.SourceBranchName)
- name: sourcePipeline
  value: vetsxl-ci

resources:
  pipelines:
    - pipeline: vetsxl-ci
      source: vetsxl-ci
      trigger:
        branches: 
          include: 
            - develop
            - feature/F*
            - release/*
            - review/*
            - demo/*
            - hotfix/H*
            - tests/*
            - test/*

stages:
- stage: Deploy
  displayName: 'Deploy'
  condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
  jobs:
  - deployment: DeployVM
    displayName: 'Deploy to develop VM'
    environment:
      name: FeatureVMs.develop
    strategy:
      rolling:
        deploy:
          steps:
          - template: deploy.yml
            parameters:
              sourcePipeline: ${{ variables.sourcePipeline }}
Garage answered 25/10, 2022 at 21:57 Comment(0)
P
1

In our case it was because the path to the YAML file started with a slash: /builds/build.yaml

Removing the slash fixed the error: builds/build.yaml

Precatory answered 16/2, 2022 at 10:33 Comment(1)
Interesting, for me it was the opposite. Adding a leading slash removed the error message.Cauldron
B
1

In my case I had replaced the trigger in the yaml-file. The pipeline then does not now where to start.

# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4

trigger:
  - "main"  # <-- That was name wrong
Billboard answered 10/7, 2022 at 6:39 Comment(0)
H
1

In my case I added the schedules entry and wrongfully added one entry for the LIST branches to include:

schedules:
- cron: '*/10 * * * *' # Run every 10th minutes
  displayName: Daily build no cache
  branches:
    include: refs/heads/feature/19935 # WRONG => This must be a list

Corrected:

schedules:
- cron: '*/10 * * * *' # Run every 10th minutes
  displayName: Daily build no cache
  branches:
    include: 
    - refs/heads/feature/19935 # This is a list now
Hyperopia answered 8/8, 2023 at 17:48 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.