File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
SHELL := /bin/bash
6
6
PKG := github.com/operator-framework/operator-lifecycle-manager
7
+ OS := $(shell go env GOOS)
8
+ ARCH := $(shell go env GOARCH)
7
9
MOD_FLAGS := $(shell (go version | grep -q -E "1\.1[1-9]") && echo -mod=vendor)
8
10
CMDS := $(shell go list $(MOD_FLAGS ) ./cmd/...)
9
11
TCMDS := $(shell go list $(MOD_FLAGS ) ./test/e2e/...)
@@ -33,14 +35,23 @@ endif
33
35
GIT_COMMIT := $(if $(SOURCE_GIT_COMMIT ) ,$(SOURCE_GIT_COMMIT ) ,$(shell git rev-parse HEAD) )
34
36
35
37
.PHONY : build test run clean vendor schema-check \
36
- vendor-update coverage coverage-html e2e manifests controller-gen .FORCE
38
+ vendor-update coverage coverage-html e2e manifests \
39
+ controller-gen kubebuilder .FORCE
37
40
38
41
all : test build
39
42
40
43
test : clean cover.out
41
44
42
- unit :
43
- go test $(MOD_FLAGS ) $(SPECIFIC_UNIT_TEST ) -v -race -tags=json1 -count=1 ./pkg/...
45
+ unit : kubebuilder
46
+ echo $(KUBEBUILDER_ENV )
47
+ $(KUBEBUILDER_ENV ) go test $(MOD_FLAGS ) $(SPECIFIC_UNIT_TEST ) -v -race -tags=json1 -count=1 ./pkg/...
48
+
49
+ # Install kubebuilder if not found
50
+ kubebuilder :
51
+ ifeq (, $(shell which kubebuilder) )
52
+ curl -sL https://go.kubebuilder.io/dl/2.0.1/$(OS)/$(ARCH) | tar -xz -C /tmp/
53
+ KUBEBUILDER_ENV := KUBEBUILDER_ASSETS=/tmp/kubebuilder_2.0.1_$(OS ) _$(ARCH ) /bin
54
+ endif
44
55
45
56
schema-check :
46
57
You can’t perform that action at this time.
0 commit comments