Skip to content

Commit 0ed91d1

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

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

@@ -254,7 +259,7 @@ e2e-coverage:
254259
.PHONY: kind-load
255260
kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND cluster.
256261
$(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
257-
IMAGE_REPO=$(CATALOG_IMAGE_REPO) KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) $(MAKE) -f Makefile.catalogd kind-load
262+
$(CONTAINER_RUNTIME) save $(CATALOGD_IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
258263

259264
.PHONY: kind-deploy
260265
kind-deploy: export MANIFEST := ./operator-controller.yaml
@@ -315,16 +320,17 @@ go-build-linux: export GOARCH=amd64
315320
go-build-linux: $(BINARIES) go-build-catalogd-linux
316321

317322
.PHONY: run
318-
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.
323+
run: docker-build kind-cluster kind-load kind-deploy wait #HELP Build the operator-controller then deploy it into a new kind cluster.
319324

320325
CATALOGD_NAMESPACE := olmv1-system
321326
wait:
322327
kubectl wait --for=condition=Available --namespace=$(CATALOGD_NAMESPACE) deployment/catalogd-controller-manager --timeout=60s
323328
kubectl wait --for=condition=Ready --namespace=$(CATALOGD_NAMESPACE) certificate/catalogd-service-cert # Avoid upgrade test flakes when reissuing cert
324329

325330
.PHONY: docker-build
326-
docker-build: build-linux build-catalogd-container #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.
331+
docker-build: build-linux #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.
327332
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux
333+
$(CONTAINER_RUNTIME) build -f Dockerfile.catalogd -t $(CATALOGD_IMG) ./bin/linux
328334

329335
#SECTION Release
330336
ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined)
@@ -339,7 +345,7 @@ export GORELEASER_ARGS
339345

340346
.PHONY: release
341347
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.
342-
OPERATOR_CONTROLLER_IMAGE_REPO=$(IMAGE_REPO) CATALOGD_IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(GORELEASER) $(GORELEASER_ARGS)
348+
OPERATOR_CONTROLLER_IMAGE_REPO=$(IMAGE_REPO) CATALOG_IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(GORELEASER) $(GORELEASER_ARGS)
343349

344350
.PHONY: quickstart
345351
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml
@@ -389,23 +395,6 @@ demo-update:
389395
./hack/demo/generate-asciidemo.sh -u -n catalogd-demo catalogd-demo-script.sh
390396

391397
# Catalogd targets
392-
ifeq ($(origin CATALOGD_IMAGE_REPO), undefined)
393-
CATALOGD_IMAGE_REPO := quay.io/operator-framework/catalogd
394-
endif
395-
export CATALOGD_IMAGE_REPO
396-
397-
ifeq ($(origin CATALOGD_IMAGE_TAG), undefined)
398-
CATALOGD_IMAGE_TAG := devel
399-
endif
400-
export CATALOGD_IMAGE_TAG
401-
402-
CATALOGD_IMAGE := $(CATALOGD_IMAGE_REPO):$(CATALOGD_IMAGE_TAG)
403-
404-
CATALOGD_BINARIES=catalogd
405-
LINUX_BINARIES=$(join $(addprefix linux/,$(CATALOGD_BINARIES)), )
406-
407-
BUILDCMD = go build -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$(notdir $@) ./cmd/$(notdir $@)
408-
409398
.PHONY: catalogd-build go-build-catalogd-local $(CATALOGD_BINARIES)
410399
catalogd-build: go-build-catalogd-local ## Build binaries for current GOOS and GOARCH.
411400
go-build-catalogd-local: $(CATALOGD_BINARIES)
@@ -420,12 +409,4 @@ $(LINUX_BINARIES): BUILDBIN = bin/linux
420409
$(LINUX_BINARIES):
421410
GOOS=linux $(BUILDCMD)
422411

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

0 commit comments

Comments
 (0)