Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix shellcheck failures of hack/verify-no-vendor-cycles.sh" #77841

Merged
merged 1 commit into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions hack/.shellcheck_failures
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
./hack/pin-dependency.sh
./hack/test-integration.sh
./hack/update-vendor.sh
./hack/verify-no-vendor-cycles.sh
./hack/verify-test-featuregates.sh
./test/cmd/batch.sh
./test/cmd/certificate.sh
Expand Down
14 changes: 5 additions & 9 deletions hack/verify-no-vendor-cycles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,16 @@ set -o errexit
set -o nounset
set -o pipefail

KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change was right

KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..

export GO111MODULE=auto

staging_repos=()
while IFS= read -r repo; do
staging_repos+=( "${repo}" )
done < <(ls "${KUBE_ROOT}/staging/src/k8s.io/")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the future: this should be using find instead of ls


staging_repos=($(ls "${KUBE_ROOT}/staging/src/k8s.io/"))
staging_repos_pattern=$(IFS="|"; echo "${staging_repos[*]}")

failed=false
while IFS= read -r -d '' i; do
deps=$(go list -f '{{range .Deps}}{{.}}{{"\n"}}{{end}}' ./"$i" 2> /dev/null || echo "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be quoting the whole string

for i in $(find vendor/ -type d); do
deps=$(go list -f '{{range .Deps}}{{.}}{{"\n"}}{{end}}' ./$i 2> /dev/null || echo "")
deps_on_main=$(echo "${deps}" | grep -v "k8s.io/kubernetes/vendor/" | grep "k8s.io/kubernetes" || echo "")
if [ -n "${deps_on_main}" ]; then
echo "Package ${i} has a cyclic dependency on the main repository."
Expand All @@ -42,7 +38,7 @@ while IFS= read -r -d '' i; do
echo "Package ${i} has a cyclic dependency on staging repository packages: ${deps_on_staging}"
failed=true
fi
done < <(find vendor/ -type d)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be using -print0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if [[ "${failed}" == "true" ]]; then
exit 1
Expand Down