Skip to content

Commit 8ebd18f

Browse files
committed
Push additional stable image name to staging registry
1 parent 1c96726 commit 8ebd18f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ LINUX_PLATFORMS=linux_amd64 linux_arm64
2828
DOCKER_PLATFORMS=linux/amd64,linux/arm64
2929
PLATFORMS=$(LINUX_PLATFORMS) windows_amd64
3030

31-
# VERSION is the version of the binary.
31+
# BRANCH is the git branch.
32+
BRANCH=$(shell git symbolic-ref --short HEAD)
33+
34+
# VERSION is the git version of the binary.
3235
VERSION?=$(shell git describe --tags --always --dirty)
3336

3437
# TAG is the tag of the container image, default to binary version.
@@ -60,8 +63,11 @@ NPD_NAME_VERSION?=node-problem-detector-$(VERSION)
6063
# TARBALL is the name of release tar. Include binary version by default.
6164
TARBALL=$(NPD_NAME_VERSION).tar.gz
6265

63-
# IMAGE is the image name of the node problem detector container image.
64-
IMAGE:=$(REGISTRY)/node-problem-detector:$(TAG)
66+
# IMAGE_TAGS contains the image tags of the node problem detector container image.
67+
IMAGE_TAGS=--tag $(REGISTRY)/node-problem-detector:$(TAG)
68+
ifeq ($(REGISTRY), gcr.io/k8s-staging-npd)
69+
IMAGE_TAGS+= --tag $(REGISTRY)/node-problem-detector:$(BRANCH)
70+
endif
6571

6672
# ENABLE_JOURNALD enables build journald support or not. Building journald
6773
# support needs libsystemd-dev or libsystemd-journal-dev.
@@ -255,7 +261,7 @@ build-binaries: $(ALL_BINARIES)
255261

256262
build-container: clean Dockerfile
257263
docker buildx create --platform $(DOCKER_PLATFORMS) --use
258-
docker buildx build --platform $(DOCKER_PLATFORMS) -t $(IMAGE) --build-arg LOGCOUNTER=$(LOGCOUNTER) .
264+
docker buildx build --platform $(DOCKER_PLATFORMS) $(IMAGE_TAGS) --build-arg LOGCOUNTER=$(LOGCOUNTER) .
259265

260266
$(TARBALL): ./bin/node-problem-detector ./bin/log-counter ./bin/health-checker ./test/bin/problem-maker
261267
tar -zcvf $(TARBALL) bin/ config/ test/e2e-install.sh test/bin/problem-maker
@@ -276,7 +282,7 @@ build-in-docker: clean docker-builder
276282

277283
push-container: build-container
278284
# Build should be cached from build-container
279-
docker buildx build --push --platform $(DOCKER_PLATFORMS) -t $(IMAGE) --build-arg LOGCOUNTER=$(LOGCOUNTER) .
285+
docker buildx build --push --platform $(DOCKER_PLATFORMS) $(IMAGE_TAGS) --build-arg LOGCOUNTER=$(LOGCOUNTER) .
280286

281287
push-tar: build-tar
282288
gsutil cp $(TARBALL) $(UPLOAD_PATH)/node-problem-detector/

0 commit comments

Comments
 (0)