File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,9 +178,9 @@ lint-api-fix: $(GOLANGCI_LINT_KAL)
178178lint-config : $(GOLANGCI_LINT ) # # Verify golangci-lint linter configuration
179179 $(GOLANGCI_LINT ) config verify
180180
181- .PHONY : govulncheck
182- govulncheck : $(GOVULNCHECK ) # # Run govulncheck to detect known vulnerabilities .
183- $(GOVULNCHECK ) -scan package ./...
181+ .PHONY : verify- govulncheck
182+ verify- govulncheck : $(GOVULNCHECK ) # # Run govulncheck verification against base branch .
183+ GOVULNCHECK= " $( GOVULNCHECK) " ./hack/verify-govulncheck.sh
184184
185185.PHONY : verify
186186verify : # # Run all verification scripts.
@@ -449,6 +449,9 @@ $(GOLANGCI_LINT_BIN): $(GOLANGCI_LINT) ## Build a local copy of golangci-lint.
449449.PHONY : $(KIND_BIN )
450450$(KIND_BIN ) : $(KIND ) # # Build a local copy of kind.
451451
452+ .PHONY : $(GOVULNCHECK_BIN )
453+ $(GOVULNCHECK_BIN ) : $(GOVULNCHECK ) # # Build a local copy of govulncheck.
454+
452455$(KUSTOMIZE ) : # Build kustomize from tools folder.
453456 CGO_ENABLED=0 GOBIN=$(TOOLS_BIN_DIR ) $(GO_INSTALL ) $(KUSTOMIZE_PKG ) $(KUSTOMIZE_BIN ) $(KUSTOMIZE_VER )
454457
Original file line number Diff line number Diff line change @@ -18,12 +18,14 @@ set -o errexit
1818set -o nounset
1919set -o pipefail
2020
21- GOVULNCHECK_VERSION=" ${GOVULNCHECK_VERSION:- v1.1.4} "
21+ KUBE_ROOT=" $( dirname " ${BASH_SOURCE[0]} " ) /.."
22+ cd " ${KUBE_ROOT} "
2223
23- # Install govulncheck if not already present.
24- if ! command -v govulncheck & > /dev/null; then
25- echo " Installing govulncheck@${GOVULNCHECK_VERSION} ..."
26- go install " golang.org/x/vuln/cmd/govulncheck@${GOVULNCHECK_VERSION} "
24+ GOVULNCHECK=" ${GOVULNCHECK:- ${KUBE_ROOT} / hack/ tools/ bin/ govulncheck} "
25+
26+ # Ensure govulncheck binary is built
27+ if [[ ! -x " ${GOVULNCHECK} " ]]; then
28+ make -C " ${KUBE_ROOT} " govulncheck
2729fi
2830
2931# NRC_VERIFY_GIT_BRANCH is populated in verify CI jobs (e.g. GITHUB_BASE_REF
@@ -47,11 +49,11 @@ git worktree add -f -q "${WORKTREE}" "${BRANCH}"
4749trap ' git worktree remove -f "${WORKTREE}"; rm -rf "${TMPDIR}"' EXIT
4850
4951echo " Running govulncheck on HEAD (PR branch)..."
50- govulncheck -scan package ./... > " ${TMPDIR} /head.txt" || true
52+ " ${GOVULNCHECK} " -scan package ./... > " ${TMPDIR} /head.txt" || true
5153
5254echo " Running govulncheck on base branch '${BRANCH} '..."
5355pushd " ${WORKTREE} " > /dev/null
54- govulncheck -scan package ./... > " ${TMPDIR} /pr-base.txt" || true
56+ " ${GOVULNCHECK} " -scan package ./... > " ${TMPDIR} /pr-base.txt" || true
5557popd > /dev/null
5658
5759echo -e " \n=== HEAD (PR branch) ===\n$( cat " ${TMPDIR} /head.txt" ) "
You can’t perform that action at this time.
0 commit comments