From e84ebb07737a53918e83dee724ea1557e0131e19 Mon Sep 17 00:00:00 2001 From: Andrew Bonney Date: Thu, 24 Jul 2025 09:18:04 +0100 Subject: [PATCH] ci: fix various issues preventing complete runs When creating a coe cluster, a flavor lookup occurs which fails as nothing is specified. This adds a default flavor which can be used to test cluster provisioning. Various checks used a deprecated truthy check which no longer works with Ansible 2.19 Inventory cache format change in Ansible 2.19 galaxy.yml required in tmp testing directory or version checks fail for linters with Ansible 2.19 Change-Id: Iaf3f05d0841a541e4318821fe44ddd59f236b640 --- ci/roles/coe_cluster/tasks/main.yml | 2 ++ ci/roles/floating_ip/tasks/main.yml | 6 +++--- ci/roles/inventory/tasks/main.yml | 5 +++++ ci/roles/keypair/tasks/main.yml | 2 +- ci/roles/network/tasks/main.yml | 2 +- tools/run-ansible-sanity.sh | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ci/roles/coe_cluster/tasks/main.yml b/ci/roles/coe_cluster/tasks/main.yml index 8b40028a..c9e1c825 100644 --- a/ci/roles/coe_cluster/tasks/main.yml +++ b/ci/roles/coe_cluster/tasks/main.yml @@ -72,6 +72,8 @@ image_id: '{{ image_id }}' is_floating_ip_enabled: true keypair_id: '{{ keypair.keypair.id }}' + flavor_id: 'm1.small' + master_flavor_id: 'm1.small' name: k8s state: present register: coe_cluster_template diff --git a/ci/roles/floating_ip/tasks/main.yml b/ci/roles/floating_ip/tasks/main.yml index 76285f0e..aaad1ecd 100644 --- a/ci/roles/floating_ip/tasks/main.yml +++ b/ci/roles/floating_ip/tasks/main.yml @@ -241,7 +241,7 @@ that: - server1_fips is success - server1_fips is not changed - - server1_fips.floating_ips + - server1_fips.floating_ips|length > 0 # allow new fields to be introduced but prevent fields from being removed - expected_fields|difference(server1_fips.floating_ips[0].keys())|length == 0 @@ -260,7 +260,7 @@ - name: Assert return values of floating_ip module assert: that: - - floating_ip.floating_ip + - floating_ip.floating_ip|length > 0 # allow new fields to be introduced but prevent fields from being removed - expected_fields|difference(floating_ip.floating_ip.keys())|length == 0 @@ -312,7 +312,7 @@ - name: Assert floating ip attached to server 2 assert: that: - - server2_fip.floating_ip + - server2_fip.floating_ip|length > 0 - name: Find all floating ips for debugging openstack.cloud.floating_ip_info: diff --git a/ci/roles/inventory/tasks/main.yml b/ci/roles/inventory/tasks/main.yml index ea1a248d..2b98f70a 100644 --- a/ci/roles/inventory/tasks/main.yml +++ b/ci/roles/inventory/tasks/main.yml @@ -279,6 +279,11 @@ ansible.builtin.set_fact: cache: "{{ cache.content | b64decode | from_yaml }}" + - name: Further process Ansible 2.19+ cache + ansible.builtin.set_fact: + cache: "{{ cache.__payload__ | from_yaml }}" + when: cache.__payload__ is defined + - name: Check Ansible's cache assert: that: diff --git a/ci/roles/keypair/tasks/main.yml b/ci/roles/keypair/tasks/main.yml index 09e539c1..600f3c68 100644 --- a/ci/roles/keypair/tasks/main.yml +++ b/ci/roles/keypair/tasks/main.yml @@ -38,7 +38,7 @@ - name: Ensure public key is returned assert: that: - - keypair.keypair.public_key is defined and keypair.keypair.public_key + - keypair.keypair.public_key is defined and keypair.keypair.public_key|length > 0 - name: Create another keypair openstack.cloud.keypair: diff --git a/ci/roles/network/tasks/main.yml b/ci/roles/network/tasks/main.yml index 748aea9a..bbd59dc7 100644 --- a/ci/roles/network/tasks/main.yml +++ b/ci/roles/network/tasks/main.yml @@ -11,7 +11,7 @@ - name: Check output of creating network assert: that: - - infonet.network + - infonet.network is defined - item in infonet.network loop: "{{ expected_fields }}" diff --git a/tools/run-ansible-sanity.sh b/tools/run-ansible-sanity.sh index 30c2c97e..fc339993 100755 --- a/tools/run-ansible-sanity.sh +++ b/tools/run-ansible-sanity.sh @@ -24,7 +24,7 @@ echo "Running test with Python version ${PY_VER}" rm -rf "${ANSIBLE_COLLECTIONS_PATH}" mkdir -p ${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/openstack/cloud -cp -a ${TOXDIR}/{plugins,meta,tests,docs} ${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/openstack/cloud +cp -a ${TOXDIR}/{plugins,meta,tests,docs,galaxy.yml} ${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/openstack/cloud cd ${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/openstack/cloud/ echo "Running ansible-test with version:" ansible --version