add update-unwanted-dependencies.sh to track unwanted dependencies

Signed-off-by: pacoxu <paco.xu@daocloud.io>
Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
Signed-off-by: pacoxu <paco.xu@daocloud.io>
This commit is contained in:
pacoxu
2021-06-16 15:29:04 +08:00
committed by Paco Xu
parent 47f381ba5e
commit 22ccb37e88
4 changed files with 214 additions and 12 deletions

View File

@@ -42,18 +42,8 @@ kube::util::require-jq
rc=0
# List of dependencies we need to avoid dragging back into kubernetes/kubernetes
forbidden_repos=(
"k8s.io/klog" # we have switched to klog v2, so avoid klog v1
)
for forbidden_repo in "${forbidden_repos[@]}"; do
deps_on_forbidden=$(go mod graph | grep " ${forbidden_repo}@" || echo "")
if [ -n "${deps_on_forbidden}" ]; then
kube::log::error "The following have transitive dependencies on ${forbidden_repo}, which is not allowed:"
echo "${deps_on_forbidden}"
echo ""
rc=1
fi
done
# Check if unwanted dependencies are removed
go run k8s.io/kubernetes/cmd/dependencyverifier "${KUBE_ROOT}/hack/unwanted-dependencies.json"
outdated=$(go list -m -json all | jq -r "
select(.Replace.Version != null) |