You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switch to using local golang ci lint and cleanup Makefile (#176)
Managing the Golang CI Lint version is a bit cumbersome when it is hard
coded in the Makefile. This switches to using the local version. In the
end the version specified in the GH actions flow with be the authority.
## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
26
28
.PHONY: generate
27
-
generate:## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
29
+
generate:
28
30
go tool controller-gen applyconfiguration:headerFile="hack/boilerplate.go.txt" object:headerFile="hack/boilerplate.go.txt" paths="./..."
29
31
30
-
.PHONY: fmt
31
-
fmt: ## Run go fmt against code.
32
-
go fmt ./...
33
-
34
-
.PHONY: vet
35
-
vet: ## Run go vet against code.
36
-
go vet ./...
37
-
38
32
.PHONY: test
39
-
test: manifests fmt vet setup-envtest## Run tests.
33
+
test: manifests setup-envtest
40
34
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v $$(go list ./... | grep -v /e2e) -coverprofile cover.out
41
35
42
36
.PHONY: test-e2e
43
-
test-e2e: manifests fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
37
+
test-e2e: manifests
44
38
@command -v kind >/dev/null 2>&1|| { \
45
39
echo"Kind is not installed. Please install Kind manually.";\
46
40
exit 1;\
@@ -52,57 +46,54 @@ test-e2e: manifests fmt vet ## Run the e2e tests. Expected an isolated environme
52
46
go test ./test/e2e/ -v -ginkgo.v
53
47
54
48
.PHONY: lint
55
-
lint: golangci-lint ## Run golangci-lint linter
56
-
$(GOLANGCI_LINT) run
57
-
58
-
.PHONY: lint-fix
59
-
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
95
84
.PHONY: uninstall
96
-
uninstall: manifests## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
103
94
.PHONY: undeploy
104
-
undeploy:## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
105
-
$(HELM) uninstall -n netbird kubernetes-operator
95
+
undeploy:
96
+
helm uninstall -n netbird kubernetes-operator
106
97
107
98
##@ Dependencies
108
99
@@ -112,16 +103,12 @@ $(LOCALBIN):
112
103
mkdir -p $(LOCALBIN)
113
104
114
105
## Tool Binaries
115
-
KUBECTL ?= kubectl
116
106
ENVTEST ?= $(LOCALBIN)/setup-envtest
117
-
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
118
-
HELM ?= helm
119
107
120
108
#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
121
109
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')
122
110
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
123
111
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
124
-
GOLANGCI_LINT_VERSION ?= v1.63.4
125
112
126
113
.PHONY: setup-envtest
127
114
setup-envtest: envtest ## Download the binaries required for ENVTEST in the local bin directory.
@@ -132,15 +119,11 @@ setup-envtest: envtest ## Download the binaries required for ENVTEST in the loca
132
119
}
133
120
134
121
.PHONY: envtest
122
+
135
123
envtest: $(ENVTEST)## Download setup-envtest locally if necessary.
0 commit comments