最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

PR Trigger Not Working on Azure DevOps YAML Pipeline - Stack Overflow

programmeradmin2浏览0评论

I have a project on Azure DevOps and within that I have a YAML pipeline.

Given this YAML:

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# 
# trigger 1

trigger: none
pr:
  branches:
    include:
    - main

pool:
  vmImage: ubuntu-latest

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

- script: |
    echo Add other tasks to build, test, and deploy your project.
    echo See 
  displayName: 'Run a multi-line script'

The pipeline is not triggered. My expectations are that this:

  • will not trigger when a PR is created, approved
  • will trigger when a PR is approved when the PR is targeting the Main branch

It is not triggering when a PR is completed and targets the Main branch. What do I have wrong or what else do I need to check that might prevent the pipeline from being triggered?

I have a project on Azure DevOps and within that I have a YAML pipeline.

Given this YAML:

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
# trigger 1

trigger: none
pr:
  branches:
    include:
    - main

pool:
  vmImage: ubuntu-latest

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

- script: |
    echo Add other tasks to build, test, and deploy your project.
    echo See https://aka.ms/yaml
  displayName: 'Run a multi-line script'

The pipeline is not triggered. My expectations are that this:

  • will not trigger when a PR is created, approved
  • will trigger when a PR is approved when the PR is targeting the Main branch

It is not triggering when a PR is completed and targets the Main branch. What do I have wrong or what else do I need to check that might prevent the pipeline from being triggered?

Share Improve this question edited Nov 18, 2024 at 20:36 glosrob asked Nov 18, 2024 at 20:20 glosrobglosrob 6,7154 gold badges46 silver badges78 bronze badges 4
  • 1 Where is your git repo hosted? It says here that yaml PR triggers only works for GitHub and Bitbucket Cloud repos. learn.microsoft/en-us/azure/devops/pipelines/yaml-schema/… – colinD Commented Nov 18, 2024 at 20:34
  • Good point, this is a frustration induced poor description on my part, I will update it now. This pipeline is created as part of a project on Azure DevOps. – glosrob Commented Nov 18, 2024 at 20:35
  • I mean, is the repo itself on Azure DevOps? Because Azure DevOps also supports running pipelines for repositories hosted outside, like Github. But if your repository is in devops, the doc says you can't use yaml trigger and you have to do it using branch policies. – colinD Commented Nov 18, 2024 at 20:41
  • And you are correct it is indeed looking like the issue. Head right into desk and through it in to the floor. Do you want to add as answer and I will accept it. – glosrob Commented Nov 18, 2024 at 20:44
Add a comment  | 

1 Answer 1

Reset to default 1

The documentation states that you can only use YAML pr triggers if the git repository is hosted in GitHub or Bitbucket Cloud.

YAML PR triggers are supported only in GitHub and Bitbucket Cloud. If you use Azure Repos Git, you can configure a branch policy for build validation to trigger your build pipeline for validation.

For other repositories such as the default in Azure DevOps, you need to use branch policies.

发布评论

评论列表(0)

  1. 暂无评论