Skip to content

Commit 70c7509

Browse files
authored
Support BSD sed and older bash in test rule. (#112)
BSD sed (as shipped with MacOS) does not support `+` nor `\+` in regular expressions. However it does support `\{1,\}` which does the same thing and is also supported by GNU sed. Moreover, bash 3.2 (as shipped with MacOS) does not seem to support `source <(...)`, it seems to just do nothing. Using plain eval seems to do the trick though.
1 parent 1be4e1a commit 70c7509

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ all: test lint build
4343
# https://github.com/kubernetes-sigs/kubebuilder/pull/2287 targeting the kubebuilder
4444
# "tools-releases" branch. Make sure to look up the appropriate etcd version in the
4545
# kubernetes release notes for the minor version you're building tools for.
46-
ENVTEST_VERSION = $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\+\)\.[[:digit:]]\+$$/1.\1.x/')
46+
ENVTEST_VERSION = $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.x/')
4747
TESTPKG ?= ./...
4848
# TODO: Modify this to use setup-envtest binary
4949
test: build
5050
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
51-
source <(setup-envtest use -p env $(ENVTEST_VERSION)) && go test -race -covermode atomic -coverprofile cover.out $(TESTPKG)
51+
eval $$(setup-envtest use -p env $(ENVTEST_VERSION)) && go test -race -covermode atomic -coverprofile cover.out $(TESTPKG)
5252

5353
.PHONY: test-sanity
5454
test-sanity: generate fix ## Test repo formatting, linting, etc.

0 commit comments

Comments
 (0)