CI: use current tests/ directory for upgrade testing

We should not rollback our test setup during upgrade test.
The only reason to do that would be for incompatible changes in the test
inventory, and we already checkout master for those (${CI_JOB_NAME}.yml)

Also do some cleanup by removing unnecessary intermediary variables
This commit is contained in:
Max Gautier
2024-10-18 12:11:41 +02:00
parent ff4de880ae
commit ceb4b2fa7d
6 changed files with 12 additions and 24 deletions

View File

@@ -11,10 +11,6 @@ variables:
GITLAB_REPOSITORY: 'kargo-ci/kubernetes-sigs-kubespray' GITLAB_REPOSITORY: 'kargo-ci/kubernetes-sigs-kubespray'
ANSIBLE_FORCE_COLOR: "true" ANSIBLE_FORCE_COLOR: "true"
MAGIC: "ci check this" MAGIC: "ci check this"
TEST_ID: "$CI_PIPELINE_ID-$CI_JOB_ID"
CI_TEST_VARS: "./tests/files/${CI_JOB_NAME}.yml"
CI_TEST_REGISTRY_MIRROR: "./tests/common/_docker_hub_registry_mirror.yml"
CI_TEST_SETTING: "./tests/common/_kubespray_test_settings.yml"
GS_ACCESS_KEY_ID: $GS_KEY GS_ACCESS_KEY_ID: $GS_KEY
GS_SECRET_ACCESS_KEY: $GS_SECRET GS_SECRET_ACCESS_KEY: $GS_SECRET
CONTAINER_ENGINE: docker CONTAINER_ENGINE: docker

View File

@@ -13,7 +13,7 @@ create-packet: init-packet
ansible-playbook cloud_playbooks/create-packet.yml -c local \ ansible-playbook cloud_playbooks/create-packet.yml -c local \
$(ANSIBLE_LOG_LEVEL) \ $(ANSIBLE_LOG_LEVEL) \
-e @"files/${CI_JOB_NAME}.yml" \ -e @"files/${CI_JOB_NAME}.yml" \
-e test_id=$(TEST_ID) \ -e test_name="$(subst .,-,$(CI_PIPELINE_ID)-$(CI_JOB_ID))" \
-e branch="$(CI_COMMIT_BRANCH)" \ -e branch="$(CI_COMMIT_BRANCH)" \
-e pipeline_id="$(CI_PIPELINE_ID)" \ -e pipeline_id="$(CI_PIPELINE_ID)" \
-e inventory_path=$(INVENTORY_DIR) -e inventory_path=$(INVENTORY_DIR)

View File

@@ -4,8 +4,5 @@
hosts: localhost hosts: localhost
gather_facts: false gather_facts: false
become: true become: true
vars:
ci_job_name: "{{ lookup('env', 'CI_JOB_NAME') }}"
test_name: "{{ test_id | regex_replace('\\.', '-') }}"
roles: roles:
- { role: packet-ci, vm_cleanup: false } - { role: packet-ci, vm_cleanup: false }

View File

@@ -1,5 +0,0 @@
---
# Kubespray settings for tests
deploy_netchecker: true
dns_min_replicas: 1
unsafe_show_logs: true

View File

@@ -1,4 +1,10 @@
--- ---
# Kubespray settings for tests
deploy_netchecker: true
dns_min_replicas: 1
unsafe_show_logs: true
# Registry mirrors settings
docker_registry_mirrors: docker_registry_mirrors:
- "https://mirror.gcr.io" - "https://mirror.gcr.io"
@@ -34,7 +40,3 @@ nginx_image_repo: "{{ quay_image_repo }}/kubespray/nginx"
flannel_image_repo: "{{ quay_image_repo }}/kubespray/flannel" flannel_image_repo: "{{ quay_image_repo }}/kubespray/flannel"
flannel_init_image_repo: "{{ quay_image_repo }}/kubespray/flannel-cni-plugin" flannel_init_image_repo: "{{ quay_image_repo }}/kubespray/flannel-cni-plugin"
# Kubespray settings for tests
deploy_netchecker: true
dns_min_replicas: 1

View File

@@ -18,10 +18,9 @@ fi
# Check out latest tag if testing upgrade # Check out latest tag if testing upgrade
if [ "${UPGRADE_TEST}" != "false" ]; then if [ "${UPGRADE_TEST}" != "false" ]; then
git fetch --all && git checkout "$KUBESPRAY_VERSION" git fetch --all && git checkout "$KUBESPRAY_VERSION"
# Checkout the CI vars file so it is available # Checkout the current tests/ directory ; even when testing old version,
git checkout "${CI_COMMIT_SHA}" tests/files/${CI_JOB_NAME}.yml # we want the up-to-date test setup/provisionning
git checkout "${CI_COMMIT_SHA}" ${CI_TEST_REGISTRY_MIRROR} git checkout "${CI_COMMIT_SHA}" -- tests/
git checkout "${CI_COMMIT_SHA}" ${CI_TEST_SETTING}
fi fi
# needed for ara not to complain # needed for ara not to complain
@@ -57,9 +56,8 @@ shift
# We can set --limit here and still pass it as supplemental args because `--limit` is a 'last one wins' option # We can set --limit here and still pass it as supplemental args because `--limit` is a 'last one wins' option
ansible-playbook \ ansible-playbook \
$ANSIBLE_LOG_LEVEL \ $ANSIBLE_LOG_LEVEL \
-e @${CI_TEST_SETTING} \ -e @tests/common_vars.yml \
-e @${CI_TEST_REGISTRY_MIRROR} \ -e @tests/files/${CI_JOB_NAME}.yml \
-e @${CI_TEST_VARS} \
-e local_release_dir=${PWD}/downloads \ -e local_release_dir=${PWD}/downloads \
"$@" \ "$@" \
${playbook} ${playbook}