From 86fc81fd8cf3ec6767b18829dc512268dc3f2bbc Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Wed, 17 Feb 2021 17:14:32 +0100 Subject: [PATCH] Change the version check to use app label A change in pulpcore (status API) requires us to change the version test to use the app label instead of the repository name. Along with this change we introduce a legacy lookup as a fallback to not break all CI at the same time. [noissue] --- .../github/.ci/ansible/start_container.yaml | 27 ++++++++++++++----- .../workflows/scripts/before_install.sh.j2 | 3 ++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/templates/github/.ci/ansible/start_container.yaml b/templates/github/.ci/ansible/start_container.yaml index 43d4d470..98eaa665 100644 --- a/templates/github/.ci/ansible/start_container.yaml +++ b/templates/github/.ci/ansible/start_container.yaml @@ -81,13 +81,26 @@ command: "docker logs pulp" failed_when: true - - name: "Check version of component being tested" - assert: - that: - - (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] | canonical_semver == (component_version | canonical_semver) - fail_msg: | - Component {{ component_name }} was expected to be installed in version {{ component_version }}. - Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] }}. + - block: + - name: "Check the component is in status" + assert: + that: + - component_name in (result.json.versions | items2dict(key_name="component", value_name="version") | keys) + - name: "Check version of component being tested" + assert: + that: + - (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] | canonical_semver == (component_version | canonical_semver) + fail_msg: | + Component {{ component_name }} was expected to be installed in version {{ component_version }}. + Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] }}. + rescue: + - name: "Check version of component being tested (legacy)" + assert: + that: + - (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] | canonical_semver == (component_version | canonical_semver) + fail_msg: | + Component {{ legacy_component_name }} was expected to be installed in version {{ component_version }}. + Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] }}. - name: "Set pulp password in .netrc" copy: diff --git a/templates/github/.github/workflows/scripts/before_install.sh.j2 b/templates/github/.github/workflows/scripts/before_install.sh.j2 index 6e6d077c..31b4ac5f 100755 --- a/templates/github/.github/workflows/scripts/before_install.sh.j2 +++ b/templates/github/.github/workflows/scripts/before_install.sh.j2 @@ -29,7 +29,8 @@ else fi mkdir .ci/ansible/vars || true echo "---" > .ci/ansible/vars/main.yaml -echo "component_name: {{ plugin_snake }}" >> .ci/ansible/vars/main.yaml +echo "legacy_component_name: {{ plugin_snake }}" >> .ci/ansible/vars/main.yaml +echo "component_name: {{ plugin_app_label }}" >> .ci/ansible/vars/main.yaml echo "component_version: '${COMPONENT_VERSION}'" >> .ci/ansible/vars/main.yaml export PRE_BEFORE_INSTALL=$PWD/.github/workflows/scripts/pre_before_install.sh