'Is there a way to extend multiple templates with resources in Azure DevOps?
I have one pipeline that is referencing several templates with resources and I know you can extend a template with resources by using the extend
keyword. I've been looking at this documentation trying to make it work.
azure-pipeline.yaml
trigger: none
resources:
repositories:
- repository: repoName
type: git
name: project/repoName
- repository: 'Release Notes'
name: 'project/Release Notes'
type: git
pipelines:
- pipeline: ooi-adf-ci
source: ooi-adf-ci
extends:
- {template: '/cicd/pipelines/templates/stages-deploy-app-registration.yaml'}
- {template: '/cicd/pipelines/templates/stages-set-app-credentials.yaml'}
- {template: '/cicd/pipelines/templates/stages-buying-release-apps.yaml'}
- {template: '/cicd/pipelines/templates/stages-buying-adf.yaml'}
I also tried something like:
extends:
template:
[
'/cicd/pipelines/templates/stages-deploy-app-registration.yaml',
'/cicd/pipelines/templates/stages-set-app-credentials.yaml',
'/cicd/pipelines/templates/stages-buying-release-apps.yaml',
'/cicd/pipelines/templates/stages-buying-adf.yaml',
]
template.yaml where the resource is consumed:
...
resources:
pipelines:
- pipeline: ooi-adf-ci
source: ooi-adf-ci
...
I get an error in my azure-pipeline.yaml file saying "A sequence was not expected". I'm wondering if this is actually possible as I haven't been able to find any documentation on it or if I'm just incorrectly doing it.
Solution 1:[1]
I dont think you can infinitely extend templates at the root level, as in your example.
What you can do is compose a azure-pipeline.yaml file where each job / step is from a template. I do this a lot and works perfectly.
Here is the official docs: enter link description here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | user3067684 |