Reputation: 808
Im struggling to find any documentation to select a specific build agent that's in a given pool via our yaml azure pipeline file. Right now were selecting the pull to launch the job on but I'm having massive deployment issues with our servers and need to individually select the one I want to run the job on have anyone ever had to do something like this before?
trigger:
batch: true
branches:
include:
- master
paths:
exclude:
- README.md
pool: 'ZupaDeploymentPool'
Upvotes: 1
Views: 11838
Reputation: 30343
You can use Demands to make your pipeline run on a specific build agent. See below steps:
1, Specify a user defined capability (you can use the System capabilities too)
Go to Project Settings-->Agent pools of Pipelines-->Select your Agent Pool-->Go to Agents tab--Select your Agent-->Click Capabilities-->Click **+**
to add a user defined capability. See this the detailed steps and screenshots here.
Then you can define the demands in your yaml pipeline like below: The pipeline will only run on the build agent which i defined the capability Tag = agent1
in above step.
pool:
name: agengPoolName
demands:
- Tag -equals agent1
You can also use the system capabilities without defining your own capabilities in demands. See below i use the system capabilities Agent.Name
pool:
name: Default
demands:
- Agent.Name -equals myagentName
Upvotes: 4
Reputation: 391
I have done it with the UI but not when coding it in YAML but the concepts will be applicable:
You put the Agent.Name you are trying to select into the Build -> Options -> Demands section of the pipeline definition. In the UI it reads like
Agent.Name equals Foo
Based on that demand, that build will only go to the specified agent within the pool...
For the YAML-defined Build, the Demands are defined as shown here.
Upvotes: 0