diff --git a/Makefile b/Makefile index dd482c054c8..e220788c9b5 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,8 @@ ENVTEST_K8S_VERSION = 1.32 #refers to the version of kubebuilder assets to be do GOLANGCI_LINT_VERSION ?= v2.9.0 KUSTOMIZE_VERSION ?= v5.2.1 CONTROLLER_TOOLS_VERSION ?= v0.16.5 -OPM_VERSION ?= v1.23.0 +# Also defined in build/Dockerfile.catalog — keep in sync +OPM_VERSION ?= v1.68.0 BRANCH_VERSION = oadp-dev PREVIOUS_CHANNEL ?= oadp-1.5 PREVIOUS_CHANNEL_GO_VERSION ?= 1.23 @@ -417,6 +418,42 @@ catalog-build: opm ## Build a catalog image. $(CONTAINER_TOOL) build --load $(DOCKER_BUILD_ARGS) -f catalog.Dockerfile -t $(CATALOG_IMG) . rm -rf catalog.Dockerfile catalog/ +# Build a catalog image using build/Dockerfile.catalog (self-contained, used by CI). +# Passes OPM_VERSION from this Makefile to keep the two in sync. +# +# Use case: test the same Dockerfile that CI uses, locally. +# make catalog-fbc-build BUNDLE_IMG=quay.io/konveyor/oadp-operator-bundle:latest +# make catalog-push +# +# Then install on-cluster: +# OLMv0 (CatalogSource + Subscription): +# make deploy-olm CATALOG_IMG=$(CATALOG_IMG) +# OLMv1 (ClusterExtension): +# kubectl apply -f - < +# +# Or directly: +# podman build -f build/Dockerfile.catalog \ +# --build-arg BUNDLE_IMG= \ +# -t . +# +# After building, push and install on-cluster: +# make catalog-push +# OLMv0: make deploy-olm CATALOG_IMG= +# OLMv1: create a ClusterExtension referencing the oadp-operator package +# (see Makefile catalog-fbc-build comments for full example) +# +# ci-operator: set BUNDLE_IMG via build_args in the ci-operator config. +# The bundle image must be pushed to a registry accessible during the build. +# +# Reference: networking-incubator/coraza-kubernetes-operator catalog/Dockerfile + +# Keep OPM_VERSION in sync with Makefile. Override via --build-arg or `make catalog-fbc-build`. +ARG OPM_VERSION=v1.68.0 + +FROM quay.io/operator-framework/opm:${OPM_VERSION} AS opm + +FROM registry.access.redhat.com/ubi9/ubi-minimal AS builder + +COPY --from=opm /bin/opm /bin/opm + +# Allow opm to pull bundle images from CI registries without signature verification +RUN mkdir -p /etc/containers && \ + echo '{"default":[{"type":"insecureAcceptAnything"}]}' > /etc/containers/policy.json + +ARG BUNDLE_IMG +ARG VERSION=99.0.0 +ARG DEFAULT_CHANNEL=dev + +RUN test -n "${BUNDLE_IMG}" || (echo "BUNDLE_IMG build-arg is required" >&2; exit 1) && \ + mkdir -p /configs/oadp-operator && \ + /bin/opm render "${BUNDLE_IMG}" -o yaml > /configs/oadp-operator/index.yaml && \ + cat >> /configs/oadp-operator/index.yaml <