Skip to content

Commit

Permalink
Set openshift version in OLM annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Apr 8, 2024
1 parent d6b1833 commit 8be0698
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ HELM_CHART ?= dapr
HELM_CHART_VERSION ?= 1.13.1
HELM_CHART_URL ?= https://raw.githubusercontent.com/dapr/helm-charts/master/dapr-$(HELM_CHART_VERSION).tgz

OPENSHIFT_VERSIONS ?= v4.13-v4.15

## Tool Versions
CODEGEN_VERSION ?= v0.28.8
KUSTOMIZE_VERSION ?= v5.3.0
Expand Down Expand Up @@ -238,7 +240,8 @@ bundle/generate: generate manifests kustomize operator-sdk yq ## Generate bundle
$(PROJECT_PATH)/hack/scripts/gen_bundle.sh \
$(PROJECT_PATH) \
$(PROJECT_NAME) \
$(BUNDLE_VERSION)
$(BUNDLE_VERSION) \
$(OPENSHIFT_VERSIONS)

.PHONY: bundle/build
bundle/build: ## Build bundle image.
Expand Down
13 changes: 9 additions & 4 deletions hack/scripts/gen_bundle.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/sh

if [ $# -ne 3 ]; then
echo "project root, bundle name, bundle version are expected"
echo "project root, bundle name, bundle version, openshift versions are expected"
fi

PROJECT_ROOT="$1"
BUNDLE_NAME="$2"
BUNDLE_VERSION="$3"
export PROJECT_ROOT="$1"
export BUNDLE_NAME="$2"
export BUNDLE_VERSION="$3"
export OPENSHIFT_VERSIONS="$4"

rm -rf "${PROJECT_ROOT}/bundle/${BUNDLE_NAME}"

Expand Down Expand Up @@ -34,6 +35,10 @@ ${PROJECT_ROOT}/bin/yq -i \
'.metadata.annotations.containerImage = .spec.install.spec.deployments[0].spec.template.spec.containers[0].image' \
"${PROJECT_ROOT}/bundle/${BUNDLE_NAME}/manifests/${BUNDLE_NAME}.clusterserviceversion.yaml"

${PROJECT_ROOT}/bin/yq -i \
'.annotations."com.redhat.openshift.versions" = env(OPENSHIFT_VERSIONS)' \
"${PROJECT_ROOT}/bundle/${BUNDLE_NAME}/metadata/annotations.yaml"

echo "Validate bundle"

${PROJECT_ROOT}/bin/operator-sdk bundle validate "${PROJECT_ROOT}/bundle/${BUNDLE_NAME}"

0 comments on commit 8be0698

Please sign in to comment.