选择槽代理的Azure管道条件
我想在管道中插入条件, 具体来说,我希望从默认代理到自定义一个的Swich Pipeline ,ho将此条件插入管道中时? NB:我刚刚在azure中创建并安装了我的自定义代理,
例如我的azure pipelines.yml文件:
trigger:
- feature/test_pipeline
**how to insert an 'if condition' to choose different agent
if default is not available or get error**
pool:
vmImage: ubuntu-latest
steps:
- script: |
echo "my power script"
displayName: 'Run script' ```
I would like to insert a condition in my pipeline,
specifically I would like the swich pipeline from the default agent to the custom one when I get an error, ho to insert this condition in pipeline?
NB: I have just created and installed my custom agent on private VM in azure
eg this is my azure-pipelines.yml file:
trigger:
- feature/test_pipeline
**how to insert an 'if condition' to choose different agent
if default is not available or get error**
pool:
vmImage: ubuntu-latest
steps:
- script: |
echo "my power script"
displayName: 'Run script' ```
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕目前没有这样的方法可以做到这一点。
众所周知,当我们执行管道时,将预先编译YAML文件。在兼容阶段,将解析YAML以确定是否存在语法或逻辑错误。
但是,如果您不输入汇编和执行阶段,则无法知道代理的状态。
因此,不可能在兼容阶段判断代理商的状态。
I am afraid there is no such way to do this at this moment.
As we know, the YAML files are precompiled when we execute our pipeline. During the pre-compilation phase, the YAML will be parsed to determine whether there are syntax or logical errors.
However, if you do not enter the compilation and execution stage, you cannot know the state of the agent.
Therefore, it is impossible to judge the state of the agent in the pre-compilation stage.