Skip to content

Commit f98c204

Browse files
committed
Add Make targets that push to development clusters
1 parent 0276eff commit f98c204

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
IMAGE ?= localhost/postgres-operator:latest
23
PGMONITOR_DIR ?= hack/tools/pgmonitor
34
PGMONITOR_VERSION ?= v5.2.1
45
QUERIES_CONFIG_DIR ?= hack/tools/queries
@@ -45,7 +46,7 @@ notes: ## List known issues and future considerations
4546
.PHONY: clean
4647
clean: ## Clean resources
4748
clean: clean-deprecated
48-
rm -f bin/postgres-operator
49+
rm -f bin/postgres-operator image.tar
4950
rm -rf licenses/*/
5051
[ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated
5152
[ ! -d hack/tools/envtest ] || { chmod -R u+w hack/tools/envtest && rm -r hack/tools/envtest; }
@@ -134,14 +135,25 @@ deploy-dev: createnamespaces
134135
.PHONY: build
135136
build: ## Build a postgres-operator image
136137
build: get-pgmonitor
137-
$(BUILDAH) build --tag localhost/postgres-operator \
138+
$(BUILDAH) build --tag '$(IMAGE)' \
138139
--label org.opencontainers.image.authors='Crunchy Data' \
139140
--label org.opencontainers.image.description='Crunchy PostgreSQL Operator' \
140141
--label org.opencontainers.image.revision='$(shell git rev-parse HEAD)' \
141142
--label org.opencontainers.image.source='https://github.com/CrunchyData/postgres-operator' \
142143
--label org.opencontainers.image.title='Crunchy PostgreSQL Operator' \
143144
.
144145

146+
build-k3d: image.tar ; $(or $(K3D),k3d) image import $<
147+
build-kind: image.tar ; $(or $(KIND),kind) load image-archive $<
148+
build-minikube: image.tar ; $(or $(MINIKUBE),minikube) image load $<
149+
150+
image.tar: build
151+
set -x && \
152+
case '$(BUILDAH)' in \
153+
*docker*) $(BUILDAH) image save '--output=$@' '$(IMAGE)' ;; \
154+
*) $(BUILDAH) push '$(IMAGE)' 'oci-archive:$@:$(IMAGE)' ;; \
155+
esac
156+
145157
##@ Test
146158

147159
.PHONY: check

0 commit comments

Comments
 (0)