简体   繁体   English

Azure DevOps Server 2019(本地):代理作业可以串行运行吗?

[英]Azure DevOps Server 2019 (on-premises): Can agent jobs be run serially?

I have a scenario where I would like a build to start running on one agent (Job 1), and then after doing some work, I'd like it to run a step on a special agent (pool) of machines with specially licensed software.我有一个场景,我希望构建开始在一个代理(作业 1)上运行,然后在完成一些工作后,我希望它在具有特殊许可软件的机器的特殊代理(池)上运行一个步骤. (Job 2). (作业 2)。 When that is done I'd like the rest of the build to complete on the original agent (Job 3).完成后,我希望构建的其余部分在原始代理(作业 3)上完成。

I have been able to use "Variable Tools for Azure DevOps Services" to successfully pass any number of variables between agent jobs, even when they are running on different machines.我已经能够使用“Azure DevOps 服务的变量工具”在代理作业之间成功传递任意数量的变量,即使它们在不同的机器上运行。 It is no problem for me to pass a UNC path from Job1 to Job2 / Job3, etc.将 UNC 路径从 Job1 传递到 Job2/Job3 等对我来说是没有问题的。

However, what I am seeing is that no matter what I do, agent jobs are always running in parallel, and there is no way to get them to run serially, unless they are locked to the same agent on the same machine, which defeats the whole purpose.然而,我所看到的是,无论我做什么,代理作业总是并行运行,并且没有办法让它们串行运行,除非它们被锁定到同一台机器上的同一个代理,这使得整个目的。

Does anyone know of a means to accomplish this?有谁知道实现这一目标的方法? Right now in tests, I have to use "Start-Sleep" or something similar, and repeatedly monitor an external event.现在在测试中,我必须使用“Start-Sleep”或类似的东西,并反复监视外部事件。 A terribly inelegant work-around.一个非常不优雅的解决方法。

I found the answer.我找到了答案。 A job properties contains a field called "dependencies".作业属性包含一个名为“依赖项”的字段。 You can make it serial by setting a dependency on the previous job.您可以通过设置对上一个作业的依赖来使其串行。

In Azure Devops for the agent job you will get below options在代理工作的 Azure Devops 中,您将获得以下选项

在此处输入图片说明

You can select any option based on your requirements.您可以根据自己的要求选择任何选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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