1- FROM scratch
1+ FROM registry.redhat.io/ubi9/ubi-minimal:9.7 as builder
2+ ARG RELATED_IMAGE_FILE=related_images.json
3+ ARG CSV_FILE=bundle/manifests/openstack-lightspeed-operator.clusterserviceversion.yaml
4+ ARG OPERATOR_IMAGE_ORIGINAL=quay.io/openstack-lightspeed/operator:latest
5+
6+ RUN microdnf install -y jq
7+
8+ COPY ${CSV_FILE} /manifests/openstack-lightspeed-operator.clusterserviceversion.yaml
9+ COPY ${RELATED_IMAGE_FILE} /${RELATED_IMAGE_FILE}
10+
11+ RUN OPERATOR_IMAGE=$(jq -r '.[] | select(.name == "openstack-lightspeed-operator") | .image' /${RELATED_IMAGE_FILE}) && sed -i "s|${OPERATOR_IMAGE_ORIGINAL}|${OPERATOR_IMAGE}|g" /manifests/openstack-lightspeed-operator.clusterserviceversion.yaml
12+
13+ FROM registry.redhat.io/ubi9/ubi-minimal:9.7
214
315# Core bundle labels.
416LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
517LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
618LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
719LABEL operators.operatorframework.io.bundle.package.v1=openstack-lightspeed-operator
820LABEL operators.operatorframework.io.bundle.channels.v1=alpha
21+ LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
922LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.38.0
1023LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
1124LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4
@@ -18,3 +31,6 @@ LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
1831COPY bundle/manifests /manifests/
1932COPY bundle/metadata /metadata/
2033COPY bundle/tests/scorecard /tests/scorecard/
34+
35+ # Copy the CSV file with replaced image references
36+ COPY --from=builder /manifests/openstack-lightspeed-operator.clusterserviceversion.yaml /manifests/openstack-lightspeed-operator.clusterserviceversion.yaml
0 commit comments