From c394f6778d27881eee402c31270692e096978c7b Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Thu, 30 Nov 2023 16:23:06 -0600 Subject: [PATCH] remove old pipelines, run sanity in pipelines because we're dropping zuul Signed-off-by: Adam Miller --- .azure-pipelines/azure-pipelines.yml | 158 ++++++++++-------- tests/sanity/ignore-2.10.txt | 8 - tests/sanity/ignore-2.11.txt | 8 - tests/sanity/ignore-2.13.txt | 8 - .../{ignore-2.12.txt => ignore-2.17.txt} | 1 - tests/utils/shippable/lint.sh | 14 ++ tests/utils/shippable/sanity.sh | 16 +- tests/utils/shippable/units.sh | 107 +----------- 8 files changed, 116 insertions(+), 204 deletions(-) delete mode 100644 tests/sanity/ignore-2.10.txt delete mode 100644 tests/sanity/ignore-2.11.txt delete mode 100644 tests/sanity/ignore-2.13.txt rename tests/sanity/{ignore-2.12.txt => ignore-2.17.txt} (89%) create mode 100755 tests/utils/shippable/lint.sh diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index e66ea57..e1ba4a0 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -36,12 +36,79 @@ variables: resources: containers: - container: default - image: quay.io/ansible/azure-pipelines-test-container:4.0.1 + image: quay.io/ansible/azure-pipelines-test-container:main pool: Standard stages: + - stage: Sanity_devel + displayName: Ansible devel sanity + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + nameFormat: "{0}" + testFormat: "devel/{0}" + targets: + - name: Sanity + test: sanity + - name: Units + test: units +# - name: Lint +# test: lint + - stage: Sanity_2_16 + displayName: Ansible 2.16 sanity + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + nameFormat: "{0}" + testFormat: "2.16/{0}" + targets: + - name: Sanity + test: sanity + - name: Units + test: units + - stage: Sanity_2_15 + displayName: Ansible 2.15 sanity + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + nameFormat: "{0}" + testFormat: "2.15/{0}" + targets: + - name: Sanity + test: sanity + - name: Units + test: units + - stage: Sanity_2_14 + displayName: Ansible 2.14 sanity + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + nameFormat: "{0}" + testFormat: "2.14/{0}" + targets: + - name: Sanity + test: sanity + - name: Units + test: units + - stage: Sanity_2_9 + displayName: Ansible 2.9 sanity + dependsOn: [] + jobs: + - template: templates/matrix.yml + parameters: + nameFormat: "{0}" + testFormat: "2.9/{0}" + targets: + - name: Sanity + test: sanity + - name: Units + test: units ## Docker - stage: Docker_devel displayName: Docker devel @@ -110,50 +177,6 @@ stages: test: ubuntu2004 - name: Ubuntu 22.04 test: ubuntu2204 - - stage: Docker_2_13 - displayName: Docker 2.13 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.13/linux/{0}/1 - targets: - - name: CentOS 7 - test: centos7 - - name: Fedora 34 - test: fedora34 - - name: Fedora 35 - test: fedora35 - - name: openSUSE 15 py3 - test: opensuse15 - - name: Ubuntu 18.04 - test: ubuntu1804 - - name: Ubuntu 20.04 - test: ubuntu2004 - - stage: Docker_2_12 - displayName: Docker 2.12 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.12/linux/{0}/1 - targets: - - name: CentOS 6 - test: centos6 - - name: CentOS 7 - test: centos7 - - name: Fedora 33 - test: fedora33 - - name: Fedora 34 - test: fedora34 - - name: openSUSE 15 py2 - test: opensuse15py2 - - name: openSUSE 15 py3 - test: opensuse15 - - name: Ubuntu 18.04 - test: ubuntu1804 - - name: Ubuntu 20.04 - test: ubuntu2004 - stage: Docker_2_9 displayName: Docker 2.9 dependsOn: [] @@ -186,6 +209,8 @@ stages: targets: - name: RHEL 9.3 test: rhel/9.3 + - name: FreeBSD 13.2 + test: freebsd/13.2 - stage: Remote_2_16 displayName: Remote 2.16 dependsOn: [] @@ -198,6 +223,8 @@ stages: test: rhel/8.8 - name: RHEL 9.2 test: rhel/9.2 + - name: FreeBSD 13.2 + test: freebsd/13.2 - stage: Remote_2_15 displayName: Remote 2.15 @@ -213,6 +240,10 @@ stages: test: rhel/8.7 - name: RHEL 9.1 test: rhel/9.1 + - name: FreeBSD 13.1 + test: freebsd/13.1 + - name: FreeBSD 12.4 + test: freebsd/12.4 - stage: Remote_2_14 displayName: Remote 2.14 dependsOn: [] @@ -225,30 +256,10 @@ stages: test: rhel/7.9 - name: RHEL 8.6 test: rhel/8.6 - - stage: Remote_2_13 - displayName: Remote 2.13 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.13/{0}/1 - targets: - - name: RHEL 7.9 - test: rhel/7.9 - - name: RHEL 8.5 - test: rhel/8.5 - - stage: Remote_2_12 - displayName: Remote 2.12 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.12/{0}/1 - targets: - - name: RHEL 7.9 - test: rhel/7.9 - - name: RHEL 8.4 - test: rhel/8.4 + - name: FreeBSD 13.1 + test: freebsd/13.1 + - name: FreeBSD 12.4 + test: freebsd/12.4 - stage: Remote_2_9 displayName: Remote 2.9 dependsOn: [] @@ -267,18 +278,19 @@ stages: - stage: Summary condition: succeededOrFailed() dependsOn: + - Sanity_2_9 - Remote_2_9 - Docker_2_9 - - Remote_2_12 - - Docker_2_12 - - Remote_2_13 - - Docker_2_13 + - Sanity_2_14 - Remote_2_14 - Docker_2_14 + - Sanity_2_15 - Remote_2_15 - Docker_2_15 + - Sanity_2_16 - Remote_2_16 - Docker_2_16 + - Sanity_devel - Remote_devel - Docker_devel jobs: diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt deleted file mode 100644 index 013403f..0000000 --- a/tests/sanity/ignore-2.10.txt +++ /dev/null @@ -1,8 +0,0 @@ -plugins/modules/synchronize.py pylint:blacklisted-name -plugins/modules/synchronize.py use-argspec-type-path -plugins/modules/synchronize.py validate-modules:doc-default-does-not-match-spec -plugins/modules/synchronize.py validate-modules:nonexistent-parameter-documented -plugins/modules/synchronize.py validate-modules:parameter-type-not-in-doc -plugins/modules/synchronize.py validate-modules:undocumented-parameter -tests/utils/shippable/check_matrix.py replace-urlopen -tests/utils/shippable/timing.py shebang diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt deleted file mode 100644 index 013403f..0000000 --- a/tests/sanity/ignore-2.11.txt +++ /dev/null @@ -1,8 +0,0 @@ -plugins/modules/synchronize.py pylint:blacklisted-name -plugins/modules/synchronize.py use-argspec-type-path -plugins/modules/synchronize.py validate-modules:doc-default-does-not-match-spec -plugins/modules/synchronize.py validate-modules:nonexistent-parameter-documented -plugins/modules/synchronize.py validate-modules:parameter-type-not-in-doc -plugins/modules/synchronize.py validate-modules:undocumented-parameter -tests/utils/shippable/check_matrix.py replace-urlopen -tests/utils/shippable/timing.py shebang diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt deleted file mode 100644 index 0b6905e..0000000 --- a/tests/sanity/ignore-2.13.txt +++ /dev/null @@ -1,8 +0,0 @@ -plugins/modules/synchronize.py pylint:disallowed-name -plugins/modules/synchronize.py use-argspec-type-path -plugins/modules/synchronize.py validate-modules:doc-default-does-not-match-spec -plugins/modules/synchronize.py validate-modules:nonexistent-parameter-documented -plugins/modules/synchronize.py validate-modules:parameter-type-not-in-doc -plugins/modules/synchronize.py validate-modules:undocumented-parameter -tests/utils/shippable/check_matrix.py replace-urlopen -tests/utils/shippable/timing.py shebang diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.17.txt similarity index 89% rename from tests/sanity/ignore-2.12.txt rename to tests/sanity/ignore-2.17.txt index 0b6905e..d196952 100644 --- a/tests/sanity/ignore-2.12.txt +++ b/tests/sanity/ignore-2.17.txt @@ -4,5 +4,4 @@ plugins/modules/synchronize.py validate-modules:doc-default-does-not-match-spec plugins/modules/synchronize.py validate-modules:nonexistent-parameter-documented plugins/modules/synchronize.py validate-modules:parameter-type-not-in-doc plugins/modules/synchronize.py validate-modules:undocumented-parameter -tests/utils/shippable/check_matrix.py replace-urlopen tests/utils/shippable/timing.py shebang diff --git a/tests/utils/shippable/lint.sh b/tests/utils/shippable/lint.sh new file mode 100755 index 0000000..6ab1187 --- /dev/null +++ b/tests/utils/shippable/lint.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -o pipefail -eux + +echo "${PATH/\~/${HOME}}" +echo "${HOME}" +command -v ansible + +pip install --upgrade --user pip +pip install --upgrade --user ansible-lint + +PATH="${PATH/\~/${HOME}}" ansible-lint \ + --exclude changelogs/ \ + --profile=production diff --git a/tests/utils/shippable/sanity.sh b/tests/utils/shippable/sanity.sh index 82cf8c9..50a74a2 100755 --- a/tests/utils/shippable/sanity.sh +++ b/tests/utils/shippable/sanity.sh @@ -1,7 +1,21 @@ #!/usr/bin/env bash +# Following logic in https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml set -o pipefail -eux +if [ "${BASE_BRANCH:-}" ]; then + base_branch="origin/${BASE_BRANCH}" +else + base_branch="" +fi + +# Run sanity tests inside a Docker container. +# The docker container has all the pinned dependencies that are +# required and all Python versions Ansible supports. + +# See the documentation for the following GitHub action on +# https://github.com/ansible-community/ansible-test-gh-action/blob/main/README.md + # shellcheck disable=SC2086 ansible-test sanity --color -v --junit ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \ - --docker + --docker --base-branch "${base_branch}" --allow-disabled diff --git a/tests/utils/shippable/units.sh b/tests/utils/shippable/units.sh index e2ff963..bcf7a77 100755 --- a/tests/utils/shippable/units.sh +++ b/tests/utils/shippable/units.sh @@ -2,109 +2,6 @@ set -o pipefail -eux -declare -a args -IFS='/:' read -ra args <<< "$1" - -version="${args[1]}" -group="${args[2]}" - -if [[ "${COVERAGE:-}" == "--coverage" ]]; then - timeout=90 -else - timeout=30 -fi - -group1=() -group2=() -group3=() - -# create three groups by putting network tests into separate groups -# add or remove network platforms as needed to balance the groups - -networks2=( - aireos - apconos - aruba - asa - avi - check_point - cloudengine - cloudvision - cnos - cumulus - dellos10 - dellos6 - dellos9 - edgeos - edgeswitch - enos - eos - eric_eccli - exos - f5 - fortimanager - frr - ftd - icx - ingate - ios - iosxr - ironware - itential - junos - netact - netscaler - netvisor - nos - nso - nuage - nxos - onyx - opx - ovs - radware - routeros - slxos - voss - vyos -) - -networks3=( - fortios -) - -for network in "${networks2[@]}"; do - test_path="test/units/modules/network/${network}/" - - if [ -d "${test_path}" ]; then - group1+=(--exclude "${test_path}") - group2+=("${test_path}") - fi -done - -for network in "${networks3[@]}"; do - test_path="test/units/modules/network/${network}/" - - if [ -d "${test_path}" ]; then - group1+=(--exclude "${test_path}") - group3+=("${test_path}") - fi -done - -case "${group}" in - 1) options=("${group1[@]:+${group1[@]}}") ;; - 2) options=("${group2[@]:+${group2[@]}}") ;; - 3) options=("${group3[@]:+${group3[@]}}") ;; -esac - -if [ ${#options[@]} -eq 0 ] && [ "${group}" -gt 1 ]; then - # allow collection migration unit tests for groups other than 1 to "pass" without updating shippable.yml or this script during migration - echo "No unit tests found for group ${group}." - exit -fi - -ansible-test env --timeout "${timeout}" --color -v - # shellcheck disable=SC2086 -ansible-test units --color -v --docker default --python "${version}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \ - "${options[@]:+${options[@]}}" \ +ansible-test units --color -v --docker default ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} +