Skip to content

Commit 2a13a22

Browse files
committed
Merge container build and kind-load make targets
Signed-off-by: Edmund Ochieng <[email protected]>
1 parent e340ba9 commit 2a13a22

File tree

1 file changed

+10
-29
lines changed

1 file changed

+10
-29
lines changed

Makefile

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ IMAGE_TAG := devel
2424
endif
2525
export IMAGE_TAG
2626

27+
CATALOGD_BINARIES=catalogd
28+
LINUX_BINARIES=$(join $(addprefix linux/,$(CATALOGD_BINARIES)), )
29+
30+
BUILDCMD = go build -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$(notdir $@) ./cmd/$(notdir $@)
31+
2732
IMG := $(IMAGE_REPO):$(IMAGE_TAG)
2833
CATALOGD_IMG := $(CATALOG_IMAGE_REPO):$(IMAGE_TAG)
2934

@@ -264,7 +269,7 @@ e2e-coverage:
264269
.PHONY: kind-load
265270
kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND cluster.
266271
$(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
267-
IMAGE_REPO=$(CATALOG_IMAGE_REPO) KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) $(MAKE) -f Makefile.catalogd kind-load
272+
$(CONTAINER_RUNTIME) save $(CATALOGD_IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
268273

269274
.PHONY: kind-deploy
270275
kind-deploy: export MANIFEST := ./operator-controller.yaml
@@ -325,16 +330,17 @@ go-build-linux: export GOARCH=amd64
325330
go-build-linux: $(BINARIES) go-build-catalogd-linux
326331

327332
.PHONY: run
328-
run: docker-build kind-cluster kind-load-catalogd kind-load kind-deploy wait #HELP Build the operator-controller then deploy it into a new kind cluster.
333+
run: docker-build kind-cluster kind-load kind-deploy wait #HELP Build the operator-controller then deploy it into a new kind cluster.
329334

330335
CATALOGD_NAMESPACE := olmv1-system
331336
wait:
332337
kubectl wait --for=condition=Available --namespace=$(CATALOGD_NAMESPACE) deployment/catalogd-controller-manager --timeout=60s
333338
kubectl wait --for=condition=Ready --namespace=$(CATALOGD_NAMESPACE) certificate/catalogd-service-cert # Avoid upgrade test flakes when reissuing cert
334339

335340
.PHONY: docker-build
336-
docker-build: build-linux build-catalogd-container #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.
341+
docker-build: build-linux #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.
337342
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux
343+
$(CONTAINER_RUNTIME) build -f Dockerfile.catalogd -t $(CATALOGD_IMG) ./bin/linux
338344

339345
#SECTION Release
340346
ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined)
@@ -349,7 +355,7 @@ export GORELEASER_ARGS
349355

350356
.PHONY: release
351357
release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By default, this will run only as a snapshot and will not publish any artifacts unless it is run with different arguments. To override the arguments, run with "GORELEASER_ARGS=...". When run as a github action from a tag, this target will publish a full release.
352-
OPERATOR_CONTROLLER_IMAGE_REPO=$(IMAGE_REPO) CATALOGD_IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(GORELEASER) $(GORELEASER_ARGS)
358+
OPERATOR_CONTROLLER_IMAGE_REPO=$(IMAGE_REPO) CATALOG_IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(GORELEASER) $(GORELEASER_ARGS)
353359

354360
.PHONY: quickstart
355361
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml
@@ -392,23 +398,6 @@ demo-update:
392398
./hack/demo/generate-asciidemo.sh -u -n catalogd-demo catalogd-demo-script.sh
393399

394400
# Catalogd targets
395-
ifeq ($(origin CATALOGD_IMAGE_REPO), undefined)
396-
CATALOGD_IMAGE_REPO := quay.io/operator-framework/catalogd
397-
endif
398-
export CATALOGD_IMAGE_REPO
399-
400-
ifeq ($(origin CATALOGD_IMAGE_TAG), undefined)
401-
CATALOGD_IMAGE_TAG := devel
402-
endif
403-
export CATALOGD_IMAGE_TAG
404-
405-
CATALOGD_IMAGE := $(CATALOGD_IMAGE_REPO):$(CATALOGD_IMAGE_TAG)
406-
407-
CATALOGD_BINARIES=catalogd
408-
LINUX_BINARIES=$(join $(addprefix linux/,$(CATALOGD_BINARIES)), )
409-
410-
BUILDCMD = go build -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$(notdir $@) ./cmd/$(notdir $@)
411-
412401
.PHONY: catalogd-build go-build-catalogd-local $(CATALOGD_BINARIES)
413402
catalogd-build: go-build-catalogd-local ## Build binaries for current GOOS and GOARCH.
414403
go-build-catalogd-local: $(CATALOGD_BINARIES)
@@ -423,12 +412,4 @@ $(LINUX_BINARIES): BUILDBIN = bin/linux
423412
$(LINUX_BINARIES):
424413
GOOS=linux $(BUILDCMD)
425414

426-
.PHONY: build-catalogd-container
427-
build-catalogd-container: catalogd-build-linux ## Build docker image for catalogd.
428-
$(CONTAINER_RUNTIME) build -f Dockerfile.catalogd -t $(CATALOGD_IMAGE) ./bin/linux
429-
430-
.PHONY: kind-load-catalogd
431-
kind-load-catalogd: $(KIND) ## Load the built images onto the local cluster
432-
$(CONTAINER_RUNTIME) save $(CATALOGD_IMAGE) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
433-
434415
include Makefile.venv

0 commit comments

Comments
 (0)