@@ -86,6 +86,11 @@ GOLANGCI_LINT_VER := $(shell cat .github/workflows/pr-golangci-lint.yaml | grep
8686GOLANGCI_LINT_BIN := golangci-lint
8787GOLANGCI_LINT := $(TOOLS_BIN_DIR ) /$(GOLANGCI_LINT_BIN ) -$(GOLANGCI_LINT_VER )
8888
89+ GOVULNCHECK_BIN := govulncheck
90+ GOVULNCHECK_VER := v1.1.4
91+ GOVULNCHECK := $(abspath $(TOOLS_BIN_DIR ) /$(GOVULNCHECK_BIN ) -$(GOVULNCHECK_VER ) )
92+ GOVULNCHECK_PKG := golang.org/x/vuln/cmd/govulncheck
93+
8994KUSTOMIZE_VER := v5.4.1
9095KUSTOMIZE_BIN := kustomize
9196KUSTOMIZE := $(TOOLS_BIN_DIR ) /$(KUSTOMIZE_BIN ) -$(KUSTOMIZE_VER )
@@ -102,6 +107,8 @@ RELEASE_NOTES_VER := v0.18.0
102107RELEASE_NOTES_BIN := release-notes
103108RELEASE_NOTES := $(TOOLS_BIN_DIR ) /$(RELEASE_NOTES_BIN ) -$(RELEASE_NOTES_VER )
104109
110+ TRIVY_VER := 0.64.0
111+
105112KPROMO_VER := v4.0.5
106113KPROMO_BIN := kpromo
107114KPROMO := $(TOOLS_BIN_DIR ) /$(KPROMO_BIN ) -$(KPROMO_VER )
@@ -307,6 +314,24 @@ verify-tiltfile: ## Verify Tiltfile format.
307314verify-codespell : codespell # # Verify codespell.
308315 @$(CODESPELL ) $(ROOT_DIR ) --ignore-words=$(ROOT_DIR ) /.codespellignore --skip=" *.git,*_artifacts,*.sum,$( ROOT_DIR) /docs/book/bookout,$( ROOT_DIR) /hack/tools/bin/codespell_dist"
309316
317+ .PHONY : verify-govulncheck
318+ verify-govulncheck : $(GOVULNCHECK ) # # Verify code for vulnerabilities
319+ $(GOVULNCHECK ) ./... && R1=$$? || R1=$$? ; \
320+ $(GOVULNCHECK ) -C " $( TOOLS_DIR) " ./... && R2=$$? || R2=$$? ; \
321+ $(GOVULNCHECK ) -C " $( TEST_DIR) " ./... && R3=$$? || R3=$$? ; \
322+ if [ " $$ R1" -ne " 0" ] || [ " $$ R2" -ne " 0" ] || [ " $$ R3" -ne " 0" ]; then \
323+ exit 1; \
324+ fi
325+
326+ .PHONY : verify-security
327+ verify-security : # # Verify code and images for vulnerabilities
328+ $(MAKE ) verify-container-images && R1=$$? || R1=$$? ; \
329+ $(MAKE ) verify-govulncheck && R2=$$? || R2=$$? ; \
330+ if [ " $$ R1" -ne " 0" ] || [ " $$ R2" -ne " 0" ]; then \
331+ echo " Check for vulnerabilities failed! There are vulnerabilities to be fixed" ; \
332+ exit 1; \
333+ fi
334+
310335# # --------------------------------------
311336# # Development
312337# # --------------------------------------
@@ -764,7 +789,7 @@ cleanup-workload-identity: ## Cleanup CI workload-identity infra
764789
765790.PHONY : verify-container-images
766791verify-container-images : # # Verify container images
767- ./hack/verify-container-images.sh
792+ TRACE= $( TRACE ) ./hack/verify-container-images.sh $( TRIVY_VER )
768793
769794# # --------------------------------------
770795# # Tilt / Kind
@@ -846,6 +871,12 @@ $(CONVERSION_GEN): ## Build conversion-gen from tools folder.
846871$(ENVSUBST ) : # # Build envsubst from tools folder.
847872 GOBIN=$(TOOLS_BIN_DIR ) $(GO_INSTALL ) github.com/drone/envsubst/v2/cmd/envsubst $(ENVSUBST_BIN ) $(ENVSUBST_VER )
848873
874+ .PHONY : $(GOVULNCHECK_BIN )
875+ $(GOVULNCHECK_BIN ) : $(GOVULNCHECK ) # # Build a local copy of govulncheck.
876+
877+ $(GOVULNCHECK ) : # Build govulncheck.
878+ GOBIN=$(TOOLS_BIN_DIR ) $(GO_INSTALL ) $(GOVULNCHECK_PKG ) $(GOVULNCHECK_BIN ) $(GOVULNCHECK_VER )
879+
849880$(GOLANGCI_LINT ) : # # Build golangci-lint from tools folder.
850881 GOBIN=$(TOOLS_BIN_DIR ) $(GO_INSTALL ) github.com/golangci/golangci-lint/v2/cmd/golangci-lint $(GOLANGCI_LINT_BIN ) $(GOLANGCI_LINT_VER )
851882
0 commit comments