Skip to content

Add Make targets that push to development Kubernetes clusters #4237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ COPY hack/tools/queries /opt/crunchy/conf
WORKDIR /usr/src/app
COPY . .
ENV GOCACHE=/var/cache/go
ENV GOMODCACHE=/var/cache/go/mod
RUN --mount=type=cache,target=/var/cache/go go build ./cmd/postgres-operator

FROM docker.io/library/debian:bookworm
Expand Down
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

IMAGE ?= localhost/postgres-operator:latest
PGMONITOR_DIR ?= hack/tools/pgmonitor
PGMONITOR_VERSION ?= v5.2.1
QUERIES_CONFIG_DIR ?= hack/tools/queries
Expand Down Expand Up @@ -44,7 +45,7 @@ notes: ## List known issues and future considerations
.PHONY: clean
clean: ## Clean resources
clean: clean-deprecated
rm -f bin/postgres-operator
rm -f bin/postgres-operator image.tar
rm -rf licenses/*/
[ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated
[ ! -d hack/tools/envtest ] || { chmod -R u+w hack/tools/envtest && rm -r hack/tools/envtest; }
Expand Down Expand Up @@ -133,14 +134,25 @@ deploy-dev: createnamespaces

.PHONY: build
build: ## Build a postgres-operator image
$(BUILDAH) build --tag localhost/postgres-operator \
$(BUILDAH) build --tag '$(IMAGE)' \
--label org.opencontainers.image.authors='Crunchy Data' \
--label org.opencontainers.image.description='Crunchy PostgreSQL Operator' \
--label org.opencontainers.image.revision='$(shell git rev-parse HEAD)' \
--label org.opencontainers.image.source='https://github.com/CrunchyData/postgres-operator' \
--label org.opencontainers.image.title='Crunchy PostgreSQL Operator' \
.

build-k3d: image.tar ; $(or $(K3D),k3d) image import $<
build-kind: image.tar ; $(or $(KIND),kind) load image-archive $<
build-minikube: image.tar ; $(or $(MINIKUBE),minikube) image load $<

image.tar: build
set -x && \
case '$(BUILDAH)' in \
*docker*) $(BUILDAH) image save '--output=$@' '$(IMAGE)' ;; \
*) $(BUILDAH) push '$(IMAGE)' 'oci-archive:$@:$(IMAGE)' ;; \
esac

##@ Test

.PHONY: check
Expand Down
Loading