I am trying to build reusable pipeline and basic architecure is -
I have multiple application repositories (appRepo1, appRepo2,..) and all of them having their yaml pipeline for example (appRepo1.yml, appRepo2.yml,..)
These app pipelines will call common pipeline(common.yml) which is in different repository (CommonRepo).
The common pipeline(common.yml) will be responsible to call other template pipeline(Scanning.yml in ScanRepo,Infra.yml in InfraRepo ) which are in different repositories.
Basically I want to keep application's pipeline YAML to be very thin
. I don't want to call different templates of different repository from application pipeline. Instead Common template yaml of common repository should templates from various repository.
appRepo.yml
name: "$(BuildDefinitionName)_$(SourceBranchName)_$(date:yyyyMMdd)$(rev:.r)"
trigger: none
resources:
repositories:
- repository: CommonPipeline
type: GIT
name: CommonPipeline
ref: "dev"
extends:
template: common.yml@CommonPipeline
common.yml in CommonRepo
resources:
repositories:
- repository: InfraRepo
type: GIT
name: "InfraRepo"
ref: "dev"
- repository: ScanRepo
type: GIT
name: "ScanRepo"
ref: "dev"
variables:
- template: Pipeline/vars/app-var.yaml
stages:
- template: Pipeline/stages/scanning.yml@ScanRepo
- template: Pipeline/stages/infra.yml@InfraRepo
Is it possible to put (resources -> repositories) in both appRepo.yml and common.yml ? I am getting an error when I run appRepo1 pipeline(appRepo.yml) if i keep resources section in common.yml.
Error is -
Internal error reading the template. Expected a scalar,a sequence,or a mapping