Skip to content
Merged
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
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ LINUX_PLATFORMS=linux_amd64 linux_arm64
DOCKER_PLATFORMS=linux/amd64,linux/arm64
PLATFORMS=$(LINUX_PLATFORMS) windows_amd64

# VERSION is the version of the binary.
# BRANCH is the git branch.
BRANCH=$(shell git symbolic-ref --short HEAD)

# VERSION is the git version of the binary.
VERSION?=$(shell git describe --tags --always --dirty)

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

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

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

build-container: clean Dockerfile
docker buildx create --platform $(DOCKER_PLATFORMS) --use
docker buildx build --platform $(DOCKER_PLATFORMS) -t $(IMAGE) --build-arg LOGCOUNTER=$(LOGCOUNTER) .
docker buildx build --platform $(DOCKER_PLATFORMS) $(IMAGE_TAGS) --build-arg LOGCOUNTER=$(LOGCOUNTER) .

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

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

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