Skip to content

Instantly share code, notes, and snippets.

@taikedz
Created April 30, 2026 16:02
Show Gist options
  • Select an option

  • Save taikedz/28c1f93aeefa2988a1145397d4db1783 to your computer and use it in GitHub Desktop.

Select an option

Save taikedz/28c1f93aeefa2988a1145397d4db1783 to your computer and use it in GitHub Desktop.
Rudimentary ADO pipeline imports

Basic ADO pipline importing

Not covered: the ability to use extends

Given a sub_pipe.yml with

parameters:
  - name: warcry
    type: string
  ...

stages:
  ...

This can be "extended" in another via

trigger: ...

parameters:
  ...
  
pool:
  ...

name: ...
  
extends:
  template:  sub_pipe.yml
  parameters:
    warcry: "oopsies!"

Note: only one pipeline can be extended

To multi-import, the target must be a stages file, with no pool/name/trigger

trigger: ...

parameters:
  ...
  
pool:
  ...

name: ...
  
stages:
  # the sub pipes are just `stages` holders, and cannot have their own "trigger" statements etc
  - template:  sub_pipe.yml
    parameters:
      warcry: "oopsies!"
  - template:  sub_pipe2.yml
    parameters:
      response: "oh noes!"
trigger: none
parameters:
- name: Greeting
type: string
default: Hello
values:
- Hello
- Ciao
- Ahoy
- name: Person
type: string
default: Jack-o
pool:
# Pool to find agents amongs
name: $(pool)
# Of all agents, select one with _all_ these properties
demands:
- Agent.OS -equals Linux
- service_name -equals buildagent-name
name: Dummy build (build_number) on $(pool)
stages:
- stage:
displayName: Main Stage
jobs:
- job:
displayName: First of all ...
steps:
- task: Bash@3
displayName: Run shell
inputs:
targetType: inline
script: |
set -x
echo "
${{parameters.Greeting}}
This is what is done
at the start of the line
"
env
- template: Templates/top_template.yml
parameters:
Person: ${{ parameters.Person }}
# Actual path should be 'Templates/Subtemps/sub_template.yml'
# Top level is a "steps", to import under a "steps" itself
parameters:
- name: Person
type: string
steps:
- task: Bash@3
displayName: "SubStep"
inputs:
targetType: inline
script: |
echo "The sub ran in the deep where ${{parameters.Person}} sleeps..."
# Actual path should be 'Templates/top_template.yml'
# Top level is a "jobs" to import under a "jobs" itself
# A template-imported file does not inherit the importer's parameters
parameters:
- name: Person
type: string
jobs:
- job: top_job
displayName: Top Job
steps:
- task: Bash@3
displayName: TopStep
inputs:
targetType: inline
script: |
echo "The top ran on the wind where ${{parameters.Person}} dances"
- template: Subtemps/sub_template.yml
# ^-- import relative to current file's location, of course
parameters:
Person: ${{ parameters.Person }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment