Is it possible to either loop or delay between running tasks in either build or release pipelines? I deploy containers as part of those pipelines and they take time to spin up and be available for webtests, so I can not run webtest immediately following Release task. What can be a solution to this requirements inside TFS or VSTS?
-
Are you using the Docker extension or are you running home-grown scripts to do this? https://marketplace.visualstudio.com/items?itemName=ms-vscs-rm.docker – Daniel Mann Jul 26 '17 at 18:13
-
Docker built-in task by Microsoft. This still does not solve the issue since after the service deployment and build I need to check if it's running properly and issue HTTP request to it. It takes a minute to spin up and initialize a container and I need to know how to pause or run in a loop test – Gregory Suvalian Jul 26 '17 at 18:24
3 Answers
Put an in-line PowerShell task in place that runs Start-Sleep -Seconds 10
or however long you want to wait.
Or better yet, write your own script that polls your containers for availability.

- 57,011
- 13
- 100
- 120
-
2This solution functionally works, and is probably the best choice if the delay is a few seconds, but for any longer delay (minutes+), one thing to keep in mind is that this keeps an agent from your pool that is not doing anything useful. For such longer delays, the agentless job/phase approach (in smoksnes' answer) is probably a better use of the pool resources, even if the resumption of the pipeline means redownloading sources/artifacts/etc. – fbrosseau Jan 12 '21 at 21:54
You can add an Agentless phase and put a Delay-task in it. Then your build will be delayed X minutes. Then you may continue your pipeline with an agent phase
. Just make sure to configure Run this phase
or set a dependency between the phases. This works in TFS and Azure Devops Server.

- 10,509
- 4
- 49
- 74
As shown for release tasks by smoksnes' answer, the Delay agentless task can also be used in Azure DevOps YAML (build) pipelines. Here is an example:
pool: server
steps:
- task: Delay@1
inputs:
delayForMinutes: '5'
Note that the pool: server
is the key here. It makes this task run without the need of an agent. ADO offers a few of these agentless tasks, manual validation for example may be useful if the delay you need isn't consistent.

- 920
- 1
- 7
- 12