From 2753b5bc42be56ddc6b47365eb77def918db8dc4 Mon Sep 17 00:00:00 2001 From: Sagi Shnaidman Date: Sat, 28 Mar 2020 16:11:04 +0300 Subject: [PATCH] Add SDK version to tests conditions Pass SDK version to ansible roles so we can skip testing of modules which are not supported for current SDK version Change-Id: I5d25c0a6827536434a8f17b2a0f7de0db4c78301 --- ci/run-ansible-tests-collection.sh | 7 ++++++- ci/run-collection.yml | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ci/run-ansible-tests-collection.sh b/ci/run-ansible-tests-collection.sh index 8f9c599d..21faacba 100644 --- a/ci/run-ansible-tests-collection.sh +++ b/ci/run-ansible-tests-collection.sh @@ -100,7 +100,12 @@ fi tox -ebuild ansible-galaxy collection build --force . --output-path ./build_artifact ansible-galaxy collection install $(ls build_artifact/openstack-cloud-*) --force +# Discover openstackSDK version +SDK_VER=$(python -c "import openstack; print(openstack.version.__version__)") pushd ci/ # run tests -ANSIBLE_COLLECTIONS_PATHS=${HOME}/.ansible/collections ansible-playbook -vvv ./run-collection.yml -e "cloud=${CLOUD} image=${IMAGE} ${ANSIBLE_VARS}" ${tag_opt} +ANSIBLE_COLLECTIONS_PATHS=${HOME}/.ansible/collections ansible-playbook \ + -vvv ./run-collection.yml \ + -e "sdk_version=${SDK_VER} cloud=${CLOUD} image=${IMAGE} ${ANSIBLE_VARS}" \ + ${tag_opt} popd diff --git a/ci/run-collection.yml b/ci/run-collection.yml index 4014af64..cce5d41f 100644 --- a/ci/run-collection.yml +++ b/ci/run-collection.yml @@ -12,7 +12,9 @@ # - { role: image, tags: image } - { role: keypair, tags: keypair } - { role: keystone_domain, tags: keystone_domain } - - { role: keystone_mapping, tags: keystone_mapping } + - role: keystone_mapping + tags: keystone_mapping + when: sdk_version is version(0.44, '>=') - { role: keystone_role, tags: keystone_role } - { role: network, tags: network } - { role: nova_flavor, tags: nova_flavor }