Skip to content

Commit 8e7a491

Browse files
yejianquanqiluo-msft
authored andcommitted
Enable to cancel pipeline jobs during checkout code and tests (#12436)
co-authorized by: [email protected] Why I did it Now, checkout code step and KVM test job can't be cancelled even though the whole build is cancelled. That's because by using Azure Pipeline Conditions, we customized the running condition, and we need to react to the Cancel action explicitly by asserting 'succeeded' https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#succeeded https://learn.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml#ive-got-a-conditional-step-that-runs-even-when-a-job-is-canceled-how-do-i-manage-to-cancel-all-jobs-at-once How I did it Assert 'succeeded' condition explicitly. How to verify it Verified by cancelling and rerunning the azure pipeline.
1 parent 1999d9a commit 8e7a491

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.azure-pipelines/azure-pipelines-image-template.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
displayName: "Set cache options"
3737
- checkout: self
3838
submodules: recursive
39-
condition: eq(variables.SKIP_CHECKOUT, '')
39+
condition: and(succeeded(), eq(variables.SKIP_CHECKOUT, ''))
4040
displayName: 'Checkout code'
4141
- script: |
4242
BRANCH_NAME=$(Build.SourceBranchName)

azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ stages:
7676

7777
- stage: Test
7878
dependsOn: BuildVS
79-
condition: and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), in(dependencies.BuildVS.result, 'Succeeded', 'SucceededWithIssues'))
79+
condition: and(succeeded(), and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), in(dependencies.BuildVS.result, 'Succeeded', 'SucceededWithIssues')))
8080
variables:
8181
- name: inventory
8282
value: veos_vtb

0 commit comments

Comments
 (0)