Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 217d79b

Browse files
authored
Makefile: add common target for control plane (#4142)
Adds a common `make` target to build the control plane that is used by both the linux and windows build targets. Also fixes an issue with the VERIFY_TAGS value being overriden and adds an additional target to publish the control plane image digests to a file. The image digests will be made available as a part of a pre-release workflow to publish the control plane images, and the digests will be used to encode the default images in the Helm chart and CLI. Signed-off-by: Shashank Ram <[email protected]>
1 parent dcb2629 commit 217d79b

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

Makefile

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ BINNAME ?= osm
55
DIST_DIRS := find * -type d -exec
66
CTR_REGISTRY ?= openservicemesh
77
CTR_TAG ?= latest
8+
CTR_DIGEST_FILE ?= /tmp/osm_image_digest
9+
VERIFY_TAGS ?= 0
810

911
GOPATH = $(shell go env GOPATH)
1012
GOBIN = $(GOPATH)/bin
@@ -242,30 +244,43 @@ embed-files-test:
242244
build-ci: embed-files
243245
go build -v ./...
244246

245-
# docker-push-bookbuyer, etc
246-
DOCKER_PUSH_TARGETS = $(addprefix docker-push-, $(DEMO_TARGETS) init osm-controller osm-injector osm-crds osm-bootstrap)
247-
VERIFY_TAGS = 0
248-
.PHONY: $(DOCKER_PUSH_TARGETS)
249-
$(DOCKER_PUSH_TARGETS): NAME=$(@:docker-push-%=%)
250-
$(DOCKER_PUSH_TARGETS):
247+
.PHONY: clean-image-digest
248+
clean-image-digest:
249+
@rm -f "$(CTR_DIGEST_FILE)"
250+
251+
# OSM control plane components
252+
DOCKER_PUSH_CONTROL_PLANE_TARGETS = $(addprefix docker-push-, init osm-controller osm-injector osm-crds osm-bootstrap)
253+
.PHONY: $(DOCKER_PUSH_CONTROL_PLANE_TARGETS)
254+
$(DOCKER_PUSH_CONTROL_PLANE_TARGETS): NAME=$(@:docker-push-%=%)
255+
$(DOCKER_PUSH_CONTROL_PLANE_TARGETS):
251256
@if [ $(VERIFY_TAGS) != 1 ]; then make docker-build-$(NAME) && docker push "$(CTR_REGISTRY)/$(NAME):$(CTR_TAG)"; else bash scripts/publish-image.sh $(NAME) "linux"; fi
257+
@docker images --digests | grep "$(CTR_REGISTRY)/$(NAME)\s*$(CTR_TAG)" >> "$(CTR_DIGEST_FILE)"
258+
252259

260+
# Linux demo applications
261+
DOCKER_PUSH_LINUX_TARGETS = $(addprefix docker-push-, $(DEMO_TARGETS))
262+
.PHONY: $(DOCKER_PUSH_LINUX_TARGETS)
263+
$(DOCKER_PUSH_LINUX_TARGETS): NAME=$(@:docker-push-%=%)
264+
$(DOCKER_PUSH_LINUX_TARGETS):
265+
@if [ $(VERIFY_TAGS) != 1 ]; then make docker-build-$(NAME) && docker push "$(CTR_REGISTRY)/$(NAME):$(CTR_TAG)"; else bash scripts/publish-image.sh $(NAME) "linux"; fi
253266

267+
268+
# Windows demo applications
254269
DOCKER_PUSH_WINDOWS_TARGETS = $(addprefix docker-push-windows-, $(DEMO_TARGETS))
255-
VERIFY_TAGS = 0
256270
.PHONY: $(DOCKER_PUSH_WINDOWS_TARGETS)
257271
$(DOCKER_PUSH_WINDOWS_TARGETS): NAME=$(@:docker-push-%=%)
258272
$(DOCKER_PUSH_WINDOWS_TARGETS):
259273
@if [ $(VERIFY_TAGS) != 1 ]; then make ARGS=--output=type=registry docker-build-$(NAME); else bash scripts/publish-image.sh $(addprefix windows-, $(NAME)) "windows"; fi
260274

261275

276+
.PHONY: docker-control-plane-push
277+
docker-control-plane-push: clean-image-digest $(DOCKER_PUSH_CONTROL_PLANE_TARGETS)
278+
262279
.PHONY: docker-linux-push
263-
docker-linux-push: $(DOCKER_PUSH_TARGETS)
280+
docker-linux-push: docker-control-plane-push $(DOCKER_PUSH_LINUX_TARGETS)
264281

265-
# notably the init container is missing here because we don't use it for windows
266-
OSM_CONTROL_PLANE_TARGETS = $(addprefix docker-push-, osm-controller osm-controller osm-injector osm-crds osm-bootstrap)
267282
.PHONY: docker-windows-push
268-
docker-windows-push: $(DOCKER_PUSH_WINDOWS_TARGETS) $(OSM_CONTROL_PLANE_TARGETS)
283+
docker-windows-push: docker-control-plane-push $(DOCKER_PUSH_WINDOWS_TARGETS)
269284

270285
.PHONY: docker-push
271286
docker-push: docker-linux-push docker-windows-push

0 commit comments

Comments
 (0)