I need to update a couple of pipelines to use the same logic and thought about using templates to split the common YAML steps.All the projects share the same dependency with an in-house Nuget package that is used for deployment. My initial idea is to use that package to hold the template YAML and reference it on each project but when I read the documentation I am not entirely sure this is supported.To give you a better idea I'm going to exemplify with the same sample code on the documentation.This would be our YAML in the Nuget package, to be inserted as a template reference on each project.
# File: templates/include-npm-steps.ymlsteps:- script: npm install- script: yarn install- script: npm run compile
This would be the YAML on each project that needed to consume the above YAML from the Nuget package.
# File: azure-pipelines.ymljobs:- job: Linux pool: vmImage: 'ubuntu-latest' steps: - template: templates/include-npm-steps.yml # Template reference- job: Windows pool: vmImage: 'windows-latest' steps: - template: templates/include-npm-steps.yml # Template reference
Probably at run time the pipeline checks for the referenced templates and won't run since they need to be restored first. Any ideas?