From a43c40ee76b8be03c1a79ac2dddaf47d87436f78 Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Fri, 27 Sep 2024 11:43:13 +0200 Subject: [PATCH] catalog only needs default channel (#880) * catalog only needs default channel Signed-off-by: Eguzki Astiz Lezaun * Makefile bundle channels always needed Signed-off-by: Eguzki Astiz Lezaun --------- Signed-off-by: Eguzki Astiz Lezaun --- .github/workflows/build-images-base.yaml | 11 +++++++++- Makefile | 3 +-- doc/development.md | 10 +++++++-- make/catalog.mk | 7 ++++--- utils/generate-catalog.sh | 26 ++++++++++++------------ 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-images-base.yaml b/.github/workflows/build-images-base.yaml index 5a917eb9d..7ea37057f 100644 --- a/.github/workflows/build-images-base.yaml +++ b/.github/workflows/build-images-base.yaml @@ -35,6 +35,10 @@ on: description: Bundle and catalog channels, comma separated default: preview type: string + defaultChannel: + description: Bundle default channel + default: preview + type: string quayImageExpiry: description: When to expire the built quay images. The time values could be something like 1h, 2d, 3w for hours, days, and weeks, respectively, from the time the image is built. default: never @@ -73,6 +77,10 @@ on: description: Bundle and catalog channels, comma separated default: preview type: string + defaultChannel: + description: Bundle default channel + default: preview + type: string quayImageExpiry: description: When to expire the built quay images. The time values could be something like 1h, 2d, 3w for hours, days, and weeks, respectively, from the time the image is built. default: never @@ -148,6 +156,7 @@ jobs: DNS_OPERATOR_VERSION=${{ inputs.dnsOperatorVersion }} \ WASM_SHIM_VERSION=${{ inputs.wasmShimVersion }} \ REPLACES_VERSION=${{ inputs.replacesVersion }} \ + DEFAULT_CHANNEL=${{ inputs.defaultChannel }} \ CHANNELS=${{ inputs.channels }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -196,7 +205,7 @@ jobs: DNS_OPERATOR_VERSION=${{ inputs.dnsOperatorVersion }} \ WASM_SHIM_VERSION=${{ inputs.wasmShimVersion }} \ REPLACES_VERSION=${{ inputs.replacesVersion }} \ - CHANNELS=${{ inputs.channels }} + DEFAULT_CHANNEL=${{ inputs.defaultChannel }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to container registry diff --git a/Makefile b/Makefile index 6c237fcc7..aee6192cd 100644 --- a/Makefile +++ b/Makefile @@ -23,9 +23,8 @@ VERSION ?= 0.0.0 # To re-generate a bundle for other specific channels without changing the standard setup, you can: # - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable) # - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable") -ifneq ($(origin CHANNELS), undefined) +CHANNELS ?= alpha BUNDLE_CHANNELS := --channels=$(CHANNELS) -endif # DEFAULT_CHANNEL defines the default channel used in the bundle. # Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable") diff --git a/doc/development.md b/doc/development.md index 229bf20c5..d4a340c4d 100644 --- a/doc/development.md +++ b/doc/development.md @@ -119,6 +119,8 @@ The `make bundle` target accepts the following variables: | `AUTHORINO_OPERATOR_BUNDLE_IMG` | Authorino operator bundle URL | `quay.io/kuadrant/authorino-operator-bundle:latest` | `AUTHORINO_OPERATOR_VERSION` var could be used to build this, defaults to _latest_ if not provided | | `DNS_OPERATOR_BUNDLE_IMG` | DNS operator bundle URL | `quay.io/kuadrant/dns-operator-bundle:latest` | `DNS_OPERATOR_BUNDLE_IMG` var could be used to build this, defaults to _latest_ if not provided | | `RELATED_IMAGE_WASMSHIM` | WASM shim image URL | `oci://quay.io/kuadrant/wasm-shim:latest` | `WASM_SHIM_VERSION` var could be used to build this, defaults to _latest_ if not provided | +| `CHANNELS` | Bundle channels used in the bundle, comma separated | `alpha` | | +| `DEFAULT_CHANNEL` | The default channel used in the bundle | `alpha` | | * Build the bundle manifests @@ -129,7 +131,9 @@ make bundle [IMG=quay.io/kuadrant/kuadrant-operator:latest] \ [LIMITADOR_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/limitador-operator-bundle:latest] \ [AUTHORINO_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/authorino-operator-bundle:latest] \ [DNS_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/dns-operator-bundle:latest] \ - [RELATED_IMAGE_WASMSHIM=oci://quay.io/kuadrant/wasm-shim:latest] + [RELATED_IMAGE_WASMSHIM=oci://quay.io/kuadrant/wasm-shim:latest] \ + [CHANNELS=alpha] \ + [DEFAULT_CHANNEL=alpha] ``` * Build the bundle image from the manifests @@ -185,12 +189,14 @@ The `make catalog` target accepts the following variables: | `LIMITADOR_OPERATOR_BUNDLE_IMG` | Limitador operator bundle URL | `quay.io/kuadrant/limitador-operator-bundle:latest` | | `AUTHORINO_OPERATOR_BUNDLE_IMG` | Authorino operator bundle URL | `quay.io/kuadrant/authorino-operator-bundle:latest` | | `DNS_OPERATOR_BUNDLE_IMG` | DNS operator bundle URL | `quay.io/kuadrant/dns-operator-bundle:latest` | +| `DEFAULT_CHANNEL` | Catalog default channel | `alpha` | ```sh make catalog [BUNDLE_IMG=quay.io/kuadrant/kuadrant-operator-bundle:latest] \ [LIMITADOR_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/limitador-operator-bundle:latest] \ [AUTHORINO_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/authorino-operator-bundle:latest] \ - [DNS_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/dns-operator-bundle:latest] + [DNS_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/dns-operator-bundle:latest] \ + [DEFAULT_CHANNEL=alpha] ``` * Build the catalog image from the manifests diff --git a/make/catalog.mk b/make/catalog.mk index c350e848a..de4b4889a 100644 --- a/make/catalog.mk +++ b/make/catalog.mk @@ -35,15 +35,16 @@ $(CATALOG_FILE): $(OPM) $(YQ) @echo REPLACES_VERSION = $(REPLACES_VERSION) @echo LIMITADOR_OPERATOR_BUNDLE_IMG = $(LIMITADOR_OPERATOR_BUNDLE_IMG) @echo AUTHORINO_OPERATOR_BUNDLE_IMG = $(AUTHORINO_OPERATOR_BUNDLE_IMG) - @echo DNS_OPERATOR_BUNDLE_IMG = $(DNS_OPERATOR_BUNDLE_IMG) - @echo CHANNELS = $(CHANNELS) + @echo DNS_OPERATOR_BUNDLE_IMG = $(DNS_OPERATOR_BUNDLE_IMG) + @echo CHANNEL = $(DEFAULT_CHANNEL) @echo CATALOG_FILE = $@ @echo "************************************************************" @echo @echo Please check this matches your expectations and override variables if needed. @echo $(PROJECT_PATH)/utils/generate-catalog.sh $(OPM) $(YQ) $(BUNDLE_IMG) $(REPLACES_VERSION)\ - $(LIMITADOR_OPERATOR_BUNDLE_IMG) $(AUTHORINO_OPERATOR_BUNDLE_IMG) $(DNS_OPERATOR_BUNDLE_IMG) $(CHANNELS) $@ + $(LIMITADOR_OPERATOR_BUNDLE_IMG) $(AUTHORINO_OPERATOR_BUNDLE_IMG)\ + $(DNS_OPERATOR_BUNDLE_IMG) $(DEFAULT_CHANNEL) $@ .PHONY: catalog catalog: $(OPM) ## Generate catalog content and validate. diff --git a/utils/generate-catalog.sh b/utils/generate-catalog.sh index 580dbb1bd..ea7e04791 100755 --- a/utils/generate-catalog.sh +++ b/utils/generate-catalog.sh @@ -11,7 +11,7 @@ REPLACES_VERSION="${4?:Error \$REPLACES_VERSION not set. Bye}" LIMITADOR_OPERATOR_BUNDLE_IMG="${5?:Error \$LIMITADOR_OPERATOR_BUNDLE_IMG not set. Bye}" AUTHORINO_OPERATOR_BUNDLE_IMG="${6?:Error \$AUTHORINO_OPERATOR_BUNDLE_IMG not set. Bye}" DNS_OPERATOR_BUNDLE_IMG="${7?:Error \$DNS_OPERATOR_BUNDLE_IMG not set. Bye}" -CHANNELS="${8?:Error \$CHANNELS not set. Bye}" +CHANNEL="${8?:Error \$CHANNEL not set. Bye}" CATALOG_FILE="${9?:Error \$CATALOG_FILE not set. Bye}" CATALOG_FILE_BASEDIR="$( cd "$( dirname "$(realpath ${CATALOG_FILE})" )" && pwd )" @@ -58,49 +58,49 @@ touch ${CATALOG_FILE} # Limitador Operator ### # Add the package -${OPM} init limitador-operator --default-channel=${CHANNELS} --output yaml >> ${CATALOG_FILE} +${OPM} init limitador-operator --default-channel=${CHANNEL} --output yaml >> ${CATALOG_FILE} # Add a bundles to the Catalog cat ${TMP_DIR}/limitador-operator-bundle.yaml >> ${CATALOG_FILE} # Add a channel entry for the bundle V=`${YQ} eval '.name' ${TMP_DIR}/limitador-operator-bundle.yaml` \ -CHANNELS=${CHANNELS} \ - ${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE} +CHANNEL=${CHANNEL} \ + ${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNEL))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE} ### # Authorino Operator ### # Add the package -${OPM} init authorino-operator --default-channel=${CHANNELS} --output yaml >> ${CATALOG_FILE} +${OPM} init authorino-operator --default-channel=${CHANNEL} --output yaml >> ${CATALOG_FILE} # Add a bundles to the Catalog cat ${TMP_DIR}/authorino-operator-bundle.yaml >> ${CATALOG_FILE} # Add a channel entry for the bundle V=`${YQ} eval '.name' ${TMP_DIR}/authorino-operator-bundle.yaml` \ -CHANNELS=${CHANNELS} \ - ${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/authorino-operator-channel-entry.yaml >> ${CATALOG_FILE} +CHANNEL=${CHANNEL} \ + ${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNEL))' ${CATALOG_BASEDIR}/authorino-operator-channel-entry.yaml >> ${CATALOG_FILE} ### # DNS Operator ### # Add the package -${OPM} init dns-operator --default-channel=${CHANNELS} --output yaml >> ${CATALOG_FILE} +${OPM} init dns-operator --default-channel=${CHANNEL} --output yaml >> ${CATALOG_FILE} # Add a bundles to the Catalog cat ${TMP_DIR}/dns-operator-bundle.yaml >> ${CATALOG_FILE} # Add a channel entry for the bundle V=`${YQ} eval '.name' ${TMP_DIR}/dns-operator-bundle.yaml` \ -CHANNELS=${CHANNELS} \ - ${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/dns-operator-channel-entry.yaml >> ${CATALOG_FILE} +CHANNEL=${CHANNEL} \ + ${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNEL))' ${CATALOG_BASEDIR}/dns-operator-channel-entry.yaml >> ${CATALOG_FILE} ### # Kuadrant Operator ### # Add the package -${OPM} init kuadrant-operator --default-channel=${CHANNELS} --output yaml >> ${CATALOG_FILE} +${OPM} init kuadrant-operator --default-channel=${CHANNEL} --output yaml >> ${CATALOG_FILE} # Add a bundles to the Catalog cat ${TMP_DIR}/kuadrant-operator-bundle.yaml >> ${CATALOG_FILE} # Add a channel entry for the bundle NAME=`${YQ} eval '.name' ${TMP_DIR}/kuadrant-operator-bundle.yaml` \ REPLACES=kuadrant-operator.v${REPLACES_VERSION} \ -CHANNELS=${CHANNELS} \ - ${YQ} eval '(.entries[0].name = strenv(NAME)) | (.entries[0].replaces = strenv(REPLACES)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/kuadrant-operator-channel-entry.yaml >> ${CATALOG_FILE} +CHANNEL=${CHANNEL} \ + ${YQ} eval '(.entries[0].name = strenv(NAME)) | (.entries[0].replaces = strenv(REPLACES)) | (.name = strenv(CHANNEL))' ${CATALOG_BASEDIR}/kuadrant-operator-channel-entry.yaml >> ${CATALOG_FILE} rm -rf $TMP_DIR