是否可以在任务或条件循环之间放置延迟

时间:2017-07-26 18:10:12

标签: tfs azure-devops tfsbuild

是否可以在构建或发布管道中的运行任务之间循环或延迟?我将容器部署为这些管道的一部分,并且它们需要时间来启动并可用于webtests,因此我无法在发布任务后立即运行webtest。什么可以解决TFS或VSTS中的这些要求?

2 个答案:

答案 0 :(得分:11)

将一个内嵌的PowerShell任务放在运行re_months = '(January|February|March|April|May|June|July|August|September|October|November|December)' re_int = '[0-9]+' date_row_matcher = re.compile('<td>{months} {days}, {years}</td>'.format(months=re_months, days=re_int, years=re_int)) rows = bsObj.find("table", {"class":"sortable wikitable"}).children for row in rows: for cell in row.children: match = re.match(date_row_matcher, str(cell)) if match is not None: print cell 或者您想要等待的时间内。

或者更好的是,编写自己的脚本来轮询容器以获取可用性。

答案 1 :(得分:1)

您可以添加一个Agentless阶段,并在其中放置一个Delay任务。然后,您的构建将延迟X分钟。然后,您可以使用agent phase继续执行管道。只需确保配置Run this phase或设置各阶段之间的依赖关系即可。在TFS和Azure Devops Server中可以使用。

enter image description here