Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change STO/SGO bundles sanity check #595

Merged
merged 3 commits into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions build/stf-run-ci/tasks/setup_registry_auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,27 @@
register: sto_bundle_info
ignore_errors: true

- name: Print STO bundle info
ansible.builtin.debug:
msg:
- "{{ sto_bundle_info }}"

- 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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding verbosity, this check is the same as the assert below.

You could update the message for assert to list the failed bundle.
Something like:

fail_msg:
    "The requested bundle(s) ({% if __service_telemetry_bundle_image_path not in sto_bundle_info.stdout %}STO{%endif%}, {% if __smart_gateway_bundle_image_path not in sto_bundle_info.stdout %}SGO{%endif%}) couldn't be retrieved..."

i.e. use jinja2 templating to add in the name of the bundles(s) that weren't retrievable to the task in L98.
I'm assuming that you wanted to add these tests here so that there is a useful message to tell you which bundle was missing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review Emma. I opted for dropping the assertion altogether and just stick with the fail checks. Also, kept the debug, I think it's useful info.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair. looks good


- 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: 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
fail_msg: "Bundles couldn't be retrieved. Check configuration for the bundles registry and retry."
success_msg: "Bundles were correctly retrieved from the registry."
- 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"