I have multiple pipelines that all needs a specific pipeline as a resource, let’s consider the below as one of the pipeline that uses pipeline resource.
trigger: none
resources:
pipelines:
- pipeline: test
project: Project
source: test
version: 1.2.3
stages:
- stage: Validation
jobs:
- job: Validation
steps:
- script: echo "Validating"
When version of the resource pipeline(test) changes for example to 1.3.0, I need to update all the pipeline that uses this resource. So I was looking to create a resource template that can be used by all the pipelines and only the resource template needs to be updated for version change.
I came across this example Extend from a template with resources – I implemented it, but when I combine extends with stages I get this error:
Encountered error(s) while parsing pipeline YAML:
/Pipelines/test.yml (Line: 6, Col: 1): Unexpected value ‘stages’
My implementation looks like this,
#resource-template.yml
resources:
pipelines:
- pipeline: test
project: Project
source: test
version: 1.3.0
#test.yml
trigger: none
extends:
template: Templates/_Shared/resource-template.yml
stages:
- stage: Validation
jobs:
- job: Validation
steps:
- script: echo "Validating"
If I remove stages my implementation works good, but I need to use the stages in the main pipeline. Is there any different approach to handle this case?