From cafc791aab877a94c656e96629eea7768db22e6e Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Wed, 4 Jan 2023 15:45:41 -0500 Subject: [PATCH] Fix verify-licenses script --- hack/verify-licenses.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/hack/verify-licenses.sh b/hack/verify-licenses.sh index 0f64a5fbad5..31846d6c510 100755 --- a/hack/verify-licenses.sh +++ b/hack/verify-licenses.sh @@ -51,23 +51,14 @@ packages_flagged=() packages_url_missing=() exit_code=0 -git remote add licenses https://github.com/kubernetes/kubernetes >/dev/null 2>&1 || true - - # Install go-licenses echo '[INFO] Installing go-licenses...' -pushd "${KUBE_TEMP}" >/dev/null - git clone https://github.com/google/go-licenses.git >/dev/null 2>&1 - cd go-licenses - go build -o "${GOPATH}/bin" -popd >/dev/null - +go install github.com/google/go-licenses@latest # Fetching CNCF Approved List Of Licenses # Refer: https://github.com/cncf/foundation/blob/main/allowed-third-party-license-policy.md curl -s 'https://spdx.org/licenses/licenses.json' -o "${KUBE_TEMP}"/licenses.json - number_of_licenses=$(jq '.licenses | length' "${KUBE_TEMP}"/licenses.json) loop_index_length=$(( number_of_licenses - 1 )) @@ -85,8 +76,7 @@ done # Scanning go-packages under the project & verifying against the CNCF approved list of licenses echo '[INFO] Starting license scan on go-packages...' -go-licenses csv --git_remote licenses ./... >> "${KUBE_TEMP}"/licenses.csv 2>/dev/null - +go-licenses report ./... >> "${KUBE_TEMP}"/licenses.csv echo -e 'PACKAGE_NAME LICENSE_NAME LICENSE_URL\n' >> "${KUBE_TEMP}"/approved_licenses.dump while IFS=, read -r GO_PACKAGE LICENSE_URL LICENSE_NAME