Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
Change operator index image to file-based (#1179)
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Macík <[email protected]>
  • Loading branch information
pmacik committed Jul 27, 2022
1 parent 1e4c572 commit 4a9aed0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .github/actions/setup-podman/opm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
opm=$(readlink -m bin/opm)
podman="/usr/bin/podman"
local_image="localhost:5000/sbo:bundle"

case "$1" in
render)
img=$2
"$podman" tag $img $local_image
"$podman" push --tls-verify=false $local_image
"$opm" render $local_image --output=yaml --use-http | sed -e "s,$local_image,$img,g"
;;
*)
"$opm" "$@"
;;
esac
4 changes: 3 additions & 1 deletion .github/workflows/pr-checks-build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ jobs:
which podman
BUILDAH_FORMAT=docker make SKIP_REGISTRY_LOGIN=true release-operator -o registry-login
make opm
OPM=.github/actions/setup-podman/opm BUILDAH_FORMAT=docker make SKIP_REGISTRY_LOGIN=true release-operator -o registry-login
mkdir -p ${ARTIFACTS}
Expand Down
17 changes: 16 additions & 1 deletion make/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ CSV_PACKAGE_NAME ?= service-binding-operator

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

OPERATOR_INDEX_NAME ?= $(CSV_PACKAGE_NAME)-index
OPERATOR_INDEX_DIR ?= $(OPERATOR_INDEX_NAME)
OPERATOR_INDEX_YAML ?= $(OPERATOR_INDEX_DIR)/index.yaml

.PHONY: build
## Build operator binary
build:
Expand Down Expand Up @@ -54,7 +58,18 @@ push-bundle-image: bundle-image registry-login

.PHONY: index-image
index-image: opm push-bundle-image
$(OPM) index add -u $(CONTAINER_RUNTIME) -p $(CONTAINER_RUNTIME) --bundles $(OPERATOR_BUNDLE_IMAGE_REF) --tag $(OPERATOR_INDEX_IMAGE_REF)
mkdir -p $(OPERATOR_INDEX_DIR)
-$(OPM) generate dockerfile $(OPERATOR_INDEX_NAME)
$(OPM) init $(CSV_PACKAGE_NAME) --default-channel=$(DEFAULT_OPERATOR_CHANNEL) --icon=$(PROJECT_DIR)/assets/icon/sbo-logo.svg --output=yaml > $(OPERATOR_INDEX_YAML)
$(OPM) render $(OPERATOR_BUNDLE_IMAGE_REF) --output=yaml >> $(OPERATOR_INDEX_YAML)
@echo "---" >> $(OPERATOR_INDEX_YAML)
@echo "schema: olm.channel" >> $(OPERATOR_INDEX_YAML)
@echo "package: $(CSV_PACKAGE_NAME)" >> $(OPERATOR_INDEX_YAML)
@echo "name: $(DEFAULT_OPERATOR_CHANNEL)" >> $(OPERATOR_INDEX_YAML)
@echo "entries:" >> $(OPERATOR_INDEX_YAML)
@echo "- name: $(CSV_PACKAGE_NAME).v$(VERSION)" >> $(OPERATOR_INDEX_YAML)
$(OPM) validate $(OPERATOR_INDEX_NAME)
$(CONTAINER_RUNTIME) build -f $(OPERATOR_INDEX_NAME).Dockerfile -t $(OPERATOR_INDEX_IMAGE_REF) .

.PHONY: push-index-image
# push index image
Expand Down
4 changes: 2 additions & 2 deletions make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ mockgen:
$(call go-install-tool,$(MOCKGEN),github.com/golang/mock/[email protected])

.PHONY: opm
OPM = $(shell pwd)/bin/opm
OPM ?= $(shell pwd)/bin/opm
opm:
ifeq (,$(wildcard $(OPM)))
ifeq (,$(shell which opm 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(OPM)) ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.19.1/$(OS)-$(ARCH)-opm ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.22.0/$(OS)-$(ARCH)-opm ;\
chmod +x $(OPM) ;\
}
else
Expand Down

0 comments on commit 4a9aed0

Please sign in to comment.