forked from sonic-net/sonic-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
341 lines (314 loc) · 12.4 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
# For every job:
# continueOnError: false means it's a required test job and will block merge if it fails
# continueOnError: true means it's an optional test job and will not block merge even though it fails(unless a required test job depends on its result)
pr:
branches:
include:
- master
paths:
exclude:
- .github
- docs
- LICENSE
- README.md
- SECURITY.md
trigger: none
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
stages:
- stage: Pre_test
jobs:
- job: static_analysis
displayName: "Static Analysis"
timeoutInMinutes: 10
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/pre-commit-check.yml
- job: validate_test_cases
displayName: "Validate Test Cases"
timeoutInMinutes: 30
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/pytest-collect-only.yml
parameters:
MGMT_BRANCH: ""
- job: dependency_check
displayName: "Dependency Check"
timeoutInMinutes: 10
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/dependency-check.yml
- job: markers_check
displayName: "Markers Check"
timeoutInMinutes: 10
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/markers-check.yml
- stage: Test
dependsOn: Pre_test
condition: and(succeeded(), in(dependencies.Pre_test.result, 'Succeeded'))
variables:
- group: SONiC-Elastictest
- name: inventory
value: veos_vtb
- name: testbed_file
value: vtestbed.yaml
- name: BUILD_BRANCH
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
value: $(System.PullRequest.TargetBranch)
${{ else }}:
value: $(Build.SourceBranchName)
jobs:
# Below are Impacted Area Based PR checkers
- job: get_impacted_area
displayName: "Get impacted area"
timeoutInMinutes: 240
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/get-impacted-area.yml
- job: choose_between_mixed_and_py3_ptf_image
displayName: "Choose between latest (mixed type) and py3 ptf image"
timeoutInMinutes: 10
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- script: |
python - <<EOF
import random
tag = 'latest'
if random.random() < 0.3:
tag = 'py3only'
print(f"##vso[task.setvariable variable=tag_value;isOutput=true]{tag}")
EOF
name: ptf_image_tag
displayName: "Selecting PTF_IMAGE_TAG"
- script: |
echo "Chosen PTF_IMAGE_TAG: $(ptf_image_tag.tag_value)"
displayName: "PTF_IMAGE_TAG value"
- job: impacted_area_t0_elastictest
displayName: "impacted-area-kvmtest-t0 by Elastictest"
dependsOn:
- get_impacted_area
- choose_between_mixed_and_py3_ptf_image
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
set_ptf_image_tag: $[ dependencies.choose_between_mixed_and_py3_ptf_image.outputs['ptf_image_tag.tag_value'] ]
timeoutInMinutes: 240
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t0
BUILD_BRANCH: $(BUILD_BRANCH)
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t0
PTF_IMAGE_TAG: $(set_ptf_image_tag)
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
- job: impacted_area_t0_2vlans_elastictest
displayName: "impacted-area-kvmtest-t0_2vlans by Elastictest"
dependsOn:
- get_impacted_area
- choose_between_mixed_and_py3_ptf_image
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0-2vlans_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
set_ptf_image_tag: $[ dependencies.choose_between_mixed_and_py3_ptf_image.outputs['ptf_image_tag.tag_value'] ]
timeoutInMinutes: 240
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t0-2vlans
BUILD_BRANCH: $(BUILD_BRANCH)
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t0
PTF_IMAGE_TAG: $(set_ptf_image_tag)
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a"
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
- job: impacted_area_t1_lag_elastictest
displayName: "impacted-area-kvmtest-t1-lag by Elastictest"
dependsOn:
- get_impacted_area
- choose_between_mixed_and_py3_ptf_image
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
set_ptf_image_tag: $[ dependencies.choose_between_mixed_and_py3_ptf_image.outputs['ptf_image_tag.tag_value'] ]
timeoutInMinutes: 240
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t1
BUILD_BRANCH: $(BUILD_BRANCH)
# 50 mins for preparing testbed, 30 mins for pre-test and post-test
PREPARE_TIME: 80
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t1-lag
PTF_IMAGE_TAG: $(set_ptf_image_tag)
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
- job: impacted_area_dualtor_elastictest
displayName: "impacted-area-kvmtest-dualtor by Elastictest"
dependsOn:
- get_impacted_area
- choose_between_mixed_and_py3_ptf_image
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 'dualtor_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
set_ptf_image_tag: $[ dependencies.choose_between_mixed_and_py3_ptf_image.outputs['ptf_image_tag.tag_value'] ]
timeoutInMinutes: 240
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: dualtor
BUILD_BRANCH: $(BUILD_BRANCH)
# 30 mins for preparing testbed, 30 mins for pre-test and 20 mins for post-test
PREPARE_TIME: 80
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: dualtor
PTF_IMAGE_TAG: $(set_ptf_image_tag)
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
COMMON_EXTRA_PARAMS: "--disable_loganalyzer "
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
- job: impacted_area_multi_asic_elastictest
displayName: "impacted-area-kvmtest-multi_asic by Elastictest"
dependsOn:
- get_impacted_area
- choose_between_mixed_and_py3_ptf_image
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1-multi-asic_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
set_ptf_image_tag: $[ dependencies.choose_between_mixed_and_py3_ptf_image.outputs['ptf_image_tag.tag_value'] ]
timeoutInMinutes: 240
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t1-multi-asic
BUILD_BRANCH: $(BUILD_BRANCH)
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t1-8-lag
PTF_IMAGE_TAG: $(set_ptf_image_tag)
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
NUM_ASIC: 4
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
- job: impacted_area_sonic_t0_elastictest
displayName: "impacted-area-kvmtest-sonic_t0 by Elastictest"
dependsOn:
- get_impacted_area
- choose_between_mixed_and_py3_ptf_image
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0-sonic_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
set_ptf_image_tag: $[ dependencies.choose_between_mixed_and_py3_ptf_image.outputs['ptf_image_tag.tag_value'] ]
timeoutInMinutes: 240
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t0-sonic
BUILD_BRANCH: $(BUILD_BRANCH)
PREPARE_TIME: 40
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t0-64-32
PTF_IMAGE_TAG: $(set_ptf_image_tag)
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
COMMON_EXTRA_PARAMS: "--neighbor_type=sonic "
VM_TYPE: vsonic
MGMT_BRANCH: "master"
- job: impacted_area_dpu_elastictest
displayName: "impacted-area-kvmtest-dpu by Elastictest"
dependsOn:
- get_impacted_area
- choose_between_mixed_and_py3_ptf_image
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 'dpu_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
set_ptf_image_tag: $[ dependencies.choose_between_mixed_and_py3_ptf_image.outputs['ptf_image_tag.tag_value'] ]
timeoutInMinutes: 240
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: dpu
BUILD_BRANCH: $(BUILD_BRANCH)
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: dpu
PTF_IMAGE_TAG: $(set_ptf_image_tag)
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
# This PR checker aims to run all t1 test scripts on multi-asic topology.
- job: impacted_area_multi_asic_t1_elastictest
displayName: "impacted-area-kvmtest-multi_asic_t1 by Elastictest - optional"
dependsOn:
- get_impacted_area
- choose_between_mixed_and_py3_ptf_image
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1_checker')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
set_ptf_image_tag: $[ dependencies.choose_between_mixed_and_py3_ptf_image.outputs['ptf_image_tag.tag_value'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t1
BUILD_BRANCH: $(BUILD_BRANCH)
- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t1-8-lag
PTF_IMAGE_TAG: $(set_ptf_image_tag)
STOP_ON_FAILURE: "False"
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
NUM_ASIC: 4
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"