-
Notifications
You must be signed in to change notification settings - Fork 212
505 lines (492 loc) · 19.5 KB
/
pull-request-management.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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
---
name: "Collection code testing"
on: pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
env:
# Set -vvv is ACTIONS_STEP_DEBUG is set
# Apparently it is set in secrets when running with debug
ANSIBLE_VERBOSITY: ${{ secrets.ACTIONS_STEP_DEBUG && 3 || 0 }}
jobs:
file-changes:
runs-on: ubuntu-latest
outputs:
eos_design: ${{ steps.filter.outputs.eos_design }}
config_gen: ${{ steps.filter.outputs.config_gen }}
cloudvision: ${{ steps.filter.outputs.cloudvision }}
dhcp: ${{ steps.filter.outputs.dhcp }}
plugins: ${{ steps.filter.outputs.plugins }}
requirements: ${{ steps.filter.outputs.requirements }}
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
eos_design:
- 'ansible_collections/arista/avd/roles/eos_designs/*'
- 'ansible_collections/arista/avd/roles/eos_designs/**/*'
- '.github/workflows/pull-request-management.yml'
- 'ansible_collections/arista/avd/molecule/*'
- 'ansible_collections/arista/avd/molecule/**/*'
- 'python-avd/pyavd/_eos_designs/*'
- 'python-avd/pyavd/_eos_designs/**/*'
- '!ansible_collections/arista/avd/roles/eos_config_deploy_cvp/*'
- '!ansible_collections/arista/avd/roles/eos_config_deploy_cvp/**/*'
- '!ansible_collections/arista/avd/molecule/cvp_configlet_upload/*'
- '!ansible_collections/arista/avd/molecule/cvp_configlet_upload/**/*'
config_gen:
- 'ansible_collections/arista/avd/roles/eos_cli_config_gen/*'
- 'ansible_collections/arista/avd/roles/eos_cli_config_gen/**/*'
- '.github/workflows/pull-request-management.yml'
- 'ansible_collections/arista/avd/molecule/eos_cli_config_gen*/*'
- 'ansible_collections/arista/avd/molecule/eos_cli_config_gen*/**/*'
- 'python-avd/pyavd/_eos_cli_config_gen/*'
- 'python-avd/pyavd/_eos_cli_config_gen/**/*'
validate_state:
- 'ansible_collections/arista/avd/roles/eos_validate_state/*'
- 'ansible_collections/arista/avd/roles/eos_validate_state/**/*'
cloudvision:
- 'ansible_collections/arista/avd/roles/eos_config_deploy_cvp/*'
- 'ansible_collections/arista/avd/roles/eos_config_deploy_cvp/**/*'
- 'ansible_collections/arista/avd/molecule/cvp_configlet_upload/*'
- 'ansible_collections/arista/avd/molecule/cvp_configlet_upload/**/*'
- '.github/workflows/pull-request-management.yml'
dhcp:
- 'ansible_collections/arista/avd/roles/dhcp_provisioner/*'
- 'ansible_collections/arista/avd/roles/dhcp_provisioner/**/*'
- '.github/workflows/pull-request-management.yml'
plugins:
- 'ansible_collections/arista/avd/plugins/filter/**'
- 'ansible_collections/arista/avd/plugins/test/**'
requirements:
- 'ansible_collections/arista/avd/requirements.txt'
- 'ansible_collections/arista/avd/requirements-dev.txt'
- 'ansible_collections/arista/avd/meta/runtime.yml'
- '.github/requirements-ci.txt'
- '.github/workflows/pull-request-management.yml'
docs:
- '.github/workflows/pull-request-management.yml'
- 'mkdocs.yml'
- 'ansible_collections/arista/avd/docs/**'
- 'ansible_collections/arista/avd/roles/**/*.md'
- 'ansible_collections/arista/avd/**/*.md'
- 'ansible_collections/arista/avd/README.md'
- 'ansible_collections/arista/avd/**/*.schema.yml'
pyavd:
- 'python_avd/*'
- 'python_avd/**/*'
# ----------------------------------- #
# Test Requirements
# ----------------------------------- #
python_requirements:
name: Test Python requirements installation
runs-on: ubuntu-latest
needs: [ file-changes ]
if: needs.file-changes.outputs.requirements == 'true'
strategy:
fail-fast: true
matrix:
python_version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: 'Install Python requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements-dev.txt -r ansible_collections/arista/avd/requirements.txt --upgrade
# ----------------------------------- #
# EOS CLI CONFIG GEN MOLECULE
# ----------------------------------- #
molecule_eos_cli_config_gen:
name: Validate eos_cli_config_gen
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_cli_config_gen'
- 'eos_cli_config_gen_deprecated_vars'
- 'eos_cli_config_gen_negative_unit_tests'
ansible_version:
- 'ansible-core<2.18.0 --upgrade'
# Also test minimum ansible version for one scenario.
include:
- avd_scenario: 'eos_cli_config_gen'
ansible_version: 'ansible-core==2.15.0'
needs: [ file-changes ]
if: needs.file-changes.outputs.config_gen == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/[email protected]
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: .github/requirements-ci.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v4
# with:
# name: molecule-${{ matrix.avd_scenario }}-artifacts
# path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }}
# ----------------------------------- #
# DHCP PROVISIONNER MOLECULE
# ----------------------------------- #
molecule_dhcp_provisionner:
name: Validate DHCP configuration
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario: ['dhcp_configuration', 'dhcp_provisioning']
ansible_version: ['ansible-core<2.18.0 --upgrade']
needs: [ file-changes ]
if: needs.file-changes.outputs.dhcp == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/[email protected]
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: .github/requirements-ci.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v4
# with:
# name: molecule-${{ matrix.avd_scenario }}-artifacts
# path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }}
# ----------------------------------- #
# EOS Design MOLECULE
# ----------------------------------- #
molecule_eos_designs:
name: Validate eos_designs
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_designs_deprecated_vars'
- 'eos_designs-l2ls'
- 'eos_designs-mpls-isis-sr-ldp'
- 'eos_designs_negative_unit_tests'
- 'eos_designs-twodc-5stage-clos'
- 'eos_designs_unit_tests'
- 'evpn_underlay_ebgp_overlay_ebgp'
- 'evpn_underlay_isis_overlay_ibgp'
- 'evpn_underlay_ospf_overlay_ebgp'
- 'evpn_underlay_rfc5549_overlay_ebgp'
- 'example-campus-fabric'
- 'example-dual-dc-l3ls'
- 'example-isis-ldp-ipvpn'
- 'example-l2ls-fabric'
- 'example-single-dc-l3ls'
- 'example-cv-pathfinder'
ansible_version:
# Testing all scenario with 2.16.x, due to bug with in 2.17.0 with and the way we test eos_designs_negative_unit_tests https://github.com/ansible/ansible/issues/83292
- 'ansible-core>=2.16.0,<2.17.0 --upgrade'
pip_requirements:
- '.github/requirements-ci.txt'
# Also test minimum ansible version for one scenario.
include:
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core==2.15.0'
pip_requirements: 'tmp-requirements-minimum.txt'
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core>=2.15.0,<2.16.0 --upgrade'
pip_requirements: '.github/requirements-ci.txt'
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core<2.18.0 --upgrade'
pip_requirements: '.github/requirements-ci.txt'
needs: [ file-changes ]
if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Build minimum requirements
run: |
pip install uv
uv pip compile .github/requirements-ci.txt --resolution=lowest-direct > ${{ matrix.pip_requirements }}
cat ${{ matrix.pip_requirements }}
if: matrix.pip_requirements == 'tmp-requirements-minimum.txt'
- name: Run molecule action
uses: arista-netdevops-community/[email protected]
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: ${{ matrix.pip_requirements }}
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v4
# with:
# name: molecule-${{ matrix.avd_scenario }}-artifacts
# path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }}
# ----------------------------------- #
# Cloudvision MOLECULE
# ----------------------------------- #
molecule_cloudvision:
name: Validate cvp_collection
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_config_deploy_cvp'
ansible_version:
- 'ansible-core<2.18.0 --upgrade'
include:
- avd_scenario: 'eos_config_deploy_cvp'
ansible_version: 'ansible-core==2.15.0'
needs: [ file-changes ]
if: needs.file-changes.outputs.cloudvision == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/[email protected]
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: .github/requirements-ci.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v4
# with:
# name: molecule-${{ matrix.avd_scenario }}-artifacts
# path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }}
#
# ----------------------------------- #
# EOS Validate State MOLECULE
# ----------------------------------- #
molecule_eos_validate_state:
name: Validate eos_validate_state
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_validate_state'
ansible_version:
- 'ansible-core<2.18.0 --upgrade'
include:
- avd_scenario: 'eos_validate_state'
ansible_version: 'ansible-core==2.15.0'
needs: [ file-changes ]
if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.validate_state == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/[email protected]
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: .github/requirements-ci.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# ----------------------------------- #
# Ansible tests
# ----------------------------------- #
ansible_test_sanity:
name: Run ansible-test sanity validation
runs-on: ubuntu-latest
needs: [ file-changes ]
# needs: [ molecule_eos_designs, molecule_cloudvision ]
# if: needs.cloudvision.status != 'failed' && needs.molecule_eos_designs.status != 'failed' && needs.file-changes.outputs.plugins == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12
# 3.13 - Still waiting for support in ansible-test
- name: 'Install Python requirements'
run: |
pip install "ansible-core<2.18.0" -r .github/requirements-ci.txt --upgrade
- name: 'Run ansible-test sanity'
run: |
cd ansible_collections/arista/avd/
ansible-test sanity --color yes -v
ansible_test_units:
name: Run ansible-test units test cases
runs-on: ubuntu-latest
needs: [ file-changes ]
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: |
3.10
- name: 'Install Python requirements'
run: |
pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.18.0" -r .github/requirements-ci.txt --upgrade
- name: 'Run ansible-test units test cases'
run: |
cd ansible_collections/arista/avd/
ansible-test units -vv
ansible_test_integration:
name: Run ansible-test integration test cases
runs-on: ubuntu-latest
needs: [ file-changes ]
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: |
3.12
# 3.13 - Still waiting for support in ansible-test
- name: 'Install Python requirements'
run: |
pip install "ansible-core<2.18.0" -r .github/requirements-ci.txt --upgrade
- name: 'Run ansible-test integration test cases'
run: |
cd ansible_collections/arista/avd/
ansible-test integration -vv
ansible_lint:
name: Run ansible-lint test case
runs-on: ubuntu-latest
needs: [ file-changes ]
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12
3.13
- name: 'Install Python & Ansible requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements-dev.txt -r ansible_collections/arista/avd/requirements.txt --upgrade
ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml
- name: 'Run ansible-test integration test cases'
run: |
cd ansible_collections/arista/avd/
ansible-lint --force-color --strict -v
# ----------------------------------- #
# Galaxy Importer
# ----------------------------------- #
galaxy_importer:
name: Test galaxy-importer
runs-on: ubuntu-20.04 # Older version to be compatible with old python
env:
PY_COLORS: 1 # allows molecule colors to be passed to GitHub Actions
ANSIBLE_FORCE_COLOR: 1 # allows ansible colors to be passed to GitHub Actions
GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg
steps:
- uses: actions/setup-python@v5
with:
python-version: |
3.10
- uses: actions/checkout@v4
- name: 'Install Python & Ansible requirements'
run: |
pip install "ansible-core<2.18.0" -r .github/requirements-ci.txt --upgrade
ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml
- name: Install galaxy-importer
# Install the specific version of galaxy-importer used on galaxy.ansible.com
# The version conflicts with our requirements,
# so we let the galaxy-importer version resolve remaining requirements.
run: |
pip install "galaxy-importer==0.4.25"
- name: 'Build ansible package'
run: make collection-build
- name: 'Run galaxy-importer checks'
run: python -m galaxy_importer.main *.tar.gz
- uses: actions/upload-artifact@v4
with:
name: importer-logs
path: ./importer_result.json
# ----------------------------------- #
# Test of pyavd
# ----------------------------------- #
pyavd:
name: Test pyavd
runs-on: ubuntu-latest
needs: [file-changes]
if: |
needs.file-changes.outputs.eos_design == 'true' ||
needs.file-changes.outputs.config_gen == 'true' ||
needs.file-changes.outputs.pyavd == 'true'
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: 'Install tox'
run: |
pip install tox tox-gh-actions --upgrade
- name: "Run pytest via tox for ${{ matrix.python }}"
working-directory: python-avd
run: |
tox