Fix shellcheck failures on verify-readonly-packages.sh

k3s-v1.15.3
aaa 2019-04-19 14:59:50 -04:00
parent ac1557a886
commit e05f85a611
2 changed files with 8 additions and 4 deletions

View File

@ -47,7 +47,6 @@
./hack/verify-golint.sh ./hack/verify-golint.sh
./hack/verify-no-vendor-cycles.sh ./hack/verify-no-vendor-cycles.sh
./hack/verify-openapi-spec.sh ./hack/verify-openapi-spec.sh
./hack/verify-readonly-packages.sh
./hack/verify-test-featuregates.sh ./hack/verify-test-featuregates.sh
./test/cmd/apply.sh ./test/cmd/apply.sh
./test/cmd/apps.sh ./test/cmd/apps.sh

View File

@ -22,7 +22,7 @@ set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${KUBE_ROOT}/hack/lib/init.sh" source "${KUBE_ROOT}/hack/lib/init.sh"
readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}} readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}}
@ -44,12 +44,17 @@ find_files() {
} }
IFS=$'\n' IFS=$'\n'
conflicts=($(find_files | sed 's|/.readonly||' | while read dir; do
conflicts=()
while IFS=$'\n' read -r line; do
conflicts+=( "$line" )
done < <(find_files | sed 's|/.readonly||' | while read -r dir; do
dir=${dir#./} dir=${dir#./}
if kube::util::has_changes "${branch}" "^${dir}/[^/]*\$" '/\.readonly$|/BUILD$|/zz_generated|/\.generated\.|\.proto$|\.pb\.go$' >/dev/null; then if kube::util::has_changes "${branch}" "^${dir}/[^/]*\$" '/\.readonly$|/BUILD$|/zz_generated|/\.generated\.|\.proto$|\.pb\.go$' >/dev/null; then
echo "${dir}" echo "${dir}"
fi fi
done)) done)
unset IFS unset IFS
if [ ${#conflicts[@]} -gt 0 ]; then if [ ${#conflicts[@]} -gt 0 ]; then