xTuMiOx
xTuMiOx

Reputation: 453

Use YAML templates from multiple repositories

I currently have the following files:

azure-pipelines.yml in repository A:

resources:
  repositories:
    - repository: templates
      type: git
      name: {MyAzureDevOpsRepoB}

stages:
- template: sharedTemplateInRepoB.yml@templates

The file sharedTemplateInRepoB.yml in repository B, is something like this:

stages:
- stage: XXX
  jobs:
  - template: someTemplateInRepoA.yml

The issue is that the file in repository B references a template that is currently living inside repository A, where the actual azure-pipelines.yml file lives.

When I start the pipeline, I get an error message that says that file someTemplateInRepoA.yml could not be found in repository B. However, I know for sure that the file exists in repo A.

Is this a supported scenario? Is there a workaround eventually to achieve my goal?

Upvotes: 2

Views: 1734

Answers (1)

dearsi
dearsi

Reputation: 170

In order to use templates from repo A in repo B you also have to add:

resources:
  repositories:
  - repository: templatesFromRepoA
    type: git
    name: {MyAzureDevOpsRepoA}
stages:
- stage: XXX
  jobs:
  - template: someTemplateInRepoA.yml@templatesFromRepoA

Upvotes: 2

Related Questions