Skip to content

Commit 09038bc

Browse files
committed
Add govulncheck make target
Add govulncheck for vulnerability scanning. Run with `make govulncheck`. Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
1 parent 8fbb40a commit 09038bc

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ lint: golangci-lint ## Run golangci-lint linter
142142
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
143143
$(GOLANGCI_LINT) run --fix
144144

145+
##@ Security
146+
147+
.PHONY: govulncheck
148+
govulncheck: govulncheck-install ## Run govulncheck vulnerability scanner.
149+
GOTOOLCHAIN=auto $(GOVULNCHECK) ./...
150+
145151
##@ Build
146152

147153
.PHONY: build
@@ -244,13 +250,15 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
244250
ENVTEST ?= $(LOCALBIN)/setup-envtest
245251
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
246252
KUTTL ?= $(LOCALBIN)/kubectl-kuttl
253+
GOVULNCHECK ?= $(LOCALBIN)/govulncheck
247254

248255
## Tool Versions
249256
KUSTOMIZE_VERSION ?= v5.4.2
250257
CONTROLLER_TOOLS_VERSION ?= v0.16.5
251258
ENVTEST_VERSION ?= release-0.22
252259
GOLANGCI_LINT_VERSION ?= v2.6.0
253260
KUTTL_VERSION ?= 0.22.0
261+
GOVULNCHECK_VERSION ?= v1.6.0
254262

255263
.PHONY: kustomize
256264
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -284,6 +292,10 @@ kuttl-test: kuttl ## Run kuttl tests
284292
@command -v oc >/dev/null 2>&1 || { echo "ERROR: 'oc' command is required for KUTTL tests but not found in PATH" >&2; exit 1; }
285293
$(LOCALBIN)/kubectl-kuttl test --config kuttl-test.yaml test/kuttl/tests $(KUTTL_ARGS)
286294

295+
.PHONY: govulncheck-install
296+
govulncheck-install: $(LOCALBIN) ## Download govulncheck locally if necessary.
297+
$(call go-install-tool,$(GOVULNCHECK),golang.org/x/vuln/cmd/govulncheck,$(GOVULNCHECK_VERSION))
298+
287299
.PHONY: kuttl-test-run
288300
kuttl-test-run: kuttl openstack-lightspeed-deploy kuttl-test openstack-lightspeed-undeploy
289301

0 commit comments

Comments
 (0)