From b88284290397907e22b7de6eb949c731c9bb0c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Sat, 10 May 2025 11:10:54 +0200 Subject: [PATCH 1/4] feat: generalize container tool usage in bundle build target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Huß --- changelog/fragments/generalize-container-tool.yaml | 5 +++++ internal/plugins/manifests/v2/init.go | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelog/fragments/generalize-container-tool.yaml diff --git a/changelog/fragments/generalize-container-tool.yaml b/changelog/fragments/generalize-container-tool.yaml new file mode 100644 index 00000000000..c17e92bcfa9 --- /dev/null +++ b/changelog/fragments/generalize-container-tool.yaml @@ -0,0 +1,5 @@ +entries: + - description: > + The bundle build target now respects the CONTAINER_TOOL variable, allowing users to use alternative container tools like podman instead of docker. + kind: "change" + breaking: false \ No newline at end of file diff --git a/internal/plugins/manifests/v2/init.go b/internal/plugins/manifests/v2/init.go index 9d1708cf5d7..118ec48099b 100644 --- a/internal/plugins/manifests/v2/init.go +++ b/internal/plugins/manifests/v2/init.go @@ -241,7 +241,7 @@ bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then v makefileBundleBuildPushFragment = ` .PHONY: bundle-build bundle-build: ## Build the bundle image. - docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . + $(CONTAINER_TOOL) build -f bundle.Dockerfile -t $(BUNDLE_IMG) . .PHONY: bundle-push bundle-push: ## Push the bundle image. @@ -303,7 +303,7 @@ endif # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator .PHONY: catalog-build catalog-build: opm ## Build a catalog image. - $(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) + $(OPM) index add --container-tool $(CONTAINER_TOOL) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) # Push the catalog image. .PHONY: catalog-push From 3a2ff1a4e6ee6d36ce29d5bc550affe619b4c8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 14 May 2025 08:39:14 +0200 Subject: [PATCH 2/4] chore: regenerate dependent files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Huß --- testdata/go/v4/memcached-operator/Makefile | 4 ++-- testdata/go/v4/monitoring/memcached-operator/Makefile | 4 ++-- testdata/helm/memcached-operator/Makefile | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/testdata/go/v4/memcached-operator/Makefile b/testdata/go/v4/memcached-operator/Makefile index e726ae259f8..30c829b255d 100644 --- a/testdata/go/v4/memcached-operator/Makefile +++ b/testdata/go/v4/memcached-operator/Makefile @@ -279,7 +279,7 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada .PHONY: bundle-build bundle-build: ## Build the bundle image. - docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . + $(CONTAINER_TOOL) build -f bundle.Dockerfile -t $(BUNDLE_IMG) . .PHONY: bundle-push bundle-push: ## Push the bundle image. @@ -319,7 +319,7 @@ endif # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator .PHONY: catalog-build catalog-build: opm ## Build a catalog image. - $(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) + $(OPM) index add --container-tool $(CONTAINER_TOOL) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) # Push the catalog image. .PHONY: catalog-push diff --git a/testdata/go/v4/monitoring/memcached-operator/Makefile b/testdata/go/v4/monitoring/memcached-operator/Makefile index 4a4cf9d9935..e24d34aeb21 100644 --- a/testdata/go/v4/monitoring/memcached-operator/Makefile +++ b/testdata/go/v4/monitoring/memcached-operator/Makefile @@ -294,7 +294,7 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada .PHONY: bundle-build bundle-build: ## Build the bundle image. - docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . + $(CONTAINER_TOOL) build -f bundle.Dockerfile -t $(BUNDLE_IMG) . .PHONY: bundle-push bundle-push: ## Push the bundle image. @@ -334,7 +334,7 @@ endif # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator .PHONY: catalog-build catalog-build: opm ## Build a catalog image. - $(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) + $(OPM) index add --container-tool $(CONTAINER_TOOL) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) # Push the catalog image. .PHONY: catalog-push diff --git a/testdata/helm/memcached-operator/Makefile b/testdata/helm/memcached-operator/Makefile index 24d74b9ff10..54daf218bab 100644 --- a/testdata/helm/memcached-operator/Makefile +++ b/testdata/helm/memcached-operator/Makefile @@ -180,7 +180,7 @@ bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then v .PHONY: bundle-build bundle-build: ## Build the bundle image. - docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . + $(CONTAINER_TOOL) build -f bundle.Dockerfile -t $(BUNDLE_IMG) . .PHONY: bundle-push bundle-push: ## Push the bundle image. @@ -219,7 +219,7 @@ endif # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator .PHONY: catalog-build catalog-build: opm ## Build a catalog image. - $(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) + $(OPM) index add --container-tool $(CONTAINER_TOOL) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) # Push the catalog image. .PHONY: catalog-push From 4734c43effd9a438ae7d21b30c5b2695552f5917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 14 May 2025 20:27:35 +0200 Subject: [PATCH 3/4] Add container tool to non-Go operator makefiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Huß --- internal/plugins/manifests/v2/init.go | 3 +++ testdata/helm/memcached-operator/Makefile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/internal/plugins/manifests/v2/init.go b/internal/plugins/manifests/v2/init.go index 118ec48099b..b6d609b0880 100644 --- a/internal/plugins/manifests/v2/init.go +++ b/internal/plugins/manifests/v2/init.go @@ -230,6 +230,9 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada ` makefileBundleFragmentNonGo = ` +# Container tool to use for building images +CONTAINER_TOOL ?= docker + .PHONY: bundle bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files. $(OPERATOR_SDK) generate kustomize manifests -q diff --git a/testdata/helm/memcached-operator/Makefile b/testdata/helm/memcached-operator/Makefile index 54daf218bab..fb8e67cc254 100644 --- a/testdata/helm/memcached-operator/Makefile +++ b/testdata/helm/memcached-operator/Makefile @@ -171,6 +171,9 @@ OPERATOR_SDK = $(shell which operator-sdk) endif endif +# Container tool to use for building and pushing images +CONTAINER_TOOL ?= docker + .PHONY: bundle bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files. $(OPERATOR_SDK) generate kustomize manifests --interactive=false -q From c09f6887e370042534d5a2eccab5a89cd4c7dffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Thu, 15 May 2025 17:34:50 +0200 Subject: [PATCH 4/4] fixed comment in test-data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Huß --- testdata/helm/memcached-operator/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/helm/memcached-operator/Makefile b/testdata/helm/memcached-operator/Makefile index fb8e67cc254..bdf62cfc234 100644 --- a/testdata/helm/memcached-operator/Makefile +++ b/testdata/helm/memcached-operator/Makefile @@ -171,7 +171,7 @@ OPERATOR_SDK = $(shell which operator-sdk) endif endif -# Container tool to use for building and pushing images +# Container tool to use for building images CONTAINER_TOOL ?= docker .PHONY: bundle