简体   繁体   中英

Run azure devops pipeline on every available pool

I'm evaluating Azure Devops and want to have following workflow: I want to have a pipeline build and run it on our self-hosted build agent, but if non them is available I want to fall back on hosted agent and vice versa. According to documentation https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops in the yaml file you need to define in which pool will job run.

Can I have a pipeline build without having to define a pool/define many pools as fallback?

I want to have a pipeline build and run it on our self-hosted build agent

The answer is yes.

To use your self-hosted build agent in the YAML, you need to use following syntax:

pool:
  name: <YourAgentName>

Check the YAML schema reference for some more details. And this thread about how to create a your private agent (If you know how to create a private agent, please ignore it).

Can I have a pipeline build without having to define a pool/define many pools as fallback?

You could have a pipeline build without having to define a pool.

Because when creating a YAML pipeline, the default agent pool always is set as Hosted Ubuntu 1604 . In the past, user could select the specific agent pool as the Default agent pool for YAML from the drop-down list on YAML tab. After the recent update Sprint 155 , user will not select the agent pool. If you want to use another agent pool, you must set the specific agent pool in the YAML script.

在此处输入图片说明

Then switch to YAML tab, you will find the option for default agent setting:

在此处输入图片说明

pool:
  vmImage: string # name of the VM image you want to use; valid only in the Microsoft-hosted pool

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM