Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Commit a3785b4

Browse files
committed
Change operator index image to file-based (redhat-developer#1179)
Signed-off-by: Pavel Macík <[email protected]>
1 parent 7ba2f9d commit a3785b4

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

.github/actions/setup-podman/opm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
opm=$(readlink -m bin/opm)
3+
podman="/usr/bin/podman"
4+
local_image="localhost:5000/sbo:bundle"
5+
6+
case "$1" in
7+
render)
8+
img=$2
9+
"$podman" tag $img $local_image
10+
"$podman" push --tls-verify=false $local_image
11+
"$opm" render $local_image --output=yaml --use-http | sed -e "s,$local_image,$img,g"
12+
;;
13+
*)
14+
"$opm" "$@"
15+
;;
16+
esac

.github/workflows/pr-checks-build-images.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ jobs:
4949
5050
which podman
5151
52-
BUILDAH_FORMAT=docker make SKIP_REGISTRY_LOGIN=true release-operator -o registry-login
52+
make opm
53+
54+
OPM=.github/actions/setup-podman/opm BUILDAH_FORMAT=docker make SKIP_REGISTRY_LOGIN=true release-operator -o registry-login
5355
5456
mkdir -p ${ARTIFACTS}
5557

make/build.mk

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ CSV_PACKAGE_NAME ?= service-binding-operator
77

88
BUNDLE_METADATA_OPTS ?= --channels=$(OPERATOR_CHANNELS) --default-channel=$(DEFAULT_OPERATOR_CHANNEL)
99

10+
OPERATOR_INDEX_NAME ?= $(CSV_PACKAGE_NAME)-index
11+
OPERATOR_INDEX_DIR ?= $(OPERATOR_INDEX_NAME)
12+
OPERATOR_INDEX_YAML ?= $(OPERATOR_INDEX_DIR)/index.yaml
13+
1014
.PHONY: build
1115
## Build operator binary
1216
build:
@@ -54,7 +58,18 @@ push-bundle-image: bundle-image registry-login
5458

5559
.PHONY: index-image
5660
index-image: opm push-bundle-image
57-
$(OPM) index add -u $(CONTAINER_RUNTIME) -p $(CONTAINER_RUNTIME) --bundles $(OPERATOR_BUNDLE_IMAGE_REF) --tag $(OPERATOR_INDEX_IMAGE_REF)
61+
mkdir -p $(OPERATOR_INDEX_DIR)
62+
-$(OPM) generate dockerfile $(OPERATOR_INDEX_NAME)
63+
$(OPM) init $(CSV_PACKAGE_NAME) --default-channel=$(DEFAULT_OPERATOR_CHANNEL) --icon=$(PROJECT_DIR)/assets/icon/sbo-logo.svg --output=yaml > $(OPERATOR_INDEX_YAML)
64+
$(OPM) render $(OPERATOR_BUNDLE_IMAGE_REF) --output=yaml >> $(OPERATOR_INDEX_YAML)
65+
@echo "---" >> $(OPERATOR_INDEX_YAML)
66+
@echo "schema: olm.channel" >> $(OPERATOR_INDEX_YAML)
67+
@echo "package: $(CSV_PACKAGE_NAME)" >> $(OPERATOR_INDEX_YAML)
68+
@echo "name: $(DEFAULT_OPERATOR_CHANNEL)" >> $(OPERATOR_INDEX_YAML)
69+
@echo "entries:" >> $(OPERATOR_INDEX_YAML)
70+
@echo "- name: $(CSV_PACKAGE_NAME).v$(VERSION)" >> $(OPERATOR_INDEX_YAML)
71+
$(OPM) validate $(OPERATOR_INDEX_NAME)
72+
$(CONTAINER_RUNTIME) build -f $(OPERATOR_INDEX_NAME).Dockerfile -t $(OPERATOR_INDEX_IMAGE_REF) .
5873

5974
.PHONY: push-index-image
6075
# push index image

make/common.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ mockgen:
155155
$(call go-install-tool,$(MOCKGEN),github.com/golang/mock/[email protected])
156156

157157
.PHONY: opm
158-
OPM = $(shell pwd)/bin/opm
158+
OPM ?= $(shell pwd)/bin/opm
159159
opm:
160160
ifeq (,$(wildcard $(OPM)))
161161
ifeq (,$(shell which opm 2>/dev/null))
162162
@{ \
163163
set -e ;\
164164
mkdir -p $(dir $(OPM)) ;\
165-
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.19.1/$(OS)-$(ARCH)-opm ;\
165+
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.22.0/$(OS)-$(ARCH)-opm ;\
166166
chmod +x $(OPM) ;\
167167
}
168168
else

0 commit comments

Comments
 (0)