From 4f3b214ef5631d0102d88b89ef8648ac0c5b3317 Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Fri, 14 Mar 2025 12:25:12 +0100 Subject: [PATCH] CI: streamline packet jobs definition - Take advantage of `parallel:matrix` to make the jobs definition shorter and more readable. - Remove helper scripts which are no longer needed - Remove redundant indirection in the gitlab-ci pipelines definitions (only one user) --- .gitlab-ci.yml | 12 - .gitlab-ci/packet.yml | 295 ++++++------------ .../roles/packet-ci/tasks/main.yml | 2 +- ...inux8-calico.yml => almalinux8-calico.yml} | 0 ...ebpf.yml => almalinux9-calico-ha-ebpf.yml} | 0 ...alinux9-calico-nodelocaldns-secondary.yml} | 0 tests/files/almalinux9-calico-remove-node | 2 + ....yml => almalinux9-calico-remove-node.yml} | 0 ...inux9-calico.yml => almalinux9-calico.yml} | 0 ...lmalinux9-crio.yml => almalinux9-crio.yml} | 0 ...inux9-docker.yml => almalinux9-docker.yml} | 0 ...9-kube-ovn.yml => almalinux9-kube-ovn.yml} | 0 ...-one.yml => amazon-linux-2-all-in-one.yml} | 0 ...ion.yml => debian11-calico-collection.yml} | 0 tests/files/debian11-calico-upgrade | 1 + tests/files/debian11-calico-upgrade-once | 1 + ...e.yml => debian11-calico-upgrade-once.yml} | 0 ...pgrade.yml => debian11-calico-upgrade.yml} | 0 ...custom-cni.yml => debian11-custom-cni.yml} | 0 ...ebian11-docker.yml => debian11-docker.yml} | 0 ....yml => debian11-kubelet-csr-approver.yml} | 0 ...ian11-macvlan.yml => debian11-macvlan.yml} | 0 ...ebian12-calico.yml => debian12-calico.yml} | 0 ...roxy.yml => debian12-cilium-svc-proxy.yml} | 0 ...ebian12-cilium.yml => debian12-cilium.yml} | 0 ...-helm.yml => debian12-custom-cni-helm.yml} | 0 ...ebian12-docker.yml => debian12-docker.yml} | 0 ...elinux.yml => fedora39-calico-selinux.yml} | 0 ...x.yml => fedora39-calico-swap-selinux.yml} | 0 ...et_fedora39-crio.yml => fedora39-crio.yml} | 0 ...-calico.yml => fedora40-docker-calico.yml} | 0 tests/files/fedora40-docker.calico | 1 + ...er24-calico.yml => openeuler24-calico.yml} | 0 ...5-6-calico.yml => opensuse15-6-calico.yml} | 0 ...ium.yml => opensuse15-6-docker-cilium.yml} | 0 ...nux8-calico.yml => rockylinux8-calico.yml} | 0 ...nux9-calico.yml => rockylinux9-calico.yml} | 0 tests/files/rockylinux9-cilium | 1 + ...nux9-cilium.yml => rockylinux9-cilium.yml} | 0 ...ker.yml => ubuntu20-all-in-one-docker.yml} | 0 tests/files/ubuntu20-calico-all-in-one | 1 + ... ubuntu20-calico-all-in-one-hardening.yml} | 0 ...one.yml => ubuntu20-calico-all-in-one.yml} | 0 .../ubuntu20-calico-etcd-kubeadm-upgrade-ha | 1 + ...untu20-calico-etcd-kubeadm-upgrade-ha.yml} | 0 ...m.yml => ubuntu20-calico-etcd-kubeadm.yml} | 0 tests/files/ubuntu20-calico-ha-recover | 2 + .../files/ubuntu20-calico-ha-recover-noquorum | 2 + ...> ubuntu20-calico-ha-recover-noquorum.yml} | 0 ...ver.yml => ubuntu20-calico-ha-recover.yml} | 0 ...d.yml => ubuntu20-calico-ha-wireguard.yml} | 0 ...cilium-sep.yml => ubuntu20-cilium-sep.yml} | 0 ...et_ubuntu20-crio.yml => ubuntu20-crio.yml} | 0 ...-once.yml => ubuntu20-flannel-ha-once.yml} | 0 ...flannel-ha.yml => ubuntu20-flannel-ha.yml} | 0 ...ker.yml => ubuntu22-all-in-one-docker.yml} | 0 .../files/ubuntu22-calico-all-in-one-upgrade | 1 + ...=> ubuntu22-calico-all-in-one-upgrade.yml} | 0 ...one.yml => ubuntu22-calico-all-in-one.yml} | 0 ...ker.yml => ubuntu24-all-in-one-docker.yml} | 0 ...one.yml => ubuntu24-calico-all-in-one.yml} | 0 ...yml => ubuntu24-calico-etcd-datastore.yml} | 0 tests/scripts/md-table/main.py | 4 +- tests/scripts/testcases_cleanup.sh | 4 - tests/scripts/testcases_prepare.sh | 7 - tests/scripts/testcases_run.sh | 22 +- 66 files changed, 113 insertions(+), 246 deletions(-) rename tests/files/{packet_almalinux8-calico.yml => almalinux8-calico.yml} (100%) rename tests/files/{packet_almalinux9-calico-ha-ebpf.yml => almalinux9-calico-ha-ebpf.yml} (100%) rename tests/files/{packet_almalinux9-calico-nodelocaldns-secondary.yml => almalinux9-calico-nodelocaldns-secondary.yml} (100%) create mode 100644 tests/files/almalinux9-calico-remove-node rename tests/files/{packet_almalinux9-calico-remove-node.yml => almalinux9-calico-remove-node.yml} (100%) rename tests/files/{packet_almalinux9-calico.yml => almalinux9-calico.yml} (100%) rename tests/files/{packet_almalinux9-crio.yml => almalinux9-crio.yml} (100%) rename tests/files/{packet_almalinux9-docker.yml => almalinux9-docker.yml} (100%) rename tests/files/{packet_almalinux9-kube-ovn.yml => almalinux9-kube-ovn.yml} (100%) rename tests/files/{packet_amazon-linux-2-all-in-one.yml => amazon-linux-2-all-in-one.yml} (100%) rename tests/files/{packet_debian11-calico-collection.yml => debian11-calico-collection.yml} (100%) create mode 100644 tests/files/debian11-calico-upgrade create mode 100644 tests/files/debian11-calico-upgrade-once rename tests/files/{packet_debian11-calico-upgrade-once.yml => debian11-calico-upgrade-once.yml} (100%) rename tests/files/{packet_debian11-calico-upgrade.yml => debian11-calico-upgrade.yml} (100%) rename tests/files/{packet_debian11-custom-cni.yml => debian11-custom-cni.yml} (100%) rename tests/files/{packet_debian11-docker.yml => debian11-docker.yml} (100%) rename tests/files/{packet_debian11-kubelet-csr-approver.yml => debian11-kubelet-csr-approver.yml} (100%) rename tests/files/{packet_debian11-macvlan.yml => debian11-macvlan.yml} (100%) rename tests/files/{packet_debian12-calico.yml => debian12-calico.yml} (100%) rename tests/files/{packet_debian12-cilium-svc-proxy.yml => debian12-cilium-svc-proxy.yml} (100%) rename tests/files/{packet_debian12-cilium.yml => debian12-cilium.yml} (100%) rename tests/files/{packet_debian12-custom-cni-helm.yml => debian12-custom-cni-helm.yml} (100%) rename tests/files/{packet_debian12-docker.yml => debian12-docker.yml} (100%) rename tests/files/{packet_fedora39-calico-selinux.yml => fedora39-calico-selinux.yml} (100%) rename tests/files/{packet_fedora39-calico-swap-selinux.yml => fedora39-calico-swap-selinux.yml} (100%) rename tests/files/{packet_fedora39-crio.yml => fedora39-crio.yml} (100%) rename tests/files/{packet_fedora40-docker-calico.yml => fedora40-docker-calico.yml} (100%) create mode 100644 tests/files/fedora40-docker.calico rename tests/files/{packet_openeuler24-calico.yml => openeuler24-calico.yml} (100%) rename tests/files/{packet_opensuse15-6-calico.yml => opensuse15-6-calico.yml} (100%) rename tests/files/{packet_opensuse15-6-docker-cilium.yml => opensuse15-6-docker-cilium.yml} (100%) rename tests/files/{packet_rockylinux8-calico.yml => rockylinux8-calico.yml} (100%) rename tests/files/{packet_rockylinux9-calico.yml => rockylinux9-calico.yml} (100%) create mode 100644 tests/files/rockylinux9-cilium rename tests/files/{packet_rockylinux9-cilium.yml => rockylinux9-cilium.yml} (100%) rename tests/files/{packet_ubuntu20-all-in-one-docker.yml => ubuntu20-all-in-one-docker.yml} (100%) create mode 100644 tests/files/ubuntu20-calico-all-in-one rename tests/files/{packet_ubuntu20-calico-all-in-one-hardening.yml => ubuntu20-calico-all-in-one-hardening.yml} (100%) rename tests/files/{packet_ubuntu20-calico-all-in-one.yml => ubuntu20-calico-all-in-one.yml} (100%) create mode 100644 tests/files/ubuntu20-calico-etcd-kubeadm-upgrade-ha rename tests/files/{packet_ubuntu20-calico-etcd-kubeadm-upgrade-ha.yml => ubuntu20-calico-etcd-kubeadm-upgrade-ha.yml} (100%) rename tests/files/{packet_ubuntu20-calico-etcd-kubeadm.yml => ubuntu20-calico-etcd-kubeadm.yml} (100%) create mode 100644 tests/files/ubuntu20-calico-ha-recover create mode 100644 tests/files/ubuntu20-calico-ha-recover-noquorum rename tests/files/{packet_ubuntu20-calico-ha-recover-noquorum.yml => ubuntu20-calico-ha-recover-noquorum.yml} (100%) rename tests/files/{packet_ubuntu20-calico-ha-recover.yml => ubuntu20-calico-ha-recover.yml} (100%) rename tests/files/{packet_ubuntu20-calico-ha-wireguard.yml => ubuntu20-calico-ha-wireguard.yml} (100%) rename tests/files/{packet_ubuntu20-cilium-sep.yml => ubuntu20-cilium-sep.yml} (100%) rename tests/files/{packet_ubuntu20-crio.yml => ubuntu20-crio.yml} (100%) rename tests/files/{packet_ubuntu20-flannel-ha-once.yml => ubuntu20-flannel-ha-once.yml} (100%) rename tests/files/{packet_ubuntu20-flannel-ha.yml => ubuntu20-flannel-ha.yml} (100%) rename tests/files/{packet_ubuntu22-all-in-one-docker.yml => ubuntu22-all-in-one-docker.yml} (100%) create mode 100644 tests/files/ubuntu22-calico-all-in-one-upgrade rename tests/files/{packet_ubuntu22-calico-all-in-one-upgrade.yml => ubuntu22-calico-all-in-one-upgrade.yml} (100%) rename tests/files/{packet_ubuntu22-calico-all-in-one.yml => ubuntu22-calico-all-in-one.yml} (100%) rename tests/files/{packet_ubuntu24-all-in-one-docker.yml => ubuntu24-all-in-one-docker.yml} (100%) rename tests/files/{packet_ubuntu24-calico-all-in-one.yml => ubuntu24-calico-all-in-one.yml} (100%) rename tests/files/{packet_ubuntu24-calico-etcd-datastore.yml => ubuntu24-calico-etcd-datastore.yml} (100%) delete mode 100755 tests/scripts/testcases_cleanup.sh delete mode 100755 tests/scripts/testcases_prepare.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ba1c839ed..287674197 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,18 +59,6 @@ before_script: - pre-commit # lint - vagrant-validate # lint -.testcases: &testcases - extends: .job-moderated - interruptible: true - before_script: - - update-alternatives --install /usr/bin/python python /usr/bin/python3 1 - - ./tests/scripts/rebase.sh - - ./tests/scripts/testcases_prepare.sh - script: - - ./tests/scripts/testcases_run.sh - after_script: - - ./tests/scripts/testcases_cleanup.sh - # For failfast, at least 1 job must be defined in .gitlab-ci.yml # Premoderated with manual actions ci-not-authorized: diff --git a/.gitlab-ci/packet.yml b/.gitlab-ci/packet.yml index d0227802b..9282e046e 100644 --- a/.gitlab-ci/packet.yml +++ b/.gitlab-ci/packet.yml @@ -1,6 +1,12 @@ --- .packet: - extends: .testcases + extends: .job-moderated + interruptible: true + before_script: + - ./tests/scripts/rebase.sh + - mkdir -p cluster-dump + script: + - ./tests/scripts/testcases_run.sh variables: ANSIBLE_TIMEOUT: "120" CI_PLATFORM: packet @@ -11,8 +17,12 @@ - pipeline-image - ci-not-authorized +# TODO: generate testcases matrixes from the files in tests/files/ +# this is needed to avoid the need for PR rebasing when a job was added or remvoed in the target branch +# (currently, a removed job in the target branch breaks the tests, because the +# pipeline definition is parsed by gitlab before the rebase.sh script) # CI template for PRs -.packet_pr: +packet_pr: stage: deploy-part1 rules: - if: $PR_LABELS =~ /.*ci-short.*/ @@ -23,22 +33,39 @@ - when: manual allow_failure: true extends: .packet + parallel: + matrix: + - TESTCASE: + - almalinux8-calico + - almalinux9-crio + - almalinux9-kube-ovn + - debian11-calico-collection + - debian11-macvlan + - debian12-cilium + - openeuler24-calico + - opensuse15-6-calico + - rockylinux8-calico + - rockylinux9-cilium + - ubuntu20-calico-all-in-one-hardening + - ubuntu20-cilium-sep + - ubuntu22-calico-all-in-one + - ubuntu22-calico-all-in-one-upgrade + - ubuntu24-calico-etcd-datastore - ## Uncomment this to have multiple stages - # needs: - # - packet_ubuntu20-calico-all-in-one - -.packet_pr_short: +# The ubuntu20-calico-all-in-one jobs are meant as early stages to prevent running the full CI if something is horribly broken +packet_ubuntu20-calico-all-in-one: stage: deploy-part1 extends: .packet + variables: + TESTCASE: ubuntu20-calico-all-in-one rules: - if: $CI_COMMIT_BRANCH =~ /^pr-.*$/ when: on_success - when: manual allow_failure: true -.packet_pr_manual: - extends: .packet_pr +packet_pr_full: + extends: .packet stage: deploy-extended rules: - if: $PR_LABELS =~ /.*ci-full.*/ @@ -46,212 +73,72 @@ # Else run as manual - when: manual allow_failure: true + parallel: + matrix: + - TESTCASE: + - almalinux9-calico-ha-ebpf + - almalinux9-calico-nodelocaldns-secondary + - debian11-custom-cni + - debian11-kubelet-csr-approver + - debian12-custom-cni-helm + - fedora39-calico-swap-selinux + - fedora39-crio + - ubuntu20-all-in-one-docker + - ubuntu20-calico-ha-wireguard + - ubuntu20-flannel-ha + - ubuntu20-flannel-ha-once -.packet_pr_extended: - extends: .packet_pr +# Need an update of the container image to use schema v2 +# update: quay.io/kubespray/vm-amazon-linux-2:latest +packet_manual: + extends: packet_pr_full + parallel: + matrix: + - TESTCASE: + - amazon-linux-2-all-in-one + rules: + - when: manual + allow_failure: true + +packet_pr_extended: + extends: .packet stage: deploy-extended rules: - if: $PR_LABELS =~ /.*(ci-extended|ci-full).*/ when: on_success - when: manual allow_failure: true + parallel: + matrix: + - TESTCASE: + - almalinux9-calico + - almalinux9-calico-remove-node + - almalinux9-docker + - debian11-docker + - debian12-calico + - debian12-docker + - opensuse15-6-docker-cilium + - rockylinux9-calico + - ubuntu20-calico-etcd-kubeadm + - ubuntu22-all-in-one-docker + - ubuntu24-all-in-one-docker + - ubuntu24-calico-all-in-one -# CI template for periodic CI jobs # Enabled when PERIODIC_CI_ENABLED var is set -.packet_periodic: +packet_periodic: only: variables: - $PERIODIC_CI_ENABLED allow_failure: true extends: .packet - -# The ubuntu20-calico-all-in-one jobs are meant as early stages to prevent running the full CI if something is horribly broken -packet_ubuntu20-calico-all-in-one: - stage: deploy-part1 - extends: .packet_pr_short - variables: - RESET_CHECK: "true" - -# ### PR JOBS PART2 - -packet_ubuntu20-crio: - extends: .packet_pr_manual - -packet_ubuntu22-calico-all-in-one: - extends: .packet_pr - -packet_ubuntu22-calico-all-in-one-upgrade: - extends: .packet_pr - variables: - UPGRADE_TEST: graceful - -packet_ubuntu24-calico-etcd-datastore: - extends: .packet_pr - -packet_almalinux9-crio: - extends: .packet_pr - -packet_almalinux9-kube-ovn: - extends: .packet_pr - -packet_debian11-calico-collection: - extends: .packet_pr - -packet_debian11-macvlan: - extends: .packet_pr - -packet_debian12-cilium: - extends: .packet_pr - -packet_almalinux8-calico: - extends: .packet_pr - -packet_rockylinux8-calico: - extends: .packet_pr - -packet_rockylinux9-cilium: - extends: .packet_pr - variables: - RESET_CHECK: "true" - -# Need an update of the container image to use schema v2 -# update: quay.io/kubespray/vm-amazon-linux-2:latest -packet_amazon-linux-2-all-in-one: - extends: .packet_pr_manual - rules: - - when: manual - allow_failure: true - -packet_opensuse15-6-calico: - extends: .packet_pr - -packet_ubuntu20-cilium-sep: - extends: .packet_pr - -packet_openeuler24-calico: - extends: .packet_pr - -packet_ubuntu20-calico-all-in-one-hardening: - extends: .packet_pr - -## Extended -packet_debian11-docker: - extends: .packet_pr_extended - -packet_debian12-docker: - extends: .packet_pr_extended - -packet_debian12-calico: - extends: .packet_pr_extended - -packet_almalinux9-calico-remove-node: - extends: .packet_pr_extended - variables: - REMOVE_NODE_CHECK: "true" - REMOVE_NODE_NAME: "instance-3" - -packet_rockylinux9-calico: - extends: .packet_pr_extended - -packet_almalinux9-calico: - extends: .packet_pr_extended - -packet_almalinux9-docker: - extends: .packet_pr_extended - -packet_opensuse15-6-docker-cilium: - extends: .packet_pr_extended - -packet_ubuntu24-calico-all-in-one: - extends: .packet_pr_extended - -packet_ubuntu20-calico-etcd-kubeadm: - extends: .packet_pr_extended - -packet_ubuntu24-all-in-one-docker: - extends: .packet_pr_extended - -packet_ubuntu22-all-in-one-docker: - extends: .packet_pr_extended - -# ### MANUAL JOBS -packet_fedora39-crio: - extends: .packet_pr_manual - -packet_ubuntu20-flannel-ha: - extends: .packet_pr_manual - -packet_ubuntu20-all-in-one-docker: - extends: .packet_pr_manual - -packet_ubuntu20-flannel-ha-once: - extends: .packet_pr_manual - -packet_fedora39-calico-swap-selinux: - extends: .packet_pr_manual - -packet_almalinux9-calico-ha-ebpf: - extends: .packet_pr_manual - -packet_almalinux9-calico-nodelocaldns-secondary: - extends: .packet_pr_manual - -packet_debian11-custom-cni: - extends: .packet_pr_manual - -packet_debian11-kubelet-csr-approver: - extends: .packet_pr_manual - -packet_debian12-custom-cni-helm: - extends: .packet_pr_manual - -packet_ubuntu20-calico-ha-wireguard: - extends: .packet_pr_manual - -# PERIODIC -packet_fedora40-docker-calico: - stage: deploy-extended - extends: .packet_periodic - variables: - RESET_CHECK: "true" - -packet_fedora39-calico-selinux: - stage: deploy-extended - extends: .packet_periodic - -packet_ubuntu20-calico-etcd-kubeadm-upgrade-ha: - stage: deploy-extended - extends: .packet_periodic - variables: - UPGRADE_TEST: basic - - -packet_debian11-calico-upgrade-once: - stage: deploy-extended - extends: .packet_periodic - variables: - UPGRADE_TEST: graceful - -packet_ubuntu20-calico-ha-recover: - stage: deploy-extended - extends: .packet_periodic - variables: - RECOVER_CONTROL_PLANE_TEST: "true" - RECOVER_CONTROL_PLANE_TEST_GROUPS: "etcd[2:]:kube_control_plane[1:]" - -packet_ubuntu20-calico-ha-recover-noquorum: - stage: deploy-extended - extends: .packet_periodic - variables: - RECOVER_CONTROL_PLANE_TEST: "true" - RECOVER_CONTROL_PLANE_TEST_GROUPS: "etcd[1:]:kube_control_plane[1:]" - -packet_debian11-calico-upgrade: - stage: deploy-extended - extends: .packet_periodic - variables: - UPGRADE_TEST: graceful - -packet_debian12-cilium-svc-proxy: - stage: deploy-extended - extends: .packet_periodic + parallel: + matrix: + - TESTCASE: + - debian11-calico-upgrade + - debian11-calico-upgrade-once + - debian12-cilium-svc-proxy + - fedora39-calico-selinux + - fedora40-docker-calico + - ubuntu20-calico-etcd-kubeadm-upgrade-ha + - ubuntu20-calico-ha-recover + - ubuntu20-calico-ha-recover-noquorum diff --git a/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml b/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml index 5f620e7d5..6bd4b7c07 100644 --- a/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml +++ b/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Include custom vars for ci job - include_vars: "../files/{{ lookup('ansible.builtin.env', 'CI_JOB_NAME') }}.yml" + include_vars: "../files/{{ lookup('ansible.builtin.env', 'TESTCASE') }}.yml" when: molecule_yml is not defined - name: Generate SSH keypair diff --git a/tests/files/packet_almalinux8-calico.yml b/tests/files/almalinux8-calico.yml similarity index 100% rename from tests/files/packet_almalinux8-calico.yml rename to tests/files/almalinux8-calico.yml diff --git a/tests/files/packet_almalinux9-calico-ha-ebpf.yml b/tests/files/almalinux9-calico-ha-ebpf.yml similarity index 100% rename from tests/files/packet_almalinux9-calico-ha-ebpf.yml rename to tests/files/almalinux9-calico-ha-ebpf.yml diff --git a/tests/files/packet_almalinux9-calico-nodelocaldns-secondary.yml b/tests/files/almalinux9-calico-nodelocaldns-secondary.yml similarity index 100% rename from tests/files/packet_almalinux9-calico-nodelocaldns-secondary.yml rename to tests/files/almalinux9-calico-nodelocaldns-secondary.yml diff --git a/tests/files/almalinux9-calico-remove-node b/tests/files/almalinux9-calico-remove-node new file mode 100644 index 000000000..85f05b2ca --- /dev/null +++ b/tests/files/almalinux9-calico-remove-node @@ -0,0 +1,2 @@ +REMOVE_NODE_CHECK=true +REMOVE_NODE_NAME=instance-3 diff --git a/tests/files/packet_almalinux9-calico-remove-node.yml b/tests/files/almalinux9-calico-remove-node.yml similarity index 100% rename from tests/files/packet_almalinux9-calico-remove-node.yml rename to tests/files/almalinux9-calico-remove-node.yml diff --git a/tests/files/packet_almalinux9-calico.yml b/tests/files/almalinux9-calico.yml similarity index 100% rename from tests/files/packet_almalinux9-calico.yml rename to tests/files/almalinux9-calico.yml diff --git a/tests/files/packet_almalinux9-crio.yml b/tests/files/almalinux9-crio.yml similarity index 100% rename from tests/files/packet_almalinux9-crio.yml rename to tests/files/almalinux9-crio.yml diff --git a/tests/files/packet_almalinux9-docker.yml b/tests/files/almalinux9-docker.yml similarity index 100% rename from tests/files/packet_almalinux9-docker.yml rename to tests/files/almalinux9-docker.yml diff --git a/tests/files/packet_almalinux9-kube-ovn.yml b/tests/files/almalinux9-kube-ovn.yml similarity index 100% rename from tests/files/packet_almalinux9-kube-ovn.yml rename to tests/files/almalinux9-kube-ovn.yml diff --git a/tests/files/packet_amazon-linux-2-all-in-one.yml b/tests/files/amazon-linux-2-all-in-one.yml similarity index 100% rename from tests/files/packet_amazon-linux-2-all-in-one.yml rename to tests/files/amazon-linux-2-all-in-one.yml diff --git a/tests/files/packet_debian11-calico-collection.yml b/tests/files/debian11-calico-collection.yml similarity index 100% rename from tests/files/packet_debian11-calico-collection.yml rename to tests/files/debian11-calico-collection.yml diff --git a/tests/files/debian11-calico-upgrade b/tests/files/debian11-calico-upgrade new file mode 100644 index 000000000..77bf528c8 --- /dev/null +++ b/tests/files/debian11-calico-upgrade @@ -0,0 +1 @@ +UPGRADE_TEST=graceful diff --git a/tests/files/debian11-calico-upgrade-once b/tests/files/debian11-calico-upgrade-once new file mode 100644 index 000000000..77bf528c8 --- /dev/null +++ b/tests/files/debian11-calico-upgrade-once @@ -0,0 +1 @@ +UPGRADE_TEST=graceful diff --git a/tests/files/packet_debian11-calico-upgrade-once.yml b/tests/files/debian11-calico-upgrade-once.yml similarity index 100% rename from tests/files/packet_debian11-calico-upgrade-once.yml rename to tests/files/debian11-calico-upgrade-once.yml diff --git a/tests/files/packet_debian11-calico-upgrade.yml b/tests/files/debian11-calico-upgrade.yml similarity index 100% rename from tests/files/packet_debian11-calico-upgrade.yml rename to tests/files/debian11-calico-upgrade.yml diff --git a/tests/files/packet_debian11-custom-cni.yml b/tests/files/debian11-custom-cni.yml similarity index 100% rename from tests/files/packet_debian11-custom-cni.yml rename to tests/files/debian11-custom-cni.yml diff --git a/tests/files/packet_debian11-docker.yml b/tests/files/debian11-docker.yml similarity index 100% rename from tests/files/packet_debian11-docker.yml rename to tests/files/debian11-docker.yml diff --git a/tests/files/packet_debian11-kubelet-csr-approver.yml b/tests/files/debian11-kubelet-csr-approver.yml similarity index 100% rename from tests/files/packet_debian11-kubelet-csr-approver.yml rename to tests/files/debian11-kubelet-csr-approver.yml diff --git a/tests/files/packet_debian11-macvlan.yml b/tests/files/debian11-macvlan.yml similarity index 100% rename from tests/files/packet_debian11-macvlan.yml rename to tests/files/debian11-macvlan.yml diff --git a/tests/files/packet_debian12-calico.yml b/tests/files/debian12-calico.yml similarity index 100% rename from tests/files/packet_debian12-calico.yml rename to tests/files/debian12-calico.yml diff --git a/tests/files/packet_debian12-cilium-svc-proxy.yml b/tests/files/debian12-cilium-svc-proxy.yml similarity index 100% rename from tests/files/packet_debian12-cilium-svc-proxy.yml rename to tests/files/debian12-cilium-svc-proxy.yml diff --git a/tests/files/packet_debian12-cilium.yml b/tests/files/debian12-cilium.yml similarity index 100% rename from tests/files/packet_debian12-cilium.yml rename to tests/files/debian12-cilium.yml diff --git a/tests/files/packet_debian12-custom-cni-helm.yml b/tests/files/debian12-custom-cni-helm.yml similarity index 100% rename from tests/files/packet_debian12-custom-cni-helm.yml rename to tests/files/debian12-custom-cni-helm.yml diff --git a/tests/files/packet_debian12-docker.yml b/tests/files/debian12-docker.yml similarity index 100% rename from tests/files/packet_debian12-docker.yml rename to tests/files/debian12-docker.yml diff --git a/tests/files/packet_fedora39-calico-selinux.yml b/tests/files/fedora39-calico-selinux.yml similarity index 100% rename from tests/files/packet_fedora39-calico-selinux.yml rename to tests/files/fedora39-calico-selinux.yml diff --git a/tests/files/packet_fedora39-calico-swap-selinux.yml b/tests/files/fedora39-calico-swap-selinux.yml similarity index 100% rename from tests/files/packet_fedora39-calico-swap-selinux.yml rename to tests/files/fedora39-calico-swap-selinux.yml diff --git a/tests/files/packet_fedora39-crio.yml b/tests/files/fedora39-crio.yml similarity index 100% rename from tests/files/packet_fedora39-crio.yml rename to tests/files/fedora39-crio.yml diff --git a/tests/files/packet_fedora40-docker-calico.yml b/tests/files/fedora40-docker-calico.yml similarity index 100% rename from tests/files/packet_fedora40-docker-calico.yml rename to tests/files/fedora40-docker-calico.yml diff --git a/tests/files/fedora40-docker.calico b/tests/files/fedora40-docker.calico new file mode 100644 index 000000000..3cf4b3d58 --- /dev/null +++ b/tests/files/fedora40-docker.calico @@ -0,0 +1 @@ +RESET_CHECK=true diff --git a/tests/files/packet_openeuler24-calico.yml b/tests/files/openeuler24-calico.yml similarity index 100% rename from tests/files/packet_openeuler24-calico.yml rename to tests/files/openeuler24-calico.yml diff --git a/tests/files/packet_opensuse15-6-calico.yml b/tests/files/opensuse15-6-calico.yml similarity index 100% rename from tests/files/packet_opensuse15-6-calico.yml rename to tests/files/opensuse15-6-calico.yml diff --git a/tests/files/packet_opensuse15-6-docker-cilium.yml b/tests/files/opensuse15-6-docker-cilium.yml similarity index 100% rename from tests/files/packet_opensuse15-6-docker-cilium.yml rename to tests/files/opensuse15-6-docker-cilium.yml diff --git a/tests/files/packet_rockylinux8-calico.yml b/tests/files/rockylinux8-calico.yml similarity index 100% rename from tests/files/packet_rockylinux8-calico.yml rename to tests/files/rockylinux8-calico.yml diff --git a/tests/files/packet_rockylinux9-calico.yml b/tests/files/rockylinux9-calico.yml similarity index 100% rename from tests/files/packet_rockylinux9-calico.yml rename to tests/files/rockylinux9-calico.yml diff --git a/tests/files/rockylinux9-cilium b/tests/files/rockylinux9-cilium new file mode 100644 index 000000000..3cf4b3d58 --- /dev/null +++ b/tests/files/rockylinux9-cilium @@ -0,0 +1 @@ +RESET_CHECK=true diff --git a/tests/files/packet_rockylinux9-cilium.yml b/tests/files/rockylinux9-cilium.yml similarity index 100% rename from tests/files/packet_rockylinux9-cilium.yml rename to tests/files/rockylinux9-cilium.yml diff --git a/tests/files/packet_ubuntu20-all-in-one-docker.yml b/tests/files/ubuntu20-all-in-one-docker.yml similarity index 100% rename from tests/files/packet_ubuntu20-all-in-one-docker.yml rename to tests/files/ubuntu20-all-in-one-docker.yml diff --git a/tests/files/ubuntu20-calico-all-in-one b/tests/files/ubuntu20-calico-all-in-one new file mode 100644 index 000000000..3cf4b3d58 --- /dev/null +++ b/tests/files/ubuntu20-calico-all-in-one @@ -0,0 +1 @@ +RESET_CHECK=true diff --git a/tests/files/packet_ubuntu20-calico-all-in-one-hardening.yml b/tests/files/ubuntu20-calico-all-in-one-hardening.yml similarity index 100% rename from tests/files/packet_ubuntu20-calico-all-in-one-hardening.yml rename to tests/files/ubuntu20-calico-all-in-one-hardening.yml diff --git a/tests/files/packet_ubuntu20-calico-all-in-one.yml b/tests/files/ubuntu20-calico-all-in-one.yml similarity index 100% rename from tests/files/packet_ubuntu20-calico-all-in-one.yml rename to tests/files/ubuntu20-calico-all-in-one.yml diff --git a/tests/files/ubuntu20-calico-etcd-kubeadm-upgrade-ha b/tests/files/ubuntu20-calico-etcd-kubeadm-upgrade-ha new file mode 100644 index 000000000..49b1f98cc --- /dev/null +++ b/tests/files/ubuntu20-calico-etcd-kubeadm-upgrade-ha @@ -0,0 +1 @@ +UPGRADE_TEST=basic diff --git a/tests/files/packet_ubuntu20-calico-etcd-kubeadm-upgrade-ha.yml b/tests/files/ubuntu20-calico-etcd-kubeadm-upgrade-ha.yml similarity index 100% rename from tests/files/packet_ubuntu20-calico-etcd-kubeadm-upgrade-ha.yml rename to tests/files/ubuntu20-calico-etcd-kubeadm-upgrade-ha.yml diff --git a/tests/files/packet_ubuntu20-calico-etcd-kubeadm.yml b/tests/files/ubuntu20-calico-etcd-kubeadm.yml similarity index 100% rename from tests/files/packet_ubuntu20-calico-etcd-kubeadm.yml rename to tests/files/ubuntu20-calico-etcd-kubeadm.yml diff --git a/tests/files/ubuntu20-calico-ha-recover b/tests/files/ubuntu20-calico-ha-recover new file mode 100644 index 000000000..9d98a7f3a --- /dev/null +++ b/tests/files/ubuntu20-calico-ha-recover @@ -0,0 +1,2 @@ +RECOVER_CONTROL_PLANE_TEST=true +RECOVER_CONTROL_PLANE_TEST_GROUPS="etcd[2:]:kube_control_plane[1:]" diff --git a/tests/files/ubuntu20-calico-ha-recover-noquorum b/tests/files/ubuntu20-calico-ha-recover-noquorum new file mode 100644 index 000000000..bf1349526 --- /dev/null +++ b/tests/files/ubuntu20-calico-ha-recover-noquorum @@ -0,0 +1,2 @@ +RECOVER_CONTROL_PLANE_TEST=true +RECOVER_CONTROL_PLANE_TEST_GROUPS="etcd[1:]:kube_control_plane[1:]" diff --git a/tests/files/packet_ubuntu20-calico-ha-recover-noquorum.yml b/tests/files/ubuntu20-calico-ha-recover-noquorum.yml similarity index 100% rename from tests/files/packet_ubuntu20-calico-ha-recover-noquorum.yml rename to tests/files/ubuntu20-calico-ha-recover-noquorum.yml diff --git a/tests/files/packet_ubuntu20-calico-ha-recover.yml b/tests/files/ubuntu20-calico-ha-recover.yml similarity index 100% rename from tests/files/packet_ubuntu20-calico-ha-recover.yml rename to tests/files/ubuntu20-calico-ha-recover.yml diff --git a/tests/files/packet_ubuntu20-calico-ha-wireguard.yml b/tests/files/ubuntu20-calico-ha-wireguard.yml similarity index 100% rename from tests/files/packet_ubuntu20-calico-ha-wireguard.yml rename to tests/files/ubuntu20-calico-ha-wireguard.yml diff --git a/tests/files/packet_ubuntu20-cilium-sep.yml b/tests/files/ubuntu20-cilium-sep.yml similarity index 100% rename from tests/files/packet_ubuntu20-cilium-sep.yml rename to tests/files/ubuntu20-cilium-sep.yml diff --git a/tests/files/packet_ubuntu20-crio.yml b/tests/files/ubuntu20-crio.yml similarity index 100% rename from tests/files/packet_ubuntu20-crio.yml rename to tests/files/ubuntu20-crio.yml diff --git a/tests/files/packet_ubuntu20-flannel-ha-once.yml b/tests/files/ubuntu20-flannel-ha-once.yml similarity index 100% rename from tests/files/packet_ubuntu20-flannel-ha-once.yml rename to tests/files/ubuntu20-flannel-ha-once.yml diff --git a/tests/files/packet_ubuntu20-flannel-ha.yml b/tests/files/ubuntu20-flannel-ha.yml similarity index 100% rename from tests/files/packet_ubuntu20-flannel-ha.yml rename to tests/files/ubuntu20-flannel-ha.yml diff --git a/tests/files/packet_ubuntu22-all-in-one-docker.yml b/tests/files/ubuntu22-all-in-one-docker.yml similarity index 100% rename from tests/files/packet_ubuntu22-all-in-one-docker.yml rename to tests/files/ubuntu22-all-in-one-docker.yml diff --git a/tests/files/ubuntu22-calico-all-in-one-upgrade b/tests/files/ubuntu22-calico-all-in-one-upgrade new file mode 100644 index 000000000..77bf528c8 --- /dev/null +++ b/tests/files/ubuntu22-calico-all-in-one-upgrade @@ -0,0 +1 @@ +UPGRADE_TEST=graceful diff --git a/tests/files/packet_ubuntu22-calico-all-in-one-upgrade.yml b/tests/files/ubuntu22-calico-all-in-one-upgrade.yml similarity index 100% rename from tests/files/packet_ubuntu22-calico-all-in-one-upgrade.yml rename to tests/files/ubuntu22-calico-all-in-one-upgrade.yml diff --git a/tests/files/packet_ubuntu22-calico-all-in-one.yml b/tests/files/ubuntu22-calico-all-in-one.yml similarity index 100% rename from tests/files/packet_ubuntu22-calico-all-in-one.yml rename to tests/files/ubuntu22-calico-all-in-one.yml diff --git a/tests/files/packet_ubuntu24-all-in-one-docker.yml b/tests/files/ubuntu24-all-in-one-docker.yml similarity index 100% rename from tests/files/packet_ubuntu24-all-in-one-docker.yml rename to tests/files/ubuntu24-all-in-one-docker.yml diff --git a/tests/files/packet_ubuntu24-calico-all-in-one.yml b/tests/files/ubuntu24-calico-all-in-one.yml similarity index 100% rename from tests/files/packet_ubuntu24-calico-all-in-one.yml rename to tests/files/ubuntu24-calico-all-in-one.yml diff --git a/tests/files/packet_ubuntu24-calico-etcd-datastore.yml b/tests/files/ubuntu24-calico-etcd-datastore.yml similarity index 100% rename from tests/files/packet_ubuntu24-calico-etcd-datastore.yml rename to tests/files/ubuntu24-calico-etcd-datastore.yml diff --git a/tests/scripts/md-table/main.py b/tests/scripts/md-table/main.py index 09d5506e9..263fd02a8 100755 --- a/tests/scripts/md-table/main.py +++ b/tests/scripts/md-table/main.py @@ -90,7 +90,7 @@ for f in files: container_manager = y.get('container_manager', 'containerd') network_plugin = y.get('kube_network_plugin', 'calico') - x = re.match(r"^[a-z-]+_([a-z0-9]+).*", f.name) - operating_system = x.group(1) + x = re.match(r"^([a-z-]+_)?([a-z0-9]+).*", f.name) + operating_system = x.group(2) data.set(container_manager=container_manager, network_plugin=network_plugin, os=operating_system) print(data.jinja(), file=open(args.output, 'w')) diff --git a/tests/scripts/testcases_cleanup.sh b/tests/scripts/testcases_cleanup.sh deleted file mode 100755 index e6df033d9..000000000 --- a/tests/scripts/testcases_cleanup.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -euxo pipefail - -make -C tests delete-${CI_PLATFORM} -s diff --git a/tests/scripts/testcases_prepare.sh b/tests/scripts/testcases_prepare.sh deleted file mode 100755 index aa4b285e5..000000000 --- a/tests/scripts/testcases_prepare.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -euxo pipefail - -mkdir -p /.ssh -mkdir -p cluster-dump -mkdir -p $HOME/.ssh -ansible-playbook --version diff --git a/tests/scripts/testcases_run.sh b/tests/scripts/testcases_run.sh index bf50d79b1..09de3261b 100755 --- a/tests/scripts/testcases_run.sh +++ b/tests/scripts/testcases_run.sh @@ -1,19 +1,9 @@ #!/bin/bash set -euxo pipefail -echo "CI_JOB_NAME is $CI_JOB_NAME" +echo "TESTCASE is $TESTCASE" -if [[ "$CI_JOB_NAME" =~ "upgrade" ]]; then - if [ "${UPGRADE_TEST}" == "false" ]; then - echo "Job name contains 'upgrade', but UPGRADE_TEST='false'" - exit 1 - fi -else - if [ "${UPGRADE_TEST}" != "false" ]; then - echo "UPGRADE_TEST!='false', but job names does not contain 'upgrade'" - exit 1 - fi -fi +source tests/files/$TESTCASE || true # Check out latest tag if testing upgrade if [ "${UPGRADE_TEST}" != "false" ]; then @@ -31,7 +21,7 @@ make -C tests create-${CI_PLATFORM} -s # Test collection build and install by installing our collection, emptying our repository, adding # cluster.yml, reset.yml, and remote-node.yml files that simply point to our collection's playbooks, and then # running the same tests as before -if [[ "${CI_JOB_NAME}" =~ "collection" ]]; then +if [[ "${TESTCASE}" =~ "collection" ]]; then # Build and install collection ansible-galaxy collection build ansible-galaxy collection install kubernetes_sigs-kubespray-$(grep "^version:" galaxy.yml | awk '{print $2}').tar.gz @@ -69,7 +59,7 @@ shift # We can set --limit here and still pass it as supplemental args because `--limit` is a 'last one wins' option ansible-playbook \ -e @tests/common_vars.yml \ - -e @tests/files/${CI_JOB_NAME}.yml \ + -e @tests/files/${TESTCASE}.yml \ -e local_release_dir=${PWD}/downloads \ "$@" \ ${playbook} @@ -111,10 +101,10 @@ run_playbook tests/testcases/015_check-nodes-ready.yml ## Test that all nodes are Ready -if [[ ! ( "$CI_JOB_NAME" =~ "macvlan" ) ]]; then +if [[ ! ( "$TESTCASE" =~ "macvlan" ) ]]; then run_playbook tests/testcases/020_check-pods-running.yml run_playbook tests/testcases/030_check-network.yml - if [[ ! ( "$CI_JOB_NAME" =~ "hardening" ) ]]; then + if [[ ! ( "$TESTCASE" =~ "hardening" ) ]]; then # TODO: We need to remove this condition by finding alternative container # image instead of netchecker which doesn't work at hardening environments. run_playbook tests/testcases/040_check-network-adv.yml