From 4d9c92f4392c0da9635e6883079a4ce5af28966a Mon Sep 17 00:00:00 2001 From: dd di cesare Date: Thu, 7 Sep 2023 13:48:59 +0200 Subject: [PATCH 1/3] [workflow] Adding channels input for bundle creation --- .github/workflows/build-images-base.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-images-base.yaml b/.github/workflows/build-images-base.yaml index e4132b14..cbf4ebb8 100644 --- a/.github/workflows/build-images-base.yaml +++ b/.github/workflows/build-images-base.yaml @@ -15,6 +15,10 @@ on: description: Limitador version default: latest type: string + channels: + description: Bundle and catalog channels, comma separated + default: preview + type: string workflow_dispatch: inputs: operatorVersion: @@ -29,6 +33,10 @@ on: description: Limitador version default: latest type: string + channels: + description: Bundle and catalog channels, comma separated + default: preview + type: string env: IMG_TAGS: ${{ github.sha }} ${{ inputs.operatorTag }} @@ -90,8 +98,13 @@ jobs: - name: Run make bundle id: make-bundle run: | - make bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \ - VERSION=${{ env.VERSION }} IMAGE_TAG=${{ inputs.operatorTag }} LIMITADOR_VERSION=${{ inputs.limitadorVersion }} + make bundle \ + REGISTRY=${{ env.IMG_REGISTRY_HOST }} \ + ORG=${{ env.IMG_REGISTRY_ORG }} \ + VERSION=${{ env.VERSION }} \ + IMAGE_TAG=${{ inputs.operatorTag }} \ + LIMITADOR_VERSION=${{ inputs.limitadorVersion }} \ + CHANNELS=${{ inputs.channels }} - name: Build Image id: build-image uses: redhat-actions/buildah-build@v2 From 81e8e008455f8c917c05fb4fe74ca4ab00fc3278 Mon Sep 17 00:00:00 2001 From: dd di cesare Date: Mon, 11 Sep 2023 12:29:55 +0200 Subject: [PATCH 2/3] [catalog] Adding channels to the catalog generation files * Right now it works only with one channel --- make/catalog.mk | 3 ++- utils/generate-catalog.sh | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/make/catalog.mk b/make/catalog.mk index 46040bfd..a25f7183 100644 --- a/make/catalog.mk +++ b/make/catalog.mk @@ -16,11 +16,12 @@ $(CATALOG_FILE): $(OPM) $(YQ) @echo Build limitador operator catalog @echo @echo BUNDLE_IMG = $(BUNDLE_IMG) + @echo CHANNELS = $(CHANNELS) @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) $@ + $(PROJECT_PATH)/utils/generate-catalog.sh $(OPM) $(YQ) $(BUNDLE_IMG) $(CHANNELS) $@ .PHONY: catalog catalog: $(OPM) ## Generate catalog content and validate. diff --git a/utils/generate-catalog.sh b/utils/generate-catalog.sh index 666470b5..19938429 100755 --- a/utils/generate-catalog.sh +++ b/utils/generate-catalog.sh @@ -6,13 +6,14 @@ set -euo pipefail ### CONSTANTS # Used as well in the subscription object -CHANNEL_NAME=preview +DEFAULT_CHANNEL=preview ### OPM="${1?:Error \$OPM not set. Bye}" YQ="${2?:Error \$YQ not set. Bye}" BUNDLE_IMG="${3?:Error \$BUNDLE_IMG not set. Bye}" -CATALOG_FILE="${4?:Error \$CATALOG_FILE not set. Bye}" +CHANNELS="${4:-$DEFAULT_CHANNEL}" +CATALOG_FILE="${5?:Error \$CATALOG_FILE not set. Bye}" CATALOG_FILE_BASEDIR="$( cd "$( dirname "$(realpath ${CATALOG_FILE})" )" && pwd )" CATALOG_BASEDIR="$( cd "$( dirname "$(realpath ${CATALOG_FILE_BASEDIR})" )" && pwd )" @@ -28,11 +29,12 @@ touch ${CATALOG_FILE} # Limitador Operator ### # Add the package -${OPM} init limitador-operator --default-channel=${CHANNEL_NAME} --output yaml >> ${CATALOG_FILE} +${OPM} init limitador-operator --default-channel=${CHANNELS} --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` \ - ${YQ} eval '(.entries[0].name = strenv(V))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE} +CHANNELS=${CHANNELS} \ + ${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE} rm -rf $TMP_DIR From 831408929dca6ffc6eb38b99001dd237b05cd362 Mon Sep 17 00:00:00 2001 From: dd di cesare Date: Mon, 11 Sep 2023 12:31:22 +0200 Subject: [PATCH 3/3] [workflow] Adding CHANNELS env to `make catalog` --- .github/workflows/build-images-base.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-images-base.yaml b/.github/workflows/build-images-base.yaml index cbf4ebb8..707fc2a6 100644 --- a/.github/workflows/build-images-base.yaml +++ b/.github/workflows/build-images-base.yaml @@ -141,8 +141,11 @@ jobs: uses: actions/checkout@v3 - name: Generate Catalog Content run: | - make catalog REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \ - VERSION=${{ env.VERSION }} IMAGE_TAG=${{ inputs.operatorTag }} LIMITADOR_VERSION=${{ inputs.limitadorVersion }} + make catalog \ + REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \ + VERSION=${{ env.VERSION }} IMAGE_TAG=${{ inputs.operatorTag }} \ + LIMITADOR_VERSION=${{ inputs.limitadorVersion }} \ + CHANNELS=${{ inputs.channels }} - name: Install qemu dependency run: | sudo apt-get update