1
votes

Is there a parameter or a setting for running pipelines in sequence in azure devops?

I currently have a single dev pipeline in my azure DevOps project. I use this for infrastructure because I build, test, and deploy using scripts in multiple stages in my pipeline.

My issue is that my stages are sequential, but my pipelines are not. If I run my pipeline multiple times back-to-back, agents will be assigned to every run and my deploy scripts will therefore run in parallel.

This is an issue if our developers commit close together because each commit kicks off a pipeline run.

3
Build Pipeline or Release Pipeline?Matt
Hi, how the things going? Considering accept one answer which you think it is helpful for you thus other SO users can refer to that.Merlin Liang

3 Answers

1
votes

You can reduce the number of parallel jobs to 1 in your project settings.

I swear there was a setting on the pipeline as well but I can't find it. You could do an API call as part or your build/release to pause and start the pipeline as well. Pause as the first step and start as the last step. This will ensure the active pipeline is the only one running.

0
votes

Bevan's solution can achieve what you want, but there has an disadvantage that you need to change the parallel number manually back and forth if sometimes need parallel job and other times need running in sequence. This is little unconvenient.

Until now, there's no directly configuration to forbid the pipeline running. But there has a workaruond that use an parameter to limit the agent used. You can set the demand in pipeline.

enter image description here

After set it, you'll don't need to change the parallel number back and forth any more. Just define the demand to limit the agent used. When the pipeline running, it will pick up the relevant agent to execute the pipeline.

But, as well, this still has disadvantage. This will also limit the job parallel.

I think this feature should be expand into Azure Devops thus user can have better experience of Azure Devops. You can raise the suggestion in our official Suggestion forum. Then vote it. Our product group and PMs will review it and consider taking it into next quarter roadmap.

0
votes

There is a new update to Azure DevOps that will allow sequential pipeline runs. All you need to do is add a lockBehavior parameter to your YAML.

https://docs.microsoft.com/en-us/azure/devops/release-notes/2021/sprint-190-update