@@ -12,8 +12,8 @@ BUILD_ARGS ?=
1212# Architectures to build images for
1313BUILD_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7
1414
15- # Go test arguments, e.g. '-tags= integration'
16- GO_TEST_ARGS ?=
15+ # Go additional tag arguments, e.g. 'integration'
16+ GO_TAGS ?=
1717
1818# Produce CRDs that work back to Kubernetes 1.16
1919CRD_OPTIONS ?= crd:crdVersions=v1
@@ -41,7 +41,7 @@ export CGO_CFLAGS=-I$(LIBGIT2_PATH)/include -I$(LIBGIT2_PATH)/include/openssl
4141# The pkg-config command will yield warning messages until libgit2 is downloaded.
4242ifeq ($(shell uname -s) ,Darwin)
4343export CGO_LDFLAGS =$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH ) pkg-config --libs --static --cflags libssh2 openssl libgit2 2>/dev/null)
44- GO_STATIC_FLAGS =-ldflags "-s -w" -tags 'netgo,osusergo,static_build'
44+ GO_STATIC_FLAGS =-ldflags "-s -w" -tags 'netgo,osusergo,static_build$( addprefix ,, $( GO_TAGS ) ) '
4545else
4646export PKG_CONFIG_PATH: =$(PKG_CONFIG_PATH ) :$(LIBGIT2_LIB64_PATH ) /pkgconfig
4747export LIBRARY_PATH: =$(LIBRARY_PATH ) :$(LIBGIT2_LIB64_PATH )
@@ -53,14 +53,14 @@ ifeq ($(shell uname -s),Linux)
5353ifeq ($(shell uname -m) ,x86_64)
5454# Linux x86_64 seem to be able to cope with the static libraries
5555# by having only musl-dev installed, without the need of using musl toolchain.
56- GO_STATIC_FLAGS=-ldflags "-s -w" -tags 'netgo,osusergo,static_build'
56+ GO_STATIC_FLAGS=-ldflags "-s -w" -tags 'netgo,osusergo,static_build$(addprefix ,,$(GO_TAGS)) '
5757else
5858 MUSL-PREFIX=$(BUILD_DIR)/musl/$(shell uname -m)-linux-musl-native/bin/$(shell uname -m)-linux-musl
5959 MUSL-CC=$(MUSL-PREFIX)-gcc
6060 export CC=$(MUSL-PREFIX)-gcc
6161 export CXX=$(MUSL-PREFIX)-g++
6262 export AR=$(MUSL-PREFIX)-ar
63- GO_STATIC_FLAGS=-ldflags "-s -w -extldflags \"-static\"" -tags 'netgo,osusergo,static_build'
63+ GO_STATIC_FLAGS=-ldflags "-s -w -extldflags \"-static\"" -tags 'netgo,osusergo,static_build$(addprefix ,,$(GO_TAGS)) '
6464endif
6565endif
6666
@@ -96,7 +96,7 @@ build: check-deps $(LIBGIT2) ## Build manager binary
9696KUBEBUILDER_ASSETS? ="$(shell $(ENVTEST ) --arch=$(ENVTEST_ARCH ) use -i $(ENVTEST_KUBERNETES_VERSION ) --bin-dir=$(ENVTEST_ASSETS_DIR ) -p path) "
9797test : $(LIBGIT2 ) install-envtest test-api check-deps # # Run tests
9898 KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS ) \
99- go test $(GO_STATIC_FLAGS ) $( GO_TEST_ARGS ) ./... -coverprofile cover.out
99+ go test $(GO_STATIC_FLAGS ) ./... -coverprofile cover.out
100100
101101check-deps :
102102ifeq ($(shell uname -s) ,Darwin)
0 commit comments