Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to put delay between tasks or conditional loop

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?

like image 702
Gregory Suvalian Avatar asked Jul 26 '17 18:07

Gregory Suvalian


People also ask

How do I add a delay in Yaml?

For delay 10 minutes in your build , I suggest you add a powershell task and add the script:Start-Sleep -Seconds 600 . Then the build will delay 10 minutes. Hope it helps.

How do you pause Azure pipeline?

You can disable the agents to prevent the pipeline from running. Go the Agent Pools under Pipelines in Project settings-->Select the agent pool -->Go to Agents tab-->Disable all the agents. You can also use rest api to pause the build pipeline mentioned in the comments.

What is agentless job in Azure DevOps?

Our question is related to the second type of jobs; server jobs also known as agentless jobs. Where most of the jobs are executed by a build agent, server jobs are executed directly on the Azure DevOps application server. This means that a server job does not require an agent or any target computers.


2 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.

like image 125
Daniel Mann Avatar answered Oct 27 '22 01:10

Daniel Mann


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.

enter image description here

like image 37
smoksnes Avatar answered Oct 26 '22 23:10

smoksnes