Demands
Note
In Microsoft Team Foundation Server (TFS) 2018 and previous versions, run and release pipelines are called definitions, runs are called builds, service connections are called service endpoints, stages are called environments, and jobs are called phases.
Use demands to make sure that the capabilities your pipeline needs are present on the agents that run it. Demands are asserted automatically by tasks or manually by you.
Note
Demands are only applicable when your pipeline runs on self-hosted agents.
Task demands
Some tasks won't run unless one or more demands are met by the agent. For example, the Visual Studio Build task demands that msbuild
and visualstudio
are installed on the agent.
Manually entered demands
You might need to use self-hosted agents with special capabilities. For example, your pipeline may require SpecialSoftware on agents in the Default
pool. Or, if you have multiple agents with different operating systems in the same pool, you may have a pipeline that requires a Linux agent.
To add a single demand to your YAML build pipeline, add the demands:
line to the pool
section.
pool:
name: Default
demands: SpecialSoftware # Check if SpecialSoftware capability exists
Or if you need to add multiple demands, add one per line.
pool:
name: Default
demands:
- SpecialSoftware # Check if SpecialSoftware capability exists
- Agent.OS -equals Linux # Check if Agent.OS == Linux
For multiple demands:
pool:
name: MyPool
demands:
- myCustomCapability # check for existence of capability
- agent.os -equals Darwin # check for specific string in capability
For more information and examples, see YAML schema - Demands.
Register each agent that has the capability.
In your web browser, navigate to Agent pools:
Choose Azure DevOps, Organization settings.
Choose Agent pools.
Choose Azure DevOps, Collection settings.
Choose Agent pools.
Navigate to your project and choose Settings (gear icon) > Agent Queues.
Choose Manage pools.
Navigate to your project and choose Settings (gear icon) > Agent Queues.
Choose Manage pools.
Navigate to your project and choose Manage project (gear icon).
Choose Control panel.
Select Agent pools.
Navigate to the capabilities tab for the agent:
From the Agent pools tab, select the desired agent pool.
Select Agents and choose the desired agent.
Choose the Capabilities tab.
From the Agent pools tab, select the desired pool.
Select Agents and choose the desired agent.
Choose the Capabilities tab.
Select the desired agent, and choose the Capabilities tab.
Select the desired agent, and choose the Capabilities tab.
From the Agent pools tab, select the desired agent, and choose the Capabilities tab.
Add something like the following entry:
First box | Second box |
---|---|
SpecialSoftware | C:\Program Files (x86)\SpecialSoftware |
Tip
When you manually queue a build you can change the demands for that run.
Feedback
Loading feedback...