5
votes

Trying to convert a "visually" defined Azure Pipeline to yaml, but have encountered a problem. With the "visually" defined Azure Pipeline you get a UI similar to below when doing a manual queue:

queue UI for visual pipeline

Note how this UI lets us select between agent pools at queue time. This is a functionality we use quite a lot. We do this since we have pipelines we use for machine learning for example.

Unfortunately, you cannot select Agent pool when switching to yaml based pipeline. It is simply gone, despite the yaml pipeline not defining the pool or similar.

queue UI for yaml pipeline

Is there any way for getting the same kind of dropdown box for the Agent pool for yaml based pipelines?

UPDATE: Using a variable for the pool name is possible but also a hassle so not looking for a solution that requires entering the full pool name upon queueing. Hence, either a dropdown box or some other mechanism.

3
I have looked into other options with regards to defining a bool variable instead and then defining pool name via that but that does not seem possible either e.g. github.com/microsoft/azure-pipelines-yaml/issues/256nietras

3 Answers

3
votes

This is possible as of Feb 2020. Check out the new Runtime Parameters.

Selecting agent pools from a dropdown is actually their very first example.

parameters:
- name: image
  displayName: Pool Image
  type: string
  default: ubuntu-latest
  values:
  - windows-latest
  - vs2017-win2016
  - ubuntu-latest
  - ubuntu-16.04
  - macOS-latest
  - macOS-10.14
3
votes

You can use a variable for the pool:

pool:
  vmImage: '$(pool)'

enter image description here

Then, in the yaml editor click on the top right ... and "Variables":

enter image description here

There define the pool variable with "Settable at queue time":

enter image description here

Now when you run the pipeline you can change the variable to what you want:

enter image description here

0
votes

yeah, i dont think its possible to do that with yaml based pipelines, at least not according to the schema.