From 8be06982bfdea17c342050dd2b60b249dd86a14b Mon Sep 17 00:00:00 2001 From: Luca Burgazzoli Date: Mon, 8 Apr 2024 12:35:22 +0200 Subject: [PATCH] Set openshift version in OLM annotations --- Makefile | 5 ++++- hack/scripts/gen_bundle.sh | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 79b8970..dd0291b 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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. diff --git a/hack/scripts/gen_bundle.sh b/hack/scripts/gen_bundle.sh index 5eb37d7..a630419 100755 --- a/hack/scripts/gen_bundle.sh +++ b/hack/scripts/gen_bundle.sh @@ -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}" @@ -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}"