Skip to content

Commit

Permalink
[stf-run-ci] create_catalog: Update image for operator registry
Browse files Browse the repository at this point in the history
Check whether the default image can be accessed (registry.redhat.io
requires login) and use the upstream image if the default isn't available.
  • Loading branch information
elfiesmelfie committed Sep 8, 2023
1 parent 7a5dc56 commit caf0be5
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions build/stf-run-ci/tasks/create_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,37 @@
register: ose_op_registry_is
ignore_errors: true

- name: Create ImageStream for ose-operator-registry
ansible.builtin.command: oc import-image -n {{ namespace }} ose-operator-registry:{{ default_operator_registry_image_tag }} --from={{ default_operator_registry_image_base }}:{{ default_operator_registry_image_tag }} --confirm
# when: query('kubernetes.core.k8s', api_version='v1', kind='ImageStream', resource_name='ose-operator-registry', namespace=namespace) | length == 0
- ansible.builtin.set_fact:
operator_registry_image: "{{ default_operator_registry_image_base }}:{{ default_operator_registry_image_tag }}"

# --show-multiarch=true is used because you get an error (and rc!=0) when you query a multi-arch image without specifying the arch, even when the image exists
- name: "Try to get the image info for the operator registry image"
ansible.builtin.command:
cmd: oc image info --show-multiarch=true "{{ operator_registry_image }}"
ignore_errors: true
register: image_info

# TODO: try docker pull on the image and set accordingly.
# i.e. if we can pull/query the registry.redhat.io image, use it, else use quay
# TODO: Fix this to actually honour the check.
- name: "Test alternative operator image"
ansible.builtin.set_fact:
#operator_registry_image: "registry.redhat.io/openshift4/ose-operator-registry:v4.13"
operator_registry_image: "quay.io/openshift/origin-operator-registry:4.13"
#when: image_info.rc != 0

# TODO: Clean up the nameing and versioning, so we can have a source-agnostic image stream.
# TODO: Use the same tag as the image, using an appropriate filter to extract the version from the image.
- name: Create ImageStream for ose-operator-registry, if it doesn't already exist
ansible.builtin.command:
cmd: |
oc import-image -n {{ namespace }} ose-operator-registry:{{ default_operator_registry_image_tag }} --from={{ operator_registry_image }} --confirm
when: ose_op_registry_is.rc != 0
register: create_ose_is

- name: "Show the image stream"
ansible.debug.debug:
var: create_ose_is

- name: "Delete the existing imagestream, if it exists"
ansible.builtin.command: oc delete imagestream -n {{ namespace }} service-telemetry-framework-index
Expand Down Expand Up @@ -106,7 +133,7 @@
dockerfile: |
# The base image is expected to contain
# /bin/opm (with a serve subcommand) and /bin/grpc_health_probe
FROM registry.redhat.io/openshift4/ose-operator-registry:v4.13
FROM {{ operator_registry_image }}
COPY --chmod=666 index.yaml /configs/
Expand Down

0 comments on commit caf0be5

Please sign in to comment.