When using an Azure DevOps deployment pipelines with exclusive lock for a stage and triggering a deployment pipeline parallelly, only the latest deployment runs and all previous deployments that triggered automatically get cancelled. This would be fine with cumulative deployments, however, if you have a different content in each deployment run, canceling the one deployment affect the system badly due to missing updates to the system.
Following image shows, pipeline automatically cancelled the previous run and runs only the latest deployment.
Azure DevOps has introduced a solution for this issue. You can use lockBehavior: sequential in the relevant stage of the deployment pipeline . Then it will sequentially run all the runs without cancelling any of the deployments.
You can add the keyword as shown in the following sample.
trigger: - master pool: vmImage: 'windows-latest' stages: - stage: DEV jobs: - deployment: displayName: development deploy environment: Dev strategy: runOnce: deploy: steps: - task: PowerShell@2 inputs: targetType: 'inline' script: 'Write-Host "Hey!. This is just Dev test."' - stage: Staging lockBehavior: sequential jobs: - deployment: displayName: Staging deploy environment: Staging strategy: runOnce: deploy: steps: - task: PowerShell@2 inputs: targetType: 'inline' script: 'Write-Host "Hey!. This is just Staging test"'
Once lockBehavior added as sequential, deployments would be as following. All the deployments get completed sequentially.
No comments:
Post a Comment