From 1567212ea0d0bd314efe9a0a265ea000ab2b0dce Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Wed, 8 May 2024 16:59:18 +0200 Subject: [PATCH 1/3] Change STO/SGO bundles sanity check stdout for "oc image info" should be checked instead of the rc to make sure that the correct bundle is being used --- .../stf-run-ci/tasks/setup_registry_auth.yml | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/build/stf-run-ci/tasks/setup_registry_auth.yml b/build/stf-run-ci/tasks/setup_registry_auth.yml index bd33b819..377acad1 100644 --- a/build/stf-run-ci/tasks/setup_registry_auth.yml +++ b/build/stf-run-ci/tasks/setup_registry_auth.yml @@ -90,15 +90,35 @@ register: sto_bundle_info ignore_errors: true +- name: Print STO bundle info + ansible.builtin.debug: + msg: + - "{{ sto_bundle_info }}" + +- name: Fail is the expected STO bundle was not correctly fetched + ansible.builtin.fail: + msg: "The requested STO bundle couldn't be retrieved from the bundle registry. Check configuration for the bundles registry and retry." + when: "__service_telemetry_bundle_image_path not in sto_bundle_info.stdout" + - name: Try to access to the SGO bundle ansible.builtin.command: oc image info {{ __smart_gateway_bundle_image_path }} register: sgo_bundle_info ignore_errors: true +- name: Print SGO bundle info + ansible.builtin.debug: + msg: + - "{{ sgo_bundle_info }}" + +- name: Fail is the expected SGO bundle was not correctly fetched + ansible.builtin.fail: + msg: "The requested SGO bundle couldn't be retrieved from the bundle registry. Check configuration for the bundles registry and retry." + when: "__smart_gateway_bundle_image_path not in sgo_bundle_info.stdout" + - name: Check successful read access to STO and SGO bundles in the internal registry ansible.builtin.assert: that: - - sto_bundle_info.rc != 0 - - sgo_bundle_info.rc != 0 + - '__service_telemetry_bundle_image_path in sto_bundle_info.stdout' + - '__smart_gateway_bundle_image_path in sgo_bundle_info.stdout' fail_msg: "Bundles couldn't be retrieved. Check configuration for the bundles registry and retry." success_msg: "Bundles were correctly retrieved from the registry." From 8ecdc6646bf7efdb56519593f49e6b2e0f5f5cb1 Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Thu, 9 May 2024 10:16:35 +0200 Subject: [PATCH 2/3] Drop the "successful read bundles" assertion Make checks simpler and more granular by using the fail module instead of the assertion for each of the bundles. --- build/stf-run-ci/tasks/setup_registry_auth.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/build/stf-run-ci/tasks/setup_registry_auth.yml b/build/stf-run-ci/tasks/setup_registry_auth.yml index 377acad1..07fd13e9 100644 --- a/build/stf-run-ci/tasks/setup_registry_auth.yml +++ b/build/stf-run-ci/tasks/setup_registry_auth.yml @@ -114,11 +114,3 @@ ansible.builtin.fail: msg: "The requested SGO bundle couldn't be retrieved from the bundle registry. Check configuration for the bundles registry and retry." when: "__smart_gateway_bundle_image_path not in sgo_bundle_info.stdout" - -- name: Check successful read access to STO and SGO bundles in the internal registry - ansible.builtin.assert: - that: - - '__service_telemetry_bundle_image_path in sto_bundle_info.stdout' - - '__smart_gateway_bundle_image_path in sgo_bundle_info.stdout' - fail_msg: "Bundles couldn't be retrieved. Check configuration for the bundles registry and retry." - success_msg: "Bundles were correctly retrieved from the registry." From d5d83625adb0fd6f05a012ec92d587d15a3d7f5d Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Fri, 10 May 2024 10:03:46 +0200 Subject: [PATCH 3/3] Update build/stf-run-ci/tasks/setup_registry_auth.yml Co-authored-by: Chris Sibbitt --- build/stf-run-ci/tasks/setup_registry_auth.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/stf-run-ci/tasks/setup_registry_auth.yml b/build/stf-run-ci/tasks/setup_registry_auth.yml index 07fd13e9..5c096fdc 100644 --- a/build/stf-run-ci/tasks/setup_registry_auth.yml +++ b/build/stf-run-ci/tasks/setup_registry_auth.yml @@ -95,7 +95,7 @@ msg: - "{{ sto_bundle_info }}" -- name: Fail is the expected STO bundle was not correctly fetched +- name: Fail if the expected STO bundle was not correctly fetched ansible.builtin.fail: msg: "The requested STO bundle couldn't be retrieved from the bundle registry. Check configuration for the bundles registry and retry." when: "__service_telemetry_bundle_image_path not in sto_bundle_info.stdout"