Skip to content

Commit

Permalink
catalog only needs default channel
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Sep 27, 2024
1 parent 50c5cea commit f0f2276
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 19 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build-images-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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")
CHANNELS ?= alpha
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif
Expand Down
10 changes: 8 additions & 2 deletions doc/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions make/catalog.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
26 changes: 13 additions & 13 deletions utils/generate-catalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 )"
Expand Down Expand Up @@ -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

0 comments on commit f0f2276

Please sign in to comment.