From 4aa9abb32d35d5d4556d04fdc5dc939ffb5ddb1e Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Tue, 24 Sep 2024 18:22:08 +0200 Subject: [PATCH 1/2] Makefile: default CHANNELS doc/development.md: channels doc on custom bundle section Signed-off-by: Eguzki Astiz Lezaun --- Makefile | 4 ++-- doc/development.md | 40 +++++++++++++++++++++++---------------- make/catalog.mk | 18 ++++++++---------- utils/generate-catalog.sh | 26 ++++++++++++------------- 4 files changed, 47 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index 22c4f87be..a12cbc919 100644 --- a/Makefile +++ b/Makefile @@ -23,9 +23,9 @@ 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..b0420654c 100644 --- a/doc/development.md +++ b/doc/development.md @@ -111,14 +111,16 @@ bundle and a custom catalog including the custom bundle. The `make bundle` target accepts the following variables: -| **Makefile Variable** | **Description** | **Default value** | **Notes** | -|---------------------------------|-------------------------------|-----------------------------------------------------|----------------------------------------------------------------------------------------------------| -| `IMG` | Kuadrant operator image URL | `quay.io/kuadrant/kuadrant-operator:latest` | `TAG` var could be use to build this URL, defaults to _latest_ if not provided | -| `VERSION` | Bundle version | `0.0.0` | | -| `LIMITADOR_OPERATOR_BUNDLE_IMG` | Limitador operator bundle URL | `quay.io/kuadrant/limitador-operator-bundle:latest` | `LIMITADOR_OPERATOR_VERSION` var could be used to build this, defaults to _latest_ if not provided | -| `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 | +| **Makefile Variable** | **Description** | **Default value** | **Notes** | +|---------------------------------|------------------------------------------------------|-----------------------------------------------------|----------------------------------------------------------------------------------------------------| +| `IMG` | Kuadrant operator image URL | `quay.io/kuadrant/kuadrant-operator:latest` | `TAG` var could be use to build this URL, defaults to _latest_ if not provided | +| `VERSION` | Bundle version | `0.0.0` | | +| `LIMITADOR_OPERATOR_BUNDLE_IMG` | Limitador operator bundle URL | `quay.io/kuadrant/limitador-operator-bundle:latest` | `LIMITADOR_OPERATOR_VERSION` var could be used to build this, defaults to _latest_ if not provided | +| `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 @@ -179,18 +183,22 @@ Make sure all the required bundles are pushed to the registry. It is required by The `make catalog` target accepts the following variables: -| **Makefile Variable** | **Description** | **Default value** | -|---------------------------------|------------------------------------|-----------------------------------------------------| -| `BUNDLE_IMG` | Kuadrant operator bundle image URL | `quay.io/kuadrant/kuadrant-operator-bundle:latest` | -| `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` | +| **Makefile Variable** | **Description** | **Default value** | +|---------------------------------|--------------------------------------------------------|-----------------------------------------------------| +| `BUNDLE_IMG` | Kuadrant operator bundle image URL | `quay.io/kuadrant/kuadrant-operator-bundle:latest` | +| `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` | +| `CHANNELS` | Bundle channels used in the bundle, comma separated | `alpha` | +| `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] \ + [CHANNELS=alpha] \ + [DEFAULT_CHANNEL=alpha] ``` * Build the catalog image from the manifests diff --git a/make/catalog.mk b/make/catalog.mk index c350e848a..7a25b86d7 100644 --- a/make/catalog.mk +++ b/make/catalog.mk @@ -25,25 +25,23 @@ $(CATALOG_DOCKERFILE): $(OPM) cd $(PROJECT_PATH)/catalog && $(OPM) generate dockerfile kuadrant-operator-catalog -l quay.expires-after=$(QUAY_IMAGE_EXPIRY) catalog-dockerfile: $(CATALOG_DOCKERFILE) ## Generate catalog dockerfile. -CHANNELS ?= preview - $(CATALOG_FILE): $(OPM) $(YQ) @echo "************************************************************" @echo Build kuadrant operator catalog @echo - @echo BUNDLE_IMG = $(BUNDLE_IMG) - @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 CATALOG_FILE = $@ + @echo BUNDLE_IMG = $(BUNDLE_IMG) + @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 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 From 421e7e152c2bb4cfbc065c39b8266bf9e644c073 Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Tue, 24 Sep 2024 18:27:48 +0200 Subject: [PATCH 2/2] .github/workflows/build-images-base.yaml: default channels input Signed-off-by: Eguzki Astiz Lezaun --- .github/workflows/build-images-base.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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