mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Fix verify-licenses script
This commit is contained in:
parent
4e785dc7e3
commit
cafc791aab
@ -51,23 +51,14 @@ packages_flagged=()
|
|||||||
packages_url_missing=()
|
packages_url_missing=()
|
||||||
exit_code=0
|
exit_code=0
|
||||||
|
|
||||||
git remote add licenses https://github.com/kubernetes/kubernetes >/dev/null 2>&1 || true
|
|
||||||
|
|
||||||
|
|
||||||
# Install go-licenses
|
# Install go-licenses
|
||||||
echo '[INFO] Installing go-licenses...'
|
echo '[INFO] Installing go-licenses...'
|
||||||
pushd "${KUBE_TEMP}" >/dev/null
|
go install github.com/google/go-licenses@latest
|
||||||
git clone https://github.com/google/go-licenses.git >/dev/null 2>&1
|
|
||||||
cd go-licenses
|
|
||||||
go build -o "${GOPATH}/bin"
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
|
|
||||||
# Fetching CNCF Approved List Of Licenses
|
# Fetching CNCF Approved List Of Licenses
|
||||||
# Refer: https://github.com/cncf/foundation/blob/main/allowed-third-party-license-policy.md
|
# 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
|
curl -s 'https://spdx.org/licenses/licenses.json' -o "${KUBE_TEMP}"/licenses.json
|
||||||
|
|
||||||
|
|
||||||
number_of_licenses=$(jq '.licenses | length' "${KUBE_TEMP}"/licenses.json)
|
number_of_licenses=$(jq '.licenses | length' "${KUBE_TEMP}"/licenses.json)
|
||||||
loop_index_length=$(( number_of_licenses - 1 ))
|
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
|
# Scanning go-packages under the project & verifying against the CNCF approved list of licenses
|
||||||
echo '[INFO] Starting license scan on go-packages...'
|
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
|
echo -e 'PACKAGE_NAME LICENSE_NAME LICENSE_URL\n' >> "${KUBE_TEMP}"/approved_licenses.dump
|
||||||
while IFS=, read -r GO_PACKAGE LICENSE_URL LICENSE_NAME
|
while IFS=, read -r GO_PACKAGE LICENSE_URL LICENSE_NAME
|
||||||
|
Loading…
Reference in New Issue
Block a user