|
2 | 2 | # the operator name is defined in the variable "item". This |
3 | 3 | # set of tasks is to be included in a loop that goes over the |
4 | 4 | # needed operators |
5 | | -- name: Get default channel in the IIB for "{{ item }}" |
| 5 | +- name: Get default channel in the IIB for "{{ item.key }}" |
6 | 6 | ansible.builtin.shell: | |
7 | | - oc get -n "{{ internal_registry_ns }}" packagemanifests -l "catalog=iib-{{ iib }}" --field-selector "metadata.name={{ item }}" \ |
| 7 | + oc get -n "{{ internal_registry_ns }}" packagemanifests -l "catalog=iib-{{ item.value['iib'] }}" --field-selector "metadata.name={{ item.key }}" \ |
8 | 8 | -o jsonpath='{.items[0].status.defaultChannel}' |
9 | 9 | register: default_channel_raw |
10 | 10 | retries: 10 |
|
15 | 15 | ansible.builtin.set_fact: |
16 | 16 | default_channel: "{{ default_channel_raw.stdout }}" |
17 | 17 |
|
18 | | -- name: Get all related images in the IIB for "{{ item }}" |
| 18 | +- name: Print default channel |
| 19 | + ansible.builtin.debug: |
| 20 | + msg: "Default channel for {{ item.key }}: {{ default_channel }}" |
| 21 | + |
| 22 | +- name: Get all related images in the IIB for "{{ item.key }}" |
19 | 23 | ansible.builtin.shell: | |
20 | | - oc get packagemanifests -l "catalog=iib-{{ iib }}" --field-selector "metadata.name={{ item }}" \ |
| 24 | + oc get packagemanifests -l "catalog=iib-{{ item.value['iib'] }}" --field-selector "metadata.name={{ item.key }}" \ |
21 | 25 | -o jsonpath="{.items[0].status.channels[?(@.name==\"{{ default_channel }}\")].currentCSVDesc.relatedImages}" |
22 | 26 | register: related_images_raw |
23 | 27 | retries: 5 |
|
29 | 33 | related_images: "{{ related_images_raw.stdout }}" |
30 | 34 |
|
31 | 35 | # NOTE(bandini) |
32 | | -# The following code is here to fund out what the operator bundle image is and to make |
| 36 | +# The following code is here to find out what the operator bundle image is and to make |
33 | 37 | # sure it is on the internal registry. |
34 | 38 | # This is all potentially hacky, but so far I could not find a single place in the cluster |
35 | 39 | # where the olm.bundle image is available. The info is in there in the IIB, but it certainly |
36 | 40 | # is not in any package manifest nor catalogsource. This is why we resort to invoking opm |
37 | 41 | # alpha commands inside the IIB image locally |
38 | 42 | - name: Pull the IIB locally |
39 | 43 | ansible.builtin.command: |
40 | | - podman pull "{{ iib_image }}" |
| 44 | + podman pull "{{ item.value['iib_image'] }}" |
41 | 45 |
|
42 | 46 | # $ opm alpha list channels /configs advanced-cluster-management |
43 | 47 | # PACKAGE CHANNEL HEAD |
|
46 | 50 | - name: Read the operator bundle from the default channel |
47 | 51 | ansible.builtin.shell: | |
48 | 52 | set -o pipefail |
49 | | - podman run -it --rm "{{ iib_image }}" alpha list channels /configs "{{ item }}" | grep -E "(\s){{ default_channel }}(\s)" | awk '{ print $3 }' |
| 53 | + podman run -it --rm "{{ item.value['iib_image'] }}" alpha list channels /configs "{{ item.key }}" | grep -E "(\s){{ default_channel }}(\s)" | awk '{ print $3 }' |
50 | 54 | register: bundle_channel_raw |
51 | 55 |
|
52 | 56 | - name: Set bundle fact |
|
70 | 74 | - name: Get bundle image |
71 | 75 | ansible.builtin.shell: | |
72 | 76 | set -o pipefail |
73 | | - podman run -it --rm "{{ iib_image }}" alpha list bundles /configs "{{ item }}" | grep -e "{{ default_channel }}\s\+{{ bundle_channel }}" | awk '{ print $NF }' |
| 77 | + podman run -it --rm "{{ item.value['iib_image'] }}" alpha list bundles /configs "{{ item.key }}" | grep -e "{{ default_channel }}\s\+{{ bundle_channel }}" | awk '{ print $NF }' |
74 | 78 | register: bundle_image_raw |
75 | 79 |
|
76 | 80 | - name: Set bundle image fact |
|
0 commit comments