Centralised Yaml References

post

Overview

Working on large programmes with many repos involved can potentially lead to duplication in pipeline logic, here is an easy way to centralise and ultimately share YAML files between repos.

Markup

Adding the centralised repo as a resource is key here:

trigger:
- main

resources: 
  repositories:
    - repository: pe
      type: git
      name: Arceau-PE
      ref: main
  
stages:
- stage: build_release_web
  displayName: 'Build and Release WebSite'
  jobs:
  - template: /yaml/jobs/build-release-website.yml@pe
    parameters:
      environment: $(Environment)
      spn: $(Connection)

But the real magic is the simple "@pe" after the template file reference, this means that the resource named "pe" will be used when looking for the template file.

This is probably well documented but its just something that had managed to escape me so I wanted to share.

Tim Hills

Tim Hills

Tim has been working in solution delivery for over 15 years and has really exceled in the industry. He has been fortunate enough to work with some high-profile clients and challenging projects which has positioned him well for turning business requirements into reality.

Registered office

Address: Arceau Solutions Ltd, Dane John Works, Gordon Rd, Canterbury, CT1 3PP

Telephone: 0208 191 7030