Skip to content

Commit

Permalink
Merge pull request #455 from redhat-openshift-ecosystem/ISV-4161
Browse files Browse the repository at this point in the history
[ISV-4161] Ensure target bundle exists before upgrading
  • Loading branch information
mporrato authored Oct 19, 2023
2 parents 946ff3f + a6fdc00 commit 97d02eb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions upstream/roles/test_operator_update/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
set_fact:
tou_operator_bundle_for_install: "{{ production_registry_namespace }}/{{ operator_package_name }}:v{{ tou_upgrade_from }}"
tou_operator_bundle_for_upgrade: "{{ tou_local_registry_namespace }}/{{ operator_package_name }}:v{{ tou_upgrade_to }}"
tou_operator_bundle_for_upgrade_external: "{{ production_registry_namespace }}/{{ operator_package_name }}:v{{ tou_upgrade_to }}"
when:
- cluster_type is defined
- cluster_type == "k8s"
Expand All @@ -60,6 +61,7 @@
set_fact:
tou_operator_bundle_for_install: "{{ external_production_registry_namespace }}/{{ operator_package_name }}:v{{ tou_upgrade_from }}"
tou_operator_bundle_for_upgrade: "quay.io/{{ test_quay_namespace }}/{{ operator_package_name }}:{{ commit_tag }}"
tou_operator_bundle_for_upgrade_external: "{{ external_production_registry_namespace }}/{{ operator_package_name }}:v{{ tou_upgrade_to }}"
when: (cluster_type is not defined) or (cluster_type != "k8s")

- name: "Check if OLM is needed"
Expand Down Expand Up @@ -89,6 +91,16 @@
- name: "Create namespace for upgrade tests"
shell: "{{ oc_bin_path }} create ns {{ tou_namespace_for_upgrades }}"

- name: "Check if {{ tou_operator_bundle_for_upgrade }} exists"
shell: "skopeo inspect docker://{{ tou_operator_bundle_for_upgrade }}"
register: inspect_bundle_for_upgrade
ignore_errors: true

- name: "Import {{ tou_operator_bundle_for_upgrade }}"
shell: "skopeo copy docker://{{ tou_operator_bundle_for_upgrade_external }} docker://{{ tou_operator_bundle_for_upgrade }}"
when:
- inspect_bundle_for_upgrade is failed

- name: "Installing {{ tou_operator_bundle_for_install }} with {{ sdk_version_for_upgrade.stdout }}"
shell: "{{ operator_sdk_bin_path }} run bundle {{ tou_operator_bundle_for_install }} -n {{ tou_namespace_for_upgrades }} --skip-tls-verify"
register: tou_n_1_rc
Expand Down

0 comments on commit 97d02eb

Please sign in to comment.