mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-18 09:27:34 -02:30
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)
This commit is contained in:
@@ -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
|
||||
|
||||
2
tests/files/almalinux9-calico-remove-node
Normal file
2
tests/files/almalinux9-calico-remove-node
Normal file
@@ -0,0 +1,2 @@
|
||||
REMOVE_NODE_CHECK=true
|
||||
REMOVE_NODE_NAME=instance-3
|
||||
1
tests/files/debian11-calico-upgrade
Normal file
1
tests/files/debian11-calico-upgrade
Normal file
@@ -0,0 +1 @@
|
||||
UPGRADE_TEST=graceful
|
||||
1
tests/files/debian11-calico-upgrade-once
Normal file
1
tests/files/debian11-calico-upgrade-once
Normal file
@@ -0,0 +1 @@
|
||||
UPGRADE_TEST=graceful
|
||||
1
tests/files/fedora40-docker.calico
Normal file
1
tests/files/fedora40-docker.calico
Normal file
@@ -0,0 +1 @@
|
||||
RESET_CHECK=true
|
||||
1
tests/files/rockylinux9-cilium
Normal file
1
tests/files/rockylinux9-cilium
Normal file
@@ -0,0 +1 @@
|
||||
RESET_CHECK=true
|
||||
1
tests/files/ubuntu20-calico-all-in-one
Normal file
1
tests/files/ubuntu20-calico-all-in-one
Normal file
@@ -0,0 +1 @@
|
||||
RESET_CHECK=true
|
||||
1
tests/files/ubuntu20-calico-etcd-kubeadm-upgrade-ha
Normal file
1
tests/files/ubuntu20-calico-etcd-kubeadm-upgrade-ha
Normal file
@@ -0,0 +1 @@
|
||||
UPGRADE_TEST=basic
|
||||
2
tests/files/ubuntu20-calico-ha-recover
Normal file
2
tests/files/ubuntu20-calico-ha-recover
Normal file
@@ -0,0 +1,2 @@
|
||||
RECOVER_CONTROL_PLANE_TEST=true
|
||||
RECOVER_CONTROL_PLANE_TEST_GROUPS="etcd[2:]:kube_control_plane[1:]"
|
||||
2
tests/files/ubuntu20-calico-ha-recover-noquorum
Normal file
2
tests/files/ubuntu20-calico-ha-recover-noquorum
Normal file
@@ -0,0 +1,2 @@
|
||||
RECOVER_CONTROL_PLANE_TEST=true
|
||||
RECOVER_CONTROL_PLANE_TEST_GROUPS="etcd[1:]:kube_control_plane[1:]"
|
||||
1
tests/files/ubuntu22-calico-all-in-one-upgrade
Normal file
1
tests/files/ubuntu22-calico-all-in-one-upgrade
Normal file
@@ -0,0 +1 @@
|
||||
UPGRADE_TEST=graceful
|
||||
@@ -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'))
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
make -C tests delete-${CI_PLATFORM} -s
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
mkdir -p /.ssh
|
||||
mkdir -p cluster-dump
|
||||
mkdir -p $HOME/.ssh
|
||||
ansible-playbook --version
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user