Is it possible to move pool specifications into a template in ADO YAML?

Viewed 26

Is it possible to move pool specifications into a template in ADO YAML? The reason being, if in case the pool demand changes in the future, we dont need to go and edit all the 50+ main YAML files

1 Answers

We are not able to only specify Agent pool in Yaml template.

To achieve your requirement, you can define the pool name as variable in YAML template. Then you can use the variable as Pool name in main YAML.

Here is an example:

poolname.yml:

variables:
   poolname: agentpoolname

main.yml

variables:
   - template:  pool.yml

pool:
  name: $(poolname)

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'
Related