@@ -82,14 +82,23 @@ jobs:
8282 BUILD_BRANCH : $(BUILD_BRANCH)
8383 IMPACT_AREA_INFO : ${{ parameters.IMPACT_AREA_INFO }}
8484
85+ - job : cancel_previous_test_plan_for_same_pr
86+ displayName : " Cancel previous test plans for same PR"
87+ continueOnError : true
88+ pool : ${{ parameters.AGENT_POOL }}
89+ timeoutInMinutes : 10
90+ steps :
91+ - template : cancel-previous-elastictest-testplan.yml
92+
8593 - job : impacted_area_t0_elastictest
8694 displayName : " impacted-area-kvmtest-t0 by Elastictest"
8795 dependsOn :
8896 - get_impacted_area
97+ - cancel_previous_test_plan_for_same_pr
8998 variables :
9099 TEST_SCRIPTS : $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
91100 RUN_BY_INCLUDE_JOBS : ${{ or(eq(parameters.INCLUDE_JOBS, 'all'), contains(parameters.INCLUDE_JOBS, 't0_job')) }}
92- condition : and(contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
101+ condition : and(not(canceled()), succeeded(), contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
93102 timeoutInMinutes : ${{ parameters.TIMEOUT_IN_MINUTES_PR_TEST }}
94103 continueOnError : false
95104 pool : ${{ parameters.AGENT_POOL }}
@@ -128,10 +137,11 @@ jobs:
128137 displayName : " impacted-area-kvmtest-t0-2vlans by Elastictest"
129138 dependsOn :
130139 - get_impacted_area
140+ - cancel_previous_test_plan_for_same_pr
131141 variables :
132142 TEST_SCRIPTS : $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
133143 RUN_BY_INCLUDE_JOBS : ${{ or(eq(parameters.INCLUDE_JOBS, 'all'), contains(parameters.INCLUDE_JOBS, 't0_2vlans_job')) }}
134- condition : and(contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0-2vlans_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
144+ condition : and(not(canceled()), succeeded(), contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0-2vlans_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
135145 timeoutInMinutes : ${{ parameters.TIMEOUT_IN_MINUTES_PR_TEST }}
136146 continueOnError : false
137147 pool : ${{ parameters.AGENT_POOL }}
@@ -171,10 +181,11 @@ jobs:
171181 displayName : " impacted-area-kvmtest-t1-lag by Elastictest"
172182 dependsOn :
173183 - get_impacted_area
184+ - cancel_previous_test_plan_for_same_pr
174185 variables :
175186 TEST_SCRIPTS : $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
176187 RUN_BY_INCLUDE_JOBS : ${{ or(eq(parameters.INCLUDE_JOBS, 'all'), contains(parameters.INCLUDE_JOBS, 't1_job')) }}
177- condition : and(contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
188+ condition : and(not(canceled()), succeeded(), contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
178189 timeoutInMinutes : ${{ parameters.TIMEOUT_IN_MINUTES_PR_TEST }}
179190 continueOnError : false
180191 pool : ${{ parameters.AGENT_POOL }}
@@ -213,10 +224,11 @@ jobs:
213224 displayName : " impacted-area-kvmtest-dualtor by Elastictest"
214225 dependsOn :
215226 - get_impacted_area
227+ - cancel_previous_test_plan_for_same_pr
216228 variables :
217229 TEST_SCRIPTS : $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
218230 RUN_BY_INCLUDE_JOBS : ${{ or(eq(parameters.INCLUDE_JOBS, 'all'), contains(parameters.INCLUDE_JOBS, 'dualtor_job')) }}
219- condition : and(contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 'dualtor_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
231+ condition : and(not(canceled()), succeeded(), contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 'dualtor_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
220232 timeoutInMinutes : ${{ parameters.TIMEOUT_IN_MINUTES_PR_TEST }}
221233 continueOnError : false
222234 pool : ${{ parameters.AGENT_POOL }}
@@ -255,10 +267,11 @@ jobs:
255267 displayName : " impacted-area-kvmtest-t0-sonic by Elastictest"
256268 dependsOn :
257269 - get_impacted_area
270+ - cancel_previous_test_plan_for_same_pr
258271 variables :
259272 TEST_SCRIPTS : $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
260273 RUN_BY_INCLUDE_JOBS : ${{ or(eq(parameters.INCLUDE_JOBS, 'all'), contains(parameters.INCLUDE_JOBS, 't0_sonic_job')) }}
261- condition : and(contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0-sonic_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
274+ condition : and(not(canceled()), succeeded(), contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0-sonic_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
262275 timeoutInMinutes : ${{ parameters.TIMEOUT_IN_MINUTES_PR_TEST }}
263276 continueOnError : false
264277 pool : ${{ parameters.AGENT_POOL }}
@@ -302,10 +315,11 @@ jobs:
302315 displayName : " impacted-area-kvmtest-dpu by Elastictest"
303316 dependsOn :
304317 - get_impacted_area
318+ - cancel_previous_test_plan_for_same_pr
305319 variables :
306320 TEST_SCRIPTS : $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
307321 RUN_BY_INCLUDE_JOBS : ${{ or(eq(parameters.INCLUDE_JOBS, 'all'), contains(parameters.INCLUDE_JOBS, 'dpu_job')) }}
308- condition : and(contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 'dpu_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
322+ condition : and(not(canceled()), succeeded(), contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 'dpu_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
309323 timeoutInMinutes : ${{ parameters.TIMEOUT_IN_MINUTES_PR_TEST }}
310324 continueOnError : false
311325 pool : ${{ parameters.AGENT_POOL }}
@@ -348,10 +362,11 @@ jobs:
348362 displayName : " impacted-area-kvmtest-multi-asic-t1 by Elastictest"
349363 dependsOn :
350364 - get_impacted_area
365+ - cancel_previous_test_plan_for_same_pr
351366 variables :
352367 TEST_SCRIPTS : $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
353368 RUN_BY_INCLUDE_JOBS : ${{ or(eq(parameters.INCLUDE_JOBS, 'all'), contains(parameters.INCLUDE_JOBS, 't1_multi_asic_job')) }}
354- condition : and(contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
369+ condition : and(not(canceled()), succeeded(), contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
355370 timeoutInMinutes : ${{ parameters.TIMEOUT_IN_MINUTES_PR_TEST }}
356371 continueOnError : false
357372 pool : ${{ parameters.AGENT_POOL }}
@@ -391,10 +406,11 @@ jobs:
391406 displayName : " impacted-area-kvmtest-t2 by Elastictest"
392407 dependsOn :
393408 - get_impacted_area
409+ - cancel_previous_test_plan_for_same_pr
394410 variables :
395411 TEST_SCRIPTS : $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
396412 RUN_BY_INCLUDE_JOBS : ${{ or(eq(parameters.INCLUDE_JOBS, 'all'), contains(parameters.INCLUDE_JOBS, 't2_job')) }}
397- condition : and(contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't2_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
413+ condition : and(not(canceled()), succeeded(), not(canceled()), succeeded(), contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't2_checker'), eq(variables['RUN_BY_INCLUDE_JOBS'], 'True'))
398414 timeoutInMinutes : ${{ parameters.TIMEOUT_IN_MINUTES_PR_TEST }}
399415 continueOnError : false
400416 pool : ${{ parameters.AGENT_POOL }}
@@ -432,6 +448,9 @@ jobs:
432448
433449# - job: t1_lag_vpp_elastictest
434450# displayName: "kvmtest-t1-lag-vpp by Elastictest [OPTIONAL]"
451+ # dependsOn:
452+ # - get_impacted_area
453+ # - cancel_previous_test_plan_for_same_pr
435454# timeoutInMinutes: ${{ parameters.TIMEOUT_IN_MINUTES_PR_TEST }}
436455# continueOnError: true
437456# pool: ${{ parameters.AGENT_POOL }}
0 commit comments