How do you prevent two pipelines from deploying to the same environment at once?
IntermediateProductionPipeline Design and Architecture
Answer
Serialise per environment: GitHub concurrency: { group: deploy-prod, cancel-in-progress: false }, GitLab resource_group: production, Jenkins lock plus milestone. For Terraform, state locking (DynamoDB or S3 native locking) is a second line of defence. Also guard against out-of-order deploys: a slow older pipeline must not overwrite a newer release, so check that the commit being deployed is still the head of main or newer than what is running.
deploy:
resource_group: production
script: ./deploy.sh
More on Pipeline Design and Architecture
What does a good production CI/CD pipeline look like end to end?BeginnerWhat is your target feedback time for CI and how do you hit it?IntermediateHow do you structure repositories: app repo, config repo, pipeline library?IntermediateHow do you design a pipeline for a monorepo with 50 services?AdvancedShould every merge to main deploy to production automatically?IntermediateHow do you keep pipeline definitions DRY across hundreds of repos?Intermediate