forked from aristanetworks/avd
-
Notifications
You must be signed in to change notification settings - Fork 0
439 lines (428 loc) · 17.6 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
---
name: "Collection code testing"
on:
# For a pull_request event, only branches and tags on the base are evaluated.
pull_request:
branches-ignore:
- releases/**
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
file-changes:
runs-on: ubuntu-20.04
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@v3
- uses: dorny/paths-filter@v2
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/**/*'
- '!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/**/*'
- 'ansible_collections/arista/avd/molecule/upgrade_eos_cli_config_gen/*'
- 'ansible_collections/arista/avd/molecule/upgrade_eos_cli_config_gen/**/*'
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/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'
# ----------------------------------- #
# Pre Commit code validation
# ----------------------------------- #
pre_commit:
name: Run pre-commit validation hooks
runs-on: ubuntu-20.04
container: avdteam/base:3.8-v2.0
needs: file-changes
if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true' || needs.file-changes.outputs.requirements == 'true'
steps:
- uses: actions/checkout@v3
- name: Install requirements
run: |
pip install -r ansible_collections/arista/avd/requirements-dev.txt
pip install -r ansible_collections/arista/avd/requirements.txt
- name: Run pre-commit
run: |
pre-commit run --all-files --color always
# ----------------------------------- #
# Check Links offline for dead target
# ----------------------------------- #
offline_link_check:
name: 'Validate mkdoc content'
runs-on: ubuntu-20.04
needs: [ file-changes ]
if: needs.file-changes.outputs.docs == 'true'
steps:
- uses: actions/checkout@v3
- name: 'start docker-compose stack'
run: |
cp development/docker-compose.yml .
sed -i 's/cd\sansible-avd\/\s\&\&//g' docker-compose.yml
docker-compose -f docker-compose.yml up -d webdoc_avd
docker-compose -f docker-compose.yml ps
- name: 'test connectivity to mkdoc server'
run: |
until docker exec webdoc_avd curl -s -I http://localhost:8000/ ; do sleep 2; done
- name: check links for 404
run: |
docker run --network container:webdoc_avd raviqqe/muffet:2.6.1 http://127.0.0.1:8000/ -e ".*fonts.googleapis.com.*" -e ".*fonts.gstatic.com.*" -e ".*tools.ietf.org.*" -e ".*edit.*" -e ".*docs.github.com.*" -f --max-redirections=3 --timeout=30 --rate-limit=1
- name: 'stop docker-compose stack'
run: |
docker-compose -f docker-compose.yml down
# -------------------------------- #
# Verify role documentation
# -------------------------------- #
verify_role_documentation:
name: Verify role documentation
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
avd_scenario: ['build_schemas_and_docs']
ansible_version: ['ansible-core>=2.11.3,<2.13.0']
needs: [ pre_commit ]
if: needs.file-changes.outputs.docs == 'true'
steps:
- name: 'set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.3
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: ansible_collections/arista/avd/requirements.txt
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# ----------------------------------- #
# Test Requirements
# ----------------------------------- #
python_requirements:
name: Test Python requirements installation
runs-on: ubuntu-20.04
needs: [ pre_commit ]
if: needs.file-changes.outputs.requirements == 'true'
strategy:
fail-fast: true
matrix:
python_version: [ "3.8", "3.9", "3.10" ]
steps:
- name: 'set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: 'Install Python requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements.txt
pip install -r ansible_collections/arista/avd/requirements-dev.txt
# ----------------------------------- #
# EOS CLI CONFIG GEN MOLECULE
# ----------------------------------- #
molecule_eos_cli_config_gen:
name: Validate eos_cli_config_gen
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_cli_config_gen'
- 'upgrade_eos_cli_config_gen'
- 'eos_cli_config_gen_v4.0'
ansible_version:
- 'ansible-core>=2.11.3,<2.13.0'
# Also test minimum ansible version for one scenario.
include:
- avd_scenario: 'eos_cli_config_gen'
ansible_version: 'ansible-core==2.11.3'
needs: [ pre_commit ]
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@v3
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.3
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: ansible_collections/arista/avd/requirements.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v3
# 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-20.04
strategy:
fail-fast: true
matrix:
avd_scenario: ['dhcp_configuration', 'dhcp_provisionning']
ansible_version: ['ansible-core>=2.11.3,<2.13.0']
needs: [ pre_commit ]
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@v3
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.3
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: ansible_collections/arista/avd/requirements.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v3
# 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-20.04
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_designs_unit_tests'
- 'eos_designs_unit_tests_v4.0'
- 'evpn_underlay_ebgp_overlay_ebgp'
- 'evpn_underlay_ospf_overlay_ebgp'
- 'evpn_underlay_isis_overlay_ibgp'
- 'eos_designs-twodc-5stage-clos'
- 'evpn_underlay_rfc5549_overlay_ebgp'
- 'eos_designs-l2ls'
- 'eos_designs-mpls-isis-sr-ldp'
- 'upgrade_v2.x_to_v3.0_evpn_underlay_ebgp_overlay_ebgp'
- 'upgrade_v2.x_to_v3.0_evpn_underlay_ospf_overlay_ebgp'
- 'upgrade_v2.x_to_v3.0_evpn_underlay_isis_overlay_ibgp'
- 'upgrade_v2.x_to_v3.0_eos_designs-twodc-5stage-clos'
- 'upgrade_v2.x_to_v3.0_evpn_underlay_rfc5549_overlay_ebgp'
ansible_version:
- 'ansible-core>=2.11.3,<2.13.0'
# Also test minimum ansible version for one scenario.
include:
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core==2.11.3'
needs: [ pre_commit ]
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@v3
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.3
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: ansible_collections/arista/avd/requirements.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v3
# 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-20.04
strategy:
fail-fast: true
matrix:
avd_scenario: ['eos_config_deploy_cvp']
ansible_version: ['ansible-core==2.11.3', 'ansible-core>=2.11.3,<2.13.0']
needs: [ pre_commit ]
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@v3
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.3
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: ansible_collections/arista/avd/requirements.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v3
# with:
# name: molecule-${{ matrix.avd_scenario }}-artifacts
# path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }}
# ----------------------------------- #
# Ansible tests
# ----------------------------------- #
ansible_test_sanity:
name: Run ansible-test sanity validation
runs-on: ubuntu-20.04
needs: [ pre_commit ]
#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@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: 'Install Python requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements.txt
pip install -r ansible_collections/arista/avd/requirements-dev.txt
- name: 'run ansible-test sanity'
run: |
cd ansible_collections/arista/avd/
ansible-test sanity --color yes -v --requirements --docker
ansible_test_units:
name: Run ansible-test units test cases
runs-on: ubuntu-20.04
needs: [ pre_commit ]
steps:
- name: 'set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: 'Install Python requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements.txt
pip install -r ansible_collections/arista/avd/requirements-dev.txt
- name: 'run ansible-test units test cases'
run: |
cd ansible_collections/arista/avd/
ansible-test units --requirements --docker -vv
ansible_test_integration:
name: Run ansible-test integration test cases
runs-on: ubuntu-20.04
needs: [ pre_commit ]
steps:
- name: 'set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: 'Install Python requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements.txt
pip install -r ansible_collections/arista/avd/requirements-dev.txt
- name: 'run ansible-test integration test cases'
run: |
cd ansible_collections/arista/avd/
ansible-test integration --requirements --docker -vv
# ----------------------------------- #
# Galaxy Importer
# ----------------------------------- #
galaxy_importer:
name: Test galaxy-importer
runs-on: ubuntu-latest
container: avdteam/base:3.8-v2.0
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
steps:
- name: 'set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: install requirements
run: |
pip install -r ansible_collections/arista/avd/requirements.txt
pip install -r ansible_collections/arista/avd/requirements-dev.txt
- 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@v3
with:
name: importer-logs
path: ./importer_result.json