Skip to content

Fix(eos_config_deploy_cvp): share tags from parent to dependent tasks. #8693

Fix(eos_config_deploy_cvp): share tags from parent to dependent tasks.

Fix(eos_config_deploy_cvp): share tags from parent to dependent tasks. #8693

---
name: "Collection code testing"
on: pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
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@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*/**/*'
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/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/**/*'
# ----------------------------------- #
# Pre Commit code validation
# ----------------------------------- #
pre_commit:
name: Run pre-commit validation hooks
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.requirements == 'true'
steps:
- uses: actions/checkout@v3
- name: Install requirements
run: |
pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade
pip install -r ansible_collections/arista/avd/requirements.txt --upgrade
- 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-latest
needs: [ file-changes ]
if: needs.file-changes.outputs.docs == 'true'
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: 'Start docker-compose stack'
run: |
docker-compose -f development/docker-compose.yml up -d webdoc_avd
docker-compose -f development/docker-compose.yml ps
- name: 'Test connectivity to mkdoc server'
run: |
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' 127.0.0.1:8000)" != "200" ]]; do sleep 5; done'
- name: Check links for 404
run: |
docker run --network container:webdoc_avd raviqqe/muffet:2.9.2 http://127.0.0.1:8000/ -e ".*fonts.googleapis.com.*" -e ".*fonts.gstatic.com.*" -e ".*tools.ietf.org.*" -e ".*edit.*" -e ".*docs.github.com.*" -e "twitter.com" -e "www.docker.com" -f --max-redirections=3 --timeout=30 --rate-limit=1 --buffer-size 8192
- name: 'Stop docker-compose stack'
run: |
docker-compose -f development/docker-compose.yml down
# ----------------------------------- #
# Test Requirements
# ----------------------------------- #
python_requirements:
name: Test Python requirements installation
runs-on: ubuntu-latest
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 --upgrade
pip install -r ansible_collections/arista/avd/requirements-dev.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.16.0 --upgrade'
# Also test minimum ansible version for one scenario.
include:
- avd_scenario: 'eos_cli_config_gen'
ansible_version: 'ansible-core==2.12.6'
galaxy_server: 'https://old-galaxy.ansible.com'
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
- name: 'Set galaxy server'
if: ${{ matrix.galaxy_server }}
run: |
echo "ANSIBLE_GALAXY_SERVER=${{ matrix.galaxy_server }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.6
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-latest
strategy:
fail-fast: true
matrix:
avd_scenario: ['dhcp_configuration', 'dhcp_provisioning']
ansible_version: ['ansible-core<2.16.0 --upgrade']
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.6
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-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_designs_unit_tests'
- 'eos_designs_negative_unit_tests'
- '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'
- 'example-campus-fabric'
- 'example-l2ls-fabric'
- 'example-single-dc-l3ls'
- 'example-dual-dc-l3ls'
ansible_version:
- 'ansible-core<2.16.0 --upgrade'
# Also test minimum ansible version for one scenario.
include:
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core==2.12.6'
galaxy_server: 'https://old-galaxy.ansible.com'
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core>=2.13.1,<2.14.0 --upgrade'
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core>=2.14.0,<2.15.0 --upgrade'
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
- name: 'Set galaxy server'
if: ${{ matrix.galaxy_server }}
run: |
echo "ANSIBLE_GALAXY_SERVER=${{ matrix.galaxy_server }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.6
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-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_config_deploy_cvp'
ansible_version:
- 'ansible-core<2.16.0 --upgrade'
include:
- avd_scenario: 'eos_config_deploy_cvp'
ansible_version: 'ansible-core==2.12.6'
galaxy_server: 'https://old-galaxy.ansible.com'
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
- name: 'Set galaxy server'
if: ${{ matrix.galaxy_server }}
run: |
echo "ANSIBLE_GALAXY_SERVER=${{ matrix.galaxy_server }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.6
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 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.16.0 --upgrade'
include:
- avd_scenario: 'eos_validate_state'
ansible_version: 'ansible-core==2.12.6'
galaxy_server: 'https://old-galaxy.ansible.com'
needs: [ pre_commit ]
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
- name: 'Set galaxy server'
if: ${{ matrix.galaxy_server }}
run: |
echo "ANSIBLE_GALAXY_SERVER=${{ matrix.galaxy_server }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.6
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
# Temporarily using special requirements to install anta while the feature is in preview.
pip_file: ansible_collections/arista/avd/roles/eos_validate_state/preview_requirements.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: [ 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.10"
- name: 'Install Python requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements.txt --upgrade
pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade
- 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-latest
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.10"
- name: 'Install Python requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements.txt --upgrade
pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade
- 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-latest
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.10"
- name: 'Install Python requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements.txt --upgrade
pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade
- name: 'Run ansible-test integration test cases'
run: |
cd ansible_collections/arista/avd/
ansible-test integration --requirements --docker -vv
ansible_lint:
name: Run ansible-lint test case
runs-on: ubuntu-latest
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.10"
- name: 'Install Python & Ansible requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements.txt --upgrade
pip install -r ansible_collections/arista/avd/requirements-dev.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@v4
with:
python-version: 3.6 # Ancient version to match galaxy.ansible.com.
- uses: actions/checkout@v3
- name: Install requirements
# Install the specific version of galaxy-importer used on galaxy.ansible.com
# The old version conflicts with our versions of other tooling,
# so we let the galaxy-importer version resolve remaining requirements.
run: |
pip install "galaxy-importer==0.4.0.post1"
- 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
# ----------------------------------- #
# Test of pyavd
# ----------------------------------- #
pyavd:
name: Test pyavd
runs-on: ubuntu-latest
needs: [ pre_commit ]
if: |
needs.file-changes.outputs.eos_design == 'true' ||
needs.file-changes.outputs.config_gen == 'true' ||
needs.file-changes.outputs.pyavd == '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.10
3.11
- name: 'Install tox'
run: |
pip install tox --upgrade
- name: 'Run tox'
working-directory: python-avd
run: |
tox