Update hack/verify-govulncheck.sh

Co-authored-by: LX <hwdefcom@outlook.com>
Signed-off-by: ArkaSaha30 <arkasaha30@gmail.com>
This commit is contained in:
Arka Saha 2023-09-11 20:49:04 +05:30 committed by ArkaSaha30
parent 190f9d0d4b
commit 9e34aa306c
No known key found for this signature in database
GPG Key ID: C5FF37943E5BC363

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright 2022 The Kubernetes Authors. # Copyright 2023 The Kubernetes Authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -18,12 +18,12 @@ set -euo pipefail
export WORKDIR=${ARTIFACTS:-$TMPDIR} export WORKDIR=${ARTIFACTS:-$TMPDIR}
export PATH=$PATH:$GOPATH/bin export PATH=$PATH:$GOPATH/bin
mkdir -p "${WORKDIR}" mkdir -p "${WORKDIR}"
pushd "$WORKDIR"
go install golang.org/x/vuln/cmd/govulncheck@v1.0.1 go install golang.org/x/vuln/cmd/govulncheck@v1.0.1
popd
govulncheck -scan module ./... > "${WORKDIR}/head.txt" govulncheck -scan module ./... > "${WORKDIR}/head.txt"
git reset --hard HEAD git reset --hard HEAD
git checkout -b base "${PULL_BASE_SHA}" git checkout -b base "${PULL_BASE_SHA}"
govulncheck -scan module ./... > "${WORKDIR}/pr-base.txt" govulncheck -scan module ./... > "${WORKDIR}/pr-base.txt"
diff -s -u --ignore-all-space "${WORKDIR}"/pr-base.txt "${WORKDIR}"/head.txt || true diff -s -u --ignore-all-space "${WORKDIR}"/pr-base.txt "${WORKDIR}"/head.txt || true