YuLun
YuLun

Reputation: 1

Azure Pipeline Problem: The Trigger of Repository of Resources Does Not Work

I have a pipeline and the yaml file is in a repo called Pipelines. I want to trigger it when another repo, assumed RepoA, is updated. I have review the document from here:

Check out multiple repositories in your pipeline

According to the example in the document above, I build my pipeline as the code below:

# YAML: Pipelines/test-pipeline.yml
trigger:
- develop

resources:
  repositories:
  - repository: A
    type: git
    name: RepoA
    ref: main
    trigger:
    - main
    - develop

steps:
- checkout: self
- checkout: A

and I assume the pipeline would work as this circomstance:

Change made to Pipeline triggered Version of YAML Version of self Version of A
develop in self Yes commit from develop that triggered the pipeline commit from develop that triggered the pipeline latest from main
main in A Yes latest from main latest from main commit from main that triggered the pipeline
develop in A Yes latest from main latest from main commit from develop that triggered the pipeline

However, the truth is the update in RepoA would not fire the pipeline. Did I miss something in the rules of pipeline or project settings?

Try 1: add the project name of RepoA

trigger:
- develop

resources:
  repositories:
  - repository: A
    type: git
    name: MyProject/RepoA
    ref: main
    trigger:
    - main
    - develop

steps:
- checkout: self
- checkout: A

Result:

not work (p.s. Repo Pipelines and RepoA are under the same project)

Try 2: add refs/heads/ before the trigger branches of RepoA

Result:

not work

Try 3: set trigger format as below

trigger:
- develop

resources:
  repositories:
  - repository: A
    type: git
    name: MyProject/RepoA
    ref: main
    trigger:
      branches:
        include:
          - main
          - develop

steps:
- checkout: self
- checkout: A

Result:

not work

Upvotes: 0

Views: 598

Answers (1)

wade zhou - MSFT
wade zhou - MSFT

Reputation: 8468

I used your first yaml, and repository trigger works(test1 as repo A):

enter image description here

enter image description here

Please follow below steps:

  1. Change the develop branch as default branch in the repo.

  2. If the pipeline didn't run before, please manually run it for one time.

Then commit on repo A to check the trigger(PS: if repo A is in same project, use name: RepoA in yaml for trigger, without project.)

Edit:

Add my yaml:

trigger:
- dev5

pool:
  vmImage: ubuntu-latest

resources:
  repositories:
  - repository: A
    type: git
    name: test1
    ref: main
    trigger:
    - main
    - develop


steps:
- checkout: self
- checkout: A

Upvotes: 0

Related Questions