0

Repo 1 and Branch Name: Repo1Branch

trigger:
- none

pool:
  vmImage: 'ubuntu-latest'

steps:
- script: echo Hello, world!

I want to call Repo 1 form Repo 2 pipeline

Repo 2 and Branch Name: Repo2Branch

trigger:
- none

pool:
  vmImage: 'ubuntu-latest'

resources:
  repositories:
    - repository: templates
      type: git
      name: PROJECTNAME/Repo 1
      ref: Repo1Branch 
  
steps:
 - template: azure-pipelines.yml@Repo 1
Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • Hi, If the answer resolved your question, you could [Accept it](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235) as an Answer , so it could help other community members who get the same issues and we could archive this thread, thanks. Have a nice day. :) – Vito Liu Jan 21 '21 at 09:26

1 Answers1

0

Yes, you can it is mentioned here - Use other repositories

In one repo you define template

# Repo: Contoso/BuildTemplates
# File: common.yml
parameters:
- name: 'vmImage'
  default: 'ubuntu 16.04'
  type: string

jobs:
- job: Build
  pool:
    vmImage: ${{ parameters.vmImage }}
  steps:
  - script: npm install
  - script: npm test

and then you reference it

# Repo: Contoso/LinuxProduct
# File: azure-pipelines.yml
resources:
  repositories:
    - repository: templates
      type: github
      name: Contoso/BuildTemplates

jobs:
- template: common.yml@templates  # Template reference

but this has to be template. Not full pipeline. You cannot reference full pipeline as a template as you did above. So for instance trigger and pool are not allowed keywords in a template.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107