Forum Discussion
Martines_01
Dec 05, 2023Copper Contributor
Azure DevOps - only one pipeline at the time
Hello everyone, We want to run at our pipeline only one at the time. We are using exclusive lock and pipeline that is build from 4 different stages where only one has exclusive lock. After deploymen...
Kidd_Ip
Jun 01, 2025MVP
Yes, this is possible:
- Use "Limit Concurrent Jobs" in Agent Pool
- Go to Project Settings → Agent Pools.
- Select the Self-hosted agent pool you're using.
- Set the maximum parallel jobs to 1 to enforce sequential execution.
- Use Deployment Job "Exclusive Lock" Correctly
- Since you’re using exclusive lock, Azure DevOps still allows jobs in the queue, but it does not strictly control their order.
- Instead, wrap everything (deployment and test stages) inside one deployment job so the lock applies to the full sequence.
- Use "Depends On" for Stage Order Enforcement
Modify your pipeline YAML to explicitly order execution:
stages:
- stage: Deploy
jobs:
- deployment: DeployApp
environment: 'Prod'
strategy:
runOnce:
deploy:
steps:
- script: echo "Deploying App"
- script: echo "Deployment complete"
- stage: Tests
dependsOn: Deploy # Ensures this stage runs AFTER deployment
jobs:
- job: RunTests
steps:
- script: echo "Running tests..."
- script: echo "Tests completed"
- Use "Queue Behavior" to Ensure Sequential Execution
Inside the Agent Pool settings, use the option:
- Allow only one job to run at a time
- This will queue subsequent jobs until the previous pipeline fully finishes, preventing duplicates.