Skip to content

Commit c70bca0

Browse files
therealbobopoiana
authored andcommitted
fix(Makefile): correct user-agent version
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
1 parent cbaac97 commit c70bca0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ GIT_COMMIT := $(if $(shell git status --porcelain --untracked-files=no),${COMMIT
88
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
99
GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g")
1010

11+
VERSION = $(shell git describe --tags)
12+
13+
CLIENTGO_VERSION := $(shell grep 'k8s.io/client-go' go.mod | cut -dv -f2)
14+
1115
IMAGE_NAME ?= docker.io/falcosecurity/event-generator
1216

1317
IMAGE_NAME_BRANCH := $(IMAGE_NAME):$(GIT_BRANCH_CLEAN)
1418
IMAGE_NAME_COMMIT := $(IMAGE_NAME):$(GIT_COMMIT)
1519

20+
LDFLAGS = -X k8s.io/client-go/pkg/version.gitCommit=v$(CLIENTGO_VERSION) \
21+
-X k8s.io/client-go/pkg/version.gitVersion=$(VERSION)
22+
1623
TEST_FLAGS ?= -v -race
1724

1825
main ?= .
@@ -27,7 +34,7 @@ prepare: clean events/k8saudit/yaml/bundle.go
2734

2835
.PHONY: ${output}
2936
${output}:
30-
$(GO) build -buildmode=pie -buildvcs=false -o $@ ${main}
37+
$(GO) build -buildmode=pie -buildvcs=false -ldflags "$(LDFLAGS)" -o $@ ${main}
3138

3239
.PHONY: clean
3340
clean:

0 commit comments

Comments
 (0)