Search code examples
azure-devopsazure-pipelinesazure-pipelines-yaml

Azure Devops Trigger from anotherproject and repo


In REPO A on project A - yaml files of pipeline (central project for them) In Repo B on project B - Pipeline tab and code deployment location (IaaC let say).

pool:
  name: Pool_name

resources:
  repositories:
  - repository: Repo-A
    endpoint: Endpoint
    name: Project-A/Repo-A
    ref: main
    type: git
    trigger: none
  - repository: Repo-B
    endpoint: Endpoint
    name: Project-B/Repo-B
    ref: main
    type: git
    trigger:
    - main

stages:
- stage: stage-1
  displayName: stage-1
  jobs:
  - job: job-1
  displayName: job-1
  steps:
  - checkout: Repo-A
  - checkout: Repo-B
  - script: script-testing

As described in MS documentation, my trigger should work - Define a repositories resource .

I have tried to set triggers, ref's with different properties but nothing is workig. Configuration with

trigger:
  branches:
    include:
    - main

also was tested. Nothing has changed.

What I want to achieve is to trigger this pipeline located in repo A to run when main of Repo-B will be updated.

They are in the same ADO Organization, on different projects. Same endpoint use for both projects.


Solution

  • Pipelines started to work as expected after deleting the Endpoint. Working config:

    pool:
      name: Pool_name
    
    resources:
      repositories:
      - repository: Repo-A
        name: Project-A/Repo-A
        ref: main
        type: git
        trigger: none
      - repository: Repo-B
        name: Project-B/Repo-B
        ref: main
        type: git
        trigger:
        - main
    
    stages:
    - stage: stage-1
      displayName: stage-1
      jobs:
      - job: job-1
      displayName: job-1
      steps:
      - checkout: Repo-A
      - checkout: Repo-B
      - script: script-testing