Azure Pipelines选择代理以在池yml模板中运行构建 [英] Azure Pipelines select agent to run build on within pool yml template

查看:93
本文介绍了Azure Pipelines选择代理以在池yml模板中运行构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力寻找任何文档,以通过我们的yaml azure管道文件来选择给定池中的特定构建代理。现在正在选择启动该任务的动力,但是我的服务器存在大量部署问题,并且需要单独选择我要运行该任务的服务器,是否有人曾经做过这样的事情?

 触发:
批次:真
分支机构:
包括:
-主
路径:
排除:
-README.md

池:'ZupaDeploymentPool'


解决方案

您可以使用需求,以使您的管道在特定的构建代理上运行。请参阅以下步骤:



1,指定用户定义的功能(您也可以使用系统功能)



转到管道项目设置 s-> 代理池->选择您的代理池->转到代理商标签-选择您的代理商->单击功能->单击 ** + ** 添加用户定义的功能。请参阅此详细步骤和屏幕截图此处



Tag = agent1 。

 池:
名称:agengPoolName
要求:
-标记-等于agent1

您也可以使用系统功能而无需定义自己的需求。参见下文,我使用系统功能 Agent.Name

 池:
名称:默认
要求:
-Agent.Name -equals myagentName


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'

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

这篇关于Azure Pipelines选择代理以在池yml模板中运行构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆