From 5e03e06cec68445ee214669a81c5942384e9e04c Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 18 Mar 2025 13:02:21 +0530 Subject: [PATCH 1/7] aritfacts --- .github/molecule-runner.sh | 43 + .github/workflows/pull-request-management.yml | 1266 +++++++++-------- 2 files changed, 716 insertions(+), 593 deletions(-) create mode 100644 .github/molecule-runner.sh diff --git a/.github/molecule-runner.sh b/.github/molecule-runner.sh new file mode 100644 index 00000000000..e87dc8467cf --- /dev/null +++ b/.github/molecule-runner.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Purpose: Molecule runner for github-action +# Author: @titom73 +# Date: 2020-12-16 +# Version: 1.1 +# License: APACHE +# -------------------------------------- + +echo "Script running from ${PWD}" + +if [ ${INPUT_CHECK_GIT} = "true" ]; then + git config core.fileMode false + echo " * Run Git Verifier because CHECK_GIT is set to ${INPUT_CHECK_GIT}" + # if git diff-index --quiet HEAD --; then + GIT_STATUS="$(git status --porcelain)" + if [ "$?" -ne "0" ]; then + echo "'git status --porcelain' failed to run - something is wrong" + exit 1 + fi + if [ -n "$GIT_STATUS" ]; then + # Some changes + echo 'Some changes' + echo '------------' + git --no-pager status --short + echo '' + echo 'Diffs are:' + echo '------------' + git --no-pager diff + if [ ${INPUT_CHECK_GIT_ENFORCED} = "true" ]; then + exit 1 + else + exit 0 + fi + else + # No Changes + echo ' - No change found after running Molecule' + exit 0 + fi + exit 0 +else + echo " * Git verifier skipped as not set to true" +fi diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 7312fc9d811..fb8f5aa0ad6 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -1,594 +1,674 @@ --- -name: "Collection code testing" - -"on": - pull_request: - merge_group: - push: - branches: - - devel - -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 }} - AVD_NEVER_RUN_FROM_SOURCE: 1 - 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 - -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 }} - anta_runner: ${{ steps.filter.outputs.anta_runner }} - 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-dev.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/**/*' - anta_runner: - - 'ansible_collections/arista/avd/roles/anta_runner/*' - - 'ansible_collections/arista/avd/roles/anta_runner/**/*' - - 'python-avd/pyavd/_anta/*' - - 'python-avd/pyavd/_anta/**/*' - - 'python-avd/pyavd/api/_anta/*' - - 'python-avd/pyavd/api/_anta/**/*' - - 'python-avd/pyavd/get_device_anta_catalog.py' - - # ----------------------------------- # - # 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: - - 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 .github/requirements-ci-dev.txt -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.19.0 --upgrade" - # Also test minimum ansible version for one scenario. - include: - - avd_scenario: "eos_cli_config_gen" - ansible_version: "ansible-core==2.16.0" - needs: [file-changes] - if: needs.file-changes.outputs.config_gen == 'true' - steps: - - uses: actions/checkout@v4 - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: "ansible_collections/arista/avd" - molecule_command: "test" - molecule_args: "--scenario-name ${{ matrix.avd_scenario }}" - pip_file: .github/requirements-ci-dev.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.19.0 --upgrade"] - needs: [file-changes] - if: needs.file-changes.outputs.dhcp == 'true' - steps: - - uses: actions/checkout@v4 - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: "ansible_collections/arista/avd" - molecule_command: "test" - molecule_args: "--scenario-name ${{ matrix.avd_scenario }}" - pip_file: .github/requirements-ci-dev.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: - - "ansible_only" - - "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-dev.txt" - # Also test minimum ansible version for one scenario. - include: - - avd_scenario: "eos_designs_unit_tests" - ansible_version: "ansible-core==2.16.0 --upgrade" - pip_requirements: ".github/requirements-ci-dev.txt" - - avd_scenario: "eos_designs_unit_tests" - ansible_version: "ansible-core<2.18.0 --upgrade" - pip_requirements: ".github/requirements-ci-dev.txt" - - avd_scenario: "eos_designs_unit_tests" - ansible_version: "ansible-core<2.19.0 --upgrade" - pip_requirements: ".github/requirements-ci-dev.txt" - needs: [file-changes] - if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true' - steps: - - uses: actions/checkout@v4 - - name: Build minimum requirements - run: | - pip install uv - uv pip compile .github/requirements-ci-dev.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/action-molecule-avd@v1.8.1 - 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.19.0 --upgrade" - include: - - avd_scenario: "eos_config_deploy_cvp" - ansible_version: "ansible-core==2.16.0" - needs: [file-changes] - if: needs.file-changes.outputs.cloudvision == 'true' || needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true' - - steps: - - uses: actions/checkout@v4 - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: "ansible_collections/arista/avd" - molecule_command: "test" - molecule_args: "--scenario-name ${{ matrix.avd_scenario }}" - pip_file: .github/requirements-ci-dev.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 }} - # - # ----------------------------------- # - # ANTA Runner MOLECULE - # ----------------------------------- # - molecule_anta_runner: - name: Validate anta_runner - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - avd_scenario: - - 'anta_runner' - ansible_version: - - 'ansible-core<2.19.0 --upgrade' - include: - - avd_scenario: 'anta_runner' - ansible_version: 'ansible-core==2.16.0' - needs: [ file-changes ] - if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.anta_runner == 'true' - steps: - - uses: actions/checkout@v4 - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: 'ansible_collections/arista/avd' - molecule_command: 'test' - molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' - pip_file: .github/requirements-ci-dev.txt - galaxy_file: "ansible_collections/arista/avd/collections.yml" - ansible: ${{ matrix.ansible_version }} - check_git: true - check_git_enforced: true - - # ----------------------------------- # - # 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.19.0 --upgrade" - include: - - avd_scenario: "eos_validate_state" - ansible_version: "ansible-core==2.16.0" - needs: [file-changes] - if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.validate_state == 'true' - steps: - - uses: actions/checkout@v4 - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: "ansible_collections/arista/avd" - molecule_command: "test" - molecule_args: "--scenario-name ${{ matrix.avd_scenario }}" - pip_file: .github/requirements-ci-dev.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] - steps: - - 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 requirements" - run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci-dev.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: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: | - 3.12 - - name: "Install Python requirements" - run: | - pip install pyyaml "ansible-core<2.19.0" -r .github/requirements-ci-dev.txt --upgrade - - name: "Run ansible-test units test cases" - run: | - cd ansible_collections/arista/avd/ - ansible-test units --coverage --requirements -vv - ansible-test coverage xml - mv tests/output/reports/coverage.xml ./units-coverage.xml - - name: Upload coverage from ansible-test units - uses: actions/upload-artifact@v4 - with: - name: ansible-test-units-coverage - path: ansible_collections/arista/avd/units-coverage.xml - - ansible_test_integration: - name: Run ansible-test integration test cases - runs-on: ubuntu-latest - needs: [file-changes] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: | - 3.12 - 3.13 - - name: "Install Python requirements" - run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci-dev.txt --upgrade - - name: "Run ansible-test integration test cases" - run: | - cd ansible_collections/arista/avd/ - ansible-test integration --coverage --requirements -vv - ansible-test coverage xml - mv tests/output/reports/coverage.xml ./integration-coverage.xml - - name: Upload coverage from ansible-test integration - uses: actions/upload-artifact@v4 - with: - name: ansible-test-integration-coverage - path: ansible_collections/arista/avd/integration-coverage.xml - - # ----------------------------------- # - # Build Collection - # ----------------------------------- # - build_collection: - name: Build Ansible collection - runs-on: ubuntu-latest - steps: - - uses: actions/setup-python@v5 - with: - python-version: | - 3.12 - - uses: actions/checkout@v4 - - name: "Install Python & Ansible requirements" - run: | - # distlib is required when using manifest - pip install "ansible-core<2.19.0" distlib --upgrade - - name: "Build Ansible collection" - run: | - ansible-galaxy collection build -vvv --force ansible_collections/arista/avd - - name: Upload collection - uses: actions/upload-artifact@v4 - with: - name: avd-collection - path: ./arista-avd-*.tar.gz - - # ----------------------------------- # - # Galaxy Importer - # ----------------------------------- # - galaxy_importer: - name: Test galaxy-importer - runs-on: ubuntu-latest - needs: [build_collection] - steps: - - uses: actions/setup-python@v5 - with: - python-version: | - 3.11 - - uses: actions/checkout@v4 - - name: "Install Python & Ansible requirements" - run: | - pip install "ansible-core==2.16.0" - - name: Download collection - uses: actions/download-artifact@v4 - with: - name: avd-collection - - 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.26" - - 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 - - # ----------------------------------- # - # Ansible Lint - # Run on the built collection from Galaxy importer - # ----------------------------------- # - ansible_lint: - name: Run ansible-lint test case - runs-on: ubuntu-latest - needs: [build_collection] - env: - ANSIBLE_COLLECTIONS_PATH: /home/runner/work/avd/avd - steps: - - 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 .github/requirements-ci-dev.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - - name: Download collection - uses: actions/download-artifact@v4 - with: - name: avd-collection - - name: "Extract collection" - run: | - mkdir collections - tar xvzf arista-avd-*.tar.gz -C collections - - name: "🥷 Remove unskippable ansible-lint rule added for Galaxy" - working-directory: collections - run: | - sed -i 's/- syntax-check/# - syntax-check/g' .ansible-lint - - name: "Run ansible-lint" - working-directory: collections - run: | - ansible-lint --force-color --strict -v - - # ----------------------------------- # - # 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: - - 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 - - name: Upload coverage from pytest - # Coverage only runs as part of 3.11. - if: | - matrix.python == '3.11' - uses: actions/upload-artifact@v4 - with: - name: pytest-coverage - path: python-avd/coverage.xml - - - name: Upload eos_designs compiled templates from pytest - if: | - matrix.python == '3.11' - uses: actions/upload-artifact@v4 - with: - name: pytest-eos-designs-compiled-templates - path: python-avd/pyavd/_eos_designs/j2templates/compiled_templates/ - - - name: Upload eos_cli_config_gen compiled templates from pytest - if: | - matrix.python == '3.11' - uses: actions/upload-artifact@v4 - with: - name: pytest-eos-cli-config-gen-compiled-templates - path: python-avd/pyavd/_eos_cli_config_gen/j2templates/compiled_templates/ + name: "Collection code testing" + + "on": + pull_request: + merge_group: + push: + branches: + - devel + + 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 }} + AVD_NEVER_RUN_FROM_SOURCE: 1 + 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 + + 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 }} + anta_runner: ${{ steps.filter.outputs.anta_runner }} + 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-dev.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/**/*' + anta_runner: + - 'ansible_collections/arista/avd/roles/anta_runner/*' + - 'ansible_collections/arista/avd/roles/anta_runner/**/*' + - 'python-avd/pyavd/_anta/*' + - 'python-avd/pyavd/_anta/**/*' + - 'python-avd/pyavd/api/_anta/*' + - 'python-avd/pyavd/api/_anta/**/*' + - 'python-avd/pyavd/get_device_anta_catalog.py' + + # ----------------------------------- # + # 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: + - 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 .github/requirements-ci-dev.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + + # ----------------------------------- # + # Build Collection + # ----------------------------------- # + build_pyavd: + name: Build pyavd + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: | + 3.10 + 3.11 + 3.12 + 3.13 + - name: Install pyavd dependencies + run: | + python -m pip install build + cd python-avd + python -m build --wheel --outdir /tmp/pyavd + - name: Compress pyavd dependencies + run: tar -czf /tmp/pyavd.tar.gz -C /tmp pyavd + - name: Upload pyavd wheel package + uses: actions/upload-artifact@v4 + with: + name: pyavd + path: /tmp/pyavd.tar.gz + + # ----------------------------------- # + # EOS CLI CONFIG GEN MOLECULE + # ----------------------------------- # + molecule_eos_cli_config_gen: + name: Validate eos_cli_config_gen + runs-on: ubuntu-latest + needs: [build_pyavd, file-changes] + 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.19.0" + # Also test minimum ansible version for one scenario. + include: + - avd_scenario: "eos_cli_config_gen" + ansible_version: "ansible-core==2.16.0" + if: needs.file-changes.outputs.config_gen == 'true' + steps: + - uses: actions/checkout@v4 + - name: Download AVD Collection Artifact + uses: actions/download-artifact@v4 + with: + name: pyavd + path: /tmp/ + - name: Extract Virtual Environment + run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + - name: Install pyavd, Ansible Version & Run Molecule + run: | + pip install --upgrade pip build molecule "molecule-plugins[docker]" + python -m pip install --no-cache-dir /tmp/pyavd/*.whl + python -m pip install --upgrade "${{ matrix.ansible_version }}" + cd ansible_collections/arista/avd + molecule test --scenario-name ${{ matrix.avd_scenario }} + - name: Check GIT status + run: | + .github/molecule-runner.sh + env: + INPUT_CHECK_GIT: true + INPUT_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.19.0"] + needs: [build_pyavd, file-changes] + if: needs.file-changes.outputs.dhcp == 'true' + steps: + - uses: actions/checkout@v4 + - name: Download AVD Collection Artifact + uses: actions/download-artifact@v4 + with: + name: pyavd + path: /tmp/ + - name: Extract Virtual Environment + run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + - name: Install pyavd, Ansible Version & Run Tests + run: | + python -m pip install --no-cache-dir /tmp/pyavd/*.whl + python -m pip install --upgrade "${{ matrix.ansible_version }}" + cd ansible_collections/arista/avd + molecule test --scenario-name ${{ matrix.avd_scenario }} + - name: Check GIT status + run: | + .github/molecule-runner.sh + env: + INPUT_CHECK_GIT: true + INPUT_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: + - "ansible_only" + - "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" + # Also test minimum ansible version for one scenario. + include: + - avd_scenario: "eos_designs_unit_tests" + ansible_version: "ansible-core==2.16.0" + - avd_scenario: "eos_designs_unit_tests" + ansible_version: "ansible-core<2.18.0" + - avd_scenario: "eos_designs_unit_tests" + ansible_version: "ansible-core<2.19.0" + needs: [build_pyavd, file-changes] + if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true' + steps: + - uses: actions/checkout@v4 + - name: Download AVD Collection Artifact + uses: actions/download-artifact@v4 + with: + name: pyavd + path: /tmp/ + - name: Extract Virtual Environment + run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + - name: Install Ansible Version & Run Tests + run: | + python -m pip install --no-cache-dir /tmp/pyavd/*.whl + python -m pip install --upgrade "${{ matrix.ansible_version }}" + cd ansible_collections/arista/avd + molecule test --scenario-name ${{ matrix.avd_scenario }} + - name: Check GIT status + run: | + .github/molecule-runner.sh + env: + INPUT_CHECK_GIT: true + INPUT_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.19.0" + include: + - avd_scenario: "eos_config_deploy_cvp" + ansible_version: "ansible-core==2.16.0" + needs: [build_pyavd, file-changes] + if: needs.file-changes.outputs.cloudvision == 'true' || needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true' + + steps: + - uses: actions/checkout@v4 + - name: Download AVD Collection Artifact + uses: actions/download-artifact@v4 + with: + name: pyavd + path: /tmp/ + - name: Extract Virtual Environment + run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + - name: Install Ansible Version & Run Tests + run: | + python -m pip install --no-cache-dir /tmp/pyavd/*.whl + python -m pip install --upgrade "${{ matrix.ansible_version }}" + cd ansible_collections/arista/avd + molecule test --scenario-name ${{ matrix.avd_scenario }} + - name: Check GIT status + run: | + .github/molecule-runner.sh + env: + INPUT_CHECK_GIT: true + INPUT_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 }} + # + # ----------------------------------- # + # ANTA Runner MOLECULE + # ----------------------------------- # + molecule_anta_runner: + name: Validate anta_runner + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + avd_scenario: + - 'anta_runner' + ansible_version: + - 'ansible-core<2.19.0' + include: + - avd_scenario: 'anta_runner' + ansible_version: 'ansible-core==2.16.0' + needs: [build_pyavd, file-changes] + if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.anta_runner == 'true' + steps: + - uses: actions/checkout@v4 + - name: Download AVD Collection Artifact + uses: actions/download-artifact@v4 + with: + name: pyavd + path: /tmp/ + - name: Extract Virtual Environment + run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + - name: Install Ansible Version & Run Tests + run: | + python -m pip install --no-cache-dir /tmp/pyavd/*.whl + python -m pip install --upgrade "${{ matrix.ansible_version }}" + cd ansible_collections/arista/avd + molecule test --scenario-name ${{ matrix.avd_scenario }} + - name: Check GIT status + run: | + .github/molecule-runner.sh + env: + INPUT_CHECK_GIT: true + INPUT_CHECK_GIT_ENFORCED: true + + # ----------------------------------- # + # 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.19.0" + include: + - avd_scenario: "eos_validate_state" + ansible_version: "ansible-core==2.16.0" + needs: [build_pyavd, file-changes] + if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.validate_state == 'true' + steps: + - uses: actions/checkout@v4 + - name: Download AVD Collection Artifact + uses: actions/download-artifact@v4 + with: + name: pyavd + path: /tmp/ + - name: Extract Virtual Environment + run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + - name: Install Ansible Version & Run Tests + run: | + python -m pip install --no-cache-dir /tmp/pyavd/*.whl + python -m pip install --upgrade "${{ matrix.ansible_version }}" + cd ansible_collections/arista/avd + molecule test --scenario-name ${{ matrix.avd_scenario }} + - name: Check GIT status + run: | + .github/molecule-runner.sh + env: + INPUT_CHECK_GIT: true + INPUT_CHECK_GIT_ENFORCED: true + + # ----------------------------------- # + # Ansible tests + # ----------------------------------- # + ansible_test_sanity: + name: Run ansible-test sanity validation + runs-on: ubuntu-latest + needs: [build_pyavd, file-changes] + steps: + - 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: Download AVD Collection Artifact + uses: actions/download-artifact@v4 + with: + name: pyavd + path: /tmp/ + - name: Extract Virtual Environment + run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + - name: "Install Ansible requirements" + run: | + python -m pip install --no-cache-dir /tmp/pyavd/*.whl + pip install "ansible-core<2.19.0" + - 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: [build_pyavd, file-changes] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: | + 3.12 + - name: Download AVD Collection Artifact + uses: actions/download-artifact@v4 + with: + name: pyavd + path: /tmp/ + - name: Extract Virtual Environment + run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + - name: "Install Ansible requirements" + run: | + python -m pip install --no-cache-dir /tmp/pyavd/*.whl + pip install "ansible-core<2.19.0" + cd ansible_collections/arista/avd/ + ansible-test units --coverage --requirements -vv + ansible-test coverage xml + mv tests/output/reports/coverage.xml ./units-coverage.xml + - name: Upload coverage from ansible-test units + uses: actions/upload-artifact@v4 + with: + name: ansible-test-units-coverage + path: ansible_collections/arista/avd/units-coverage.xml + + ansible_test_integration: + name: Run ansible-test integration test cases + runs-on: ubuntu-latest + needs: [file-changes] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: | + 3.12 + 3.13 + - name: "Install Python requirements" + run: | + pip install "ansible-core<2.19.0" -r .github/requirements-ci-dev.txt --upgrade + - name: "Run ansible-test integration test cases" + run: | + cd ansible_collections/arista/avd/ + ansible-test integration --coverage --requirements -vv + ansible-test coverage xml + mv tests/output/reports/coverage.xml ./integration-coverage.xml + - name: Upload coverage from ansible-test integration + uses: actions/upload-artifact@v4 + with: + name: ansible-test-integration-coverage + path: ansible_collections/arista/avd/integration-coverage.xml + + # ----------------------------------- # + # Build Collection + # ----------------------------------- # + build_collection: + name: Build Ansible collection + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v5 + with: + python-version: | + 3.12 + - uses: actions/checkout@v4 + - name: "Install Python & Ansible requirements" + run: | + # distlib is required when using manifest + pip install "ansible-core<2.19.0" distlib --upgrade + - name: "Build Ansible collection" + run: | + ansible-galaxy collection build -vvv --force ansible_collections/arista/avd + - name: Upload collection + uses: actions/upload-artifact@v4 + with: + name: avd-collection + path: ./arista-avd-*.tar.gz + + # ----------------------------------- # + # Galaxy Importer + # ----------------------------------- # + galaxy_importer: + name: Test galaxy-importer + runs-on: ubuntu-latest + needs: [build_collection] + steps: + - uses: actions/setup-python@v5 + with: + python-version: | + 3.11 + - uses: actions/checkout@v4 + - name: "Install Python & Ansible requirements" + run: | + pip install "ansible-core==2.16.0" + - name: Download collection + uses: actions/download-artifact@v4 + with: + name: avd-collection + - 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.26" + - 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 + + # ----------------------------------- # + # Ansible Lint + # Run on the built collection from Galaxy importer + # ----------------------------------- # + ansible_lint: + name: Run ansible-lint test case + runs-on: ubuntu-latest + needs: [build_collection] + env: + ANSIBLE_COLLECTIONS_PATH: /home/runner/work/avd/avd + steps: + - 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 .github/requirements-ci-dev.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + - name: Download collection + uses: actions/download-artifact@v4 + with: + name: avd-collection + - name: "Extract collection" + run: | + mkdir collections + tar xvzf arista-avd-*.tar.gz -C collections + - name: "🥷 Remove unskippable ansible-lint rule added for Galaxy" + working-directory: collections + run: | + sed -i 's/- syntax-check/# - syntax-check/g' .ansible-lint + - name: "Run ansible-lint" + working-directory: collections + run: | + ansible-lint --force-color --strict -v + + # ----------------------------------- # + # 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: + - 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 + - name: Upload coverage from pytest + # Coverage only runs as part of 3.11. + if: | + matrix.python == '3.11' + uses: actions/upload-artifact@v4 + with: + name: pytest-coverage + path: python-avd/coverage.xml + + - name: Upload eos_designs compiled templates from pytest + if: | + matrix.python == '3.11' + uses: actions/upload-artifact@v4 + with: + name: pytest-eos-designs-compiled-templates + path: python-avd/pyavd/_eos_designs/j2templates/compiled_templates/ + + - name: Upload eos_cli_config_gen compiled templates from pytest + if: | + matrix.python == '3.11' + uses: actions/upload-artifact@v4 + with: + name: pytest-eos-cli-config-gen-compiled-templates + path: python-avd/pyavd/_eos_cli_config_gen/j2templates/compiled_templates/ From b723b2b50a6ffcd5f4c5b97e08536b57cd416e25 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 18 Mar 2025 15:01:22 +0530 Subject: [PATCH 2/7] updated workflow --- .github/workflows/pull-request-management.yml | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index fb8f5aa0ad6..233b1173d03 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -137,18 +137,15 @@ - uses: actions/setup-python@v5 with: python-version: | - 3.10 - 3.11 3.12 - 3.13 - - name: Install pyavd dependencies + - name: Create wheel packages of pyavd dependencies run: | - python -m pip install build + pip install build cd python-avd python -m build --wheel --outdir /tmp/pyavd - - name: Compress pyavd dependencies + - name: Compress wheel packages run: tar -czf /tmp/pyavd.tar.gz -C /tmp pyavd - - name: Upload pyavd wheel package + - name: Upload pyavd artifact uses: actions/upload-artifact@v4 with: name: pyavd @@ -177,16 +174,15 @@ if: needs.file-changes.outputs.config_gen == 'true' steps: - uses: actions/checkout@v4 - - name: Download AVD Collection Artifact + - name: Download pyavd Artifact uses: actions/download-artifact@v4 with: name: pyavd path: /tmp/ - - name: Extract Virtual Environment + - name: Extract pyavd wheel package run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Molecule run: | - pip install --upgrade pip build molecule "molecule-plugins[docker]" python -m pip install --no-cache-dir /tmp/pyavd/*.whl python -m pip install --upgrade "${{ matrix.ansible_version }}" cd ansible_collections/arista/avd @@ -217,12 +213,12 @@ if: needs.file-changes.outputs.dhcp == 'true' steps: - uses: actions/checkout@v4 - - name: Download AVD Collection Artifact + - name: Download pyavd Artifact uses: actions/download-artifact@v4 with: name: pyavd path: /tmp/ - - name: Extract Virtual Environment + - name: Extract pyavd wheel package run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Tests run: | @@ -283,14 +279,14 @@ if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true' steps: - uses: actions/checkout@v4 - - name: Download AVD Collection Artifact + - name: Download pyavd Artifact uses: actions/download-artifact@v4 with: name: pyavd path: /tmp/ - - name: Extract Virtual Environment + - name: Extract pyavd wheel package run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - - name: Install Ansible Version & Run Tests + - name: Install pyavd, Ansible Version & Run Tests run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl python -m pip install --upgrade "${{ matrix.ansible_version }}" @@ -327,14 +323,14 @@ steps: - uses: actions/checkout@v4 - - name: Download AVD Collection Artifact + - name: Download pyavd Artifact uses: actions/download-artifact@v4 with: name: pyavd path: /tmp/ - - name: Extract Virtual Environment + - name: Extract pyavd wheel package run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - - name: Install Ansible Version & Run Tests + - name: Install pyavd, Ansible Version & Run Tests run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl python -m pip install --upgrade "${{ matrix.ansible_version }}" @@ -371,14 +367,14 @@ if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.anta_runner == 'true' steps: - uses: actions/checkout@v4 - - name: Download AVD Collection Artifact + - name: Download pyavd Artifact uses: actions/download-artifact@v4 with: name: pyavd path: /tmp/ - - name: Extract Virtual Environment + - name: Extract pyavd wheel package run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - - name: Install Ansible Version & Run Tests + - name: Install pyavd, Ansible Version & Run Tests run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl python -m pip install --upgrade "${{ matrix.ansible_version }}" @@ -411,12 +407,12 @@ if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.validate_state == 'true' steps: - uses: actions/checkout@v4 - - name: Download AVD Collection Artifact + - name: Download pyavd Artifact uses: actions/download-artifact@v4 with: name: pyavd path: /tmp/ - - name: Extract Virtual Environment + - name: Extract pyavd wheel package run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install Ansible Version & Run Tests run: | @@ -448,14 +444,14 @@ 3.11 3.12 3.13 - - name: Download AVD Collection Artifact + - name: Download pyavd Artifact uses: actions/download-artifact@v4 with: name: pyavd path: /tmp/ - - name: Extract Virtual Environment + - name: Extract pyavd wheel package run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - - name: "Install Ansible requirements" + - name: "Install pyavd and Ansible requirements" run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl pip install "ansible-core<2.19.0" @@ -475,17 +471,19 @@ with: python-version: | 3.12 - - name: Download AVD Collection Artifact + - name: Download pyavd Artifact uses: actions/download-artifact@v4 with: name: pyavd path: /tmp/ - - name: Extract Virtual Environment + - name: Extract pyavd wheel package run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - - name: "Install Ansible requirements" + - name: "Install pyavd and ansible requirements" run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl pip install "ansible-core<2.19.0" + - name: "Run ansible-test units" + run: | cd ansible_collections/arista/avd/ ansible-test units --coverage --requirements -vv ansible-test coverage xml From e98ee16b52c0523153d705e8d7ad97b4662294a5 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 18 Mar 2025 15:12:06 +0530 Subject: [PATCH 3/7] add dependencies --- python-avd/pyproject.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python-avd/pyproject.toml b/python-avd/pyproject.toml index 4563e0e6c7e..510ebe48659 100644 --- a/python-avd/pyproject.toml +++ b/python-avd/pyproject.toml @@ -25,6 +25,17 @@ dependencies = [ "deepmerge>=1.1.0", "Jinja2>=3.0", "requests>=2.27.0", + "anta>=1.3.0", + "cvprac>=1.4.0", + "netaddr>=0.7.19", + "PyYAML>=6.0.0", + "treelib>=1.5.5", + # jsonschema is required for the arista.cvp Ansible collection + "jsonschema>=3.2.0", + # distlib is required to install the collection from source as it is using manifest + "distlib>=0.3.9", + "molecule>=6.0", + "molecule-plugins[docker]>=23.4.0", ] [project.urls] From 953c74012fe573ae456ab3dedb1d0ae5d1b77f98 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 18 Mar 2025 15:19:22 +0530 Subject: [PATCH 4/7] sh for git status --- .github/workflows/pull-request-management.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 233b1173d03..2878140bd87 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -189,7 +189,7 @@ molecule test --scenario-name ${{ matrix.avd_scenario }} - name: Check GIT status run: | - .github/molecule-runner.sh + sh .github/molecule-runner.sh env: INPUT_CHECK_GIT: true INPUT_CHECK_GIT_ENFORCED: true From 78e48e13addfd822b9719457af215dc21b4c9ac0 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 18 Mar 2025 15:22:30 +0530 Subject: [PATCH 5/7] sh for git status --- .github/workflows/pull-request-management.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 2878140bd87..339cdda6944 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -228,7 +228,7 @@ molecule test --scenario-name ${{ matrix.avd_scenario }} - name: Check GIT status run: | - .github/molecule-runner.sh + sh .github/molecule-runner.sh env: INPUT_CHECK_GIT: true INPUT_CHECK_GIT_ENFORCED: true @@ -294,7 +294,7 @@ molecule test --scenario-name ${{ matrix.avd_scenario }} - name: Check GIT status run: | - .github/molecule-runner.sh + sh .github/molecule-runner.sh env: INPUT_CHECK_GIT: true INPUT_CHECK_GIT_ENFORCED: true @@ -338,7 +338,7 @@ molecule test --scenario-name ${{ matrix.avd_scenario }} - name: Check GIT status run: | - .github/molecule-runner.sh + sh .github/molecule-runner.sh env: INPUT_CHECK_GIT: true INPUT_CHECK_GIT_ENFORCED: true @@ -382,7 +382,7 @@ molecule test --scenario-name ${{ matrix.avd_scenario }} - name: Check GIT status run: | - .github/molecule-runner.sh + sh .github/molecule-runner.sh env: INPUT_CHECK_GIT: true INPUT_CHECK_GIT_ENFORCED: true @@ -422,7 +422,7 @@ molecule test --scenario-name ${{ matrix.avd_scenario }} - name: Check GIT status run: | - .github/molecule-runner.sh + sh .github/molecule-runner.sh env: INPUT_CHECK_GIT: true INPUT_CHECK_GIT_ENFORCED: true From 9967aa78471a0273b5609a1859eb402d921dd92f Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 18 Mar 2025 15:35:10 +0530 Subject: [PATCH 6/7] remove compression --- .github/workflows/pull-request-management.yml | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 339cdda6944..3822fc4ddc6 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -143,13 +143,13 @@ pip install build cd python-avd python -m build --wheel --outdir /tmp/pyavd - - name: Compress wheel packages - run: tar -czf /tmp/pyavd.tar.gz -C /tmp pyavd + # - name: Compress wheel packages + # run: tar -czf /tmp/pyavd.tar.gz -C /tmp pyavd - name: Upload pyavd artifact uses: actions/upload-artifact@v4 with: name: pyavd - path: /tmp/pyavd.tar.gz + path: /tmp/pyavd/*.whl # ----------------------------------- # # EOS CLI CONFIG GEN MOLECULE @@ -178,9 +178,9 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/ - - name: Extract pyavd wheel package - run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + path: /tmp/pyavd/*.whl + # - name: Extract pyavd wheel package + # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Molecule run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl @@ -217,9 +217,9 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/ - - name: Extract pyavd wheel package - run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + path: /tmp/pyavd/*.whl + # - name: Extract pyavd wheel package + # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Tests run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl @@ -283,9 +283,9 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/ - - name: Extract pyavd wheel package - run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + path: /tmp/pyavd/*.whl + # - name: Extract pyavd wheel package + # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Tests run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl @@ -327,9 +327,9 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/ - - name: Extract pyavd wheel package - run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + path: /tmp/pyavd/*.whl + # - name: Extract pyavd wheel package + # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Tests run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl @@ -371,9 +371,9 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/ - - name: Extract pyavd wheel package - run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + path: /tmp/pyavd/*.whl + # - name: Extract pyavd wheel package + # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Tests run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl @@ -411,9 +411,9 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/ - - name: Extract pyavd wheel package - run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + path: /tmp/pyavd/*.whl + # - name: Extract pyavd wheel package + # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install Ansible Version & Run Tests run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl @@ -448,9 +448,9 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/ - - name: Extract pyavd wheel package - run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + path: /tmp/pyavd/*.whl + # - name: Extract pyavd wheel package + # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: "Install pyavd and Ansible requirements" run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl @@ -475,9 +475,9 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/ - - name: Extract pyavd wheel package - run: tar -xzf /tmp/pyavd.tar.gz -C /tmp + path: /tmp/pyavd/*.whl + # - name: Extract pyavd wheel package + # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: "Install pyavd and ansible requirements" run: | python -m pip install --no-cache-dir /tmp/pyavd/*.whl From 3502c6ef74a099ba704297d3356b46a1155e4abe Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 18 Mar 2025 15:46:31 +0530 Subject: [PATCH 7/7] set artifact path --- .github/workflows/pull-request-management.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 3822fc4ddc6..b84df00d718 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -149,7 +149,7 @@ uses: actions/upload-artifact@v4 with: name: pyavd - path: /tmp/pyavd/*.whl + path: /tmp/pyavd/ # ----------------------------------- # # EOS CLI CONFIG GEN MOLECULE @@ -178,7 +178,7 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/pyavd/*.whl + path: /tmp/pyavd/ # - name: Extract pyavd wheel package # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Molecule @@ -217,7 +217,7 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/pyavd/*.whl + path: /tmp/pyavd/ # - name: Extract pyavd wheel package # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Tests @@ -283,7 +283,7 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/pyavd/*.whl + path: /tmp/pyavd/ # - name: Extract pyavd wheel package # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Tests @@ -327,7 +327,7 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/pyavd/*.whl + path: /tmp/pyavd/ # - name: Extract pyavd wheel package # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Tests @@ -371,7 +371,7 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/pyavd/*.whl + path: /tmp/pyavd/ # - name: Extract pyavd wheel package # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install pyavd, Ansible Version & Run Tests @@ -411,7 +411,7 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/pyavd/*.whl + path: /tmp/pyavd/ # - name: Extract pyavd wheel package # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: Install Ansible Version & Run Tests @@ -448,7 +448,7 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/pyavd/*.whl + path: /tmp/pyavd/ # - name: Extract pyavd wheel package # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: "Install pyavd and Ansible requirements" @@ -475,7 +475,7 @@ uses: actions/download-artifact@v4 with: name: pyavd - path: /tmp/pyavd/*.whl + path: /tmp/pyavd/ # - name: Extract pyavd wheel package # run: tar -xzf /tmp/pyavd.tar.gz -C /tmp - name: "Install pyavd and ansible requirements"