Improved some more bash script variable definitions

This commit is contained in:
Roy Lenferink
2019-01-21 23:11:58 +01:00
parent f788854e98
commit b18bc2ea79
12 changed files with 72 additions and 72 deletions

View File

@@ -169,7 +169,7 @@ else
# Test using the host the script was run on
# Provided for backwards compatibility
go run test/e2e_node/runner/local/run_local.go \
--system-spec-name="$system_spec_name" --ginkgo-flags="$ginkgoflags" \
--system-spec-name="${system_spec_name}" --ginkgo-flags="${ginkgoflags}" \
--test-flags="--container-runtime=${runtime} \
--alsologtostderr --v 4 --report-dir=${artifacts} --node-name $(hostname) \
${test_args}" --build-dependencies=true 2>&1 | tee -i "${artifacts}/build-log.txt"

View File

@@ -149,7 +149,7 @@ while getopts "hp:i:" opt ; do
exit 0
;;
p)
PARALLEL="$OPTARG"
PARALLEL="${OPTARG}"
if ! isnum "${PARALLEL}" || [[ "${PARALLEL}" -le 0 ]]; then
kube::log::usage "'$0': argument to -p must be numeric and greater than 0"
kube::test::usage
@@ -166,7 +166,7 @@ while getopts "hp:i:" opt ; do
exit 1
;;
:)
kube::log::usage "Option -$OPTARG <value>"
kube::log::usage "Option -${OPTARG} <value>"
kube::test::usage
exit 1
;;
@@ -223,15 +223,15 @@ verifyAndSuggestPackagePath() {
local original_package_path="$3"
local suggestion_package_path="$4"
if ! [ -d "$specified_package_path" ]; then
if ! [ -d "${specified_package_path}" ]; then
# Because k8s sets a localized $GOPATH for testing, seeing the actual
# directory can be confusing. Instead, just show $GOPATH if it exists in the
# $specified_package_path.
local printable_package_path=$(echo "$specified_package_path" | sed "s|$GOPATH|\$GOPATH|")
kube::log::error "specified test path '$printable_package_path' does not exist"
local printable_package_path=$(echo "${specified_package_path}" | sed "s|${GOPATH}|\${GOPATH}|")
kube::log::error "specified test path '${printable_package_path}' does not exist"
if [ -d "$alternative_package_path" ]; then
kube::log::info "try changing \"$original_package_path\" to \"$suggestion_package_path\""
if [ -d "${alternative_package_path}" ]; then
kube::log::info "try changing \"${original_package_path}\" to \"${suggestion_package_path}\""
fi
exit 1
fi
@@ -241,13 +241,13 @@ verifyPathsToPackagesUnderTest() {
local packages_under_test=($@)
for package_path in "${packages_under_test[@]}"; do
local local_package_path="$package_path"
local go_package_path="$GOPATH/src/$package_path"
local local_package_path="${package_path}"
local go_package_path="${GOPATH}/src/${package_path}"
if [[ "${package_path:0:2}" == "./" ]] ; then
verifyAndSuggestPackagePath "$local_package_path" "$go_package_path" "$package_path" "${package_path:2}"
verifyAndSuggestPackagePath "${local_package_path}" "${go_package_path}" "${package_path}" "${package_path:2}"
else
verifyAndSuggestPackagePath "$go_package_path" "$local_package_path" "$package_path" "./$package_path"
verifyAndSuggestPackagePath "${go_package_path}" "${local_package_path}" "${package_path}" "./${package_path}"
fi
done
}
@@ -317,7 +317,7 @@ runTests() {
# https://github.com/golang/go/issues/16540
cover_ignore_dirs="vendor/k8s.io/code-generator/cmd/generator|vendor/k8s.io/client-go/1.4/rest"
for path in $(echo ${cover_ignore_dirs} | sed 's/|/ /g'); do
echo -e "skipped\tk8s.io/kubernetes/$path"
echo -e "skipped\tk8s.io/kubernetes/${path}"
done
printf "%s\n" "${@}" \

View File

@@ -61,17 +61,17 @@ BASH_TARGETS="
update-bazel"
for t in ${BASH_TARGETS}; do
echo -e "${color_yellow}Running $t${color_norm}"
echo -e "${color_yellow}Running ${t}${color_norm}"
if ${SILENT} ; then
if ! bash "${KUBE_ROOT}/hack/$t.sh" 1> /dev/null; then
echo -e "${color_red}Running $t FAILED${color_norm}"
if ! bash "${KUBE_ROOT}/hack/${t}.sh" 1> /dev/null; then
echo -e "${color_red}Running ${t} FAILED${color_norm}"
if ! ${ALL}; then
exit 1
fi
fi
else
if ! bash "${KUBE_ROOT}/hack/$t.sh"; then
echo -e "${color_red}Running $t FAILED${color_norm}"
if ! bash "${KUBE_ROOT}/hack/${t}.sh"; then
echo -e "${color_red}Running ${t} FAILED${color_norm}"
if ! ${ALL}; then
exit 1
fi

View File

@@ -86,7 +86,7 @@ QUICK_CHECKS=$(ls ${QUICK_PATTERNS[@]/#/${KUBE_ROOT}\/hack\/} 2>/dev/null || tru
function is-excluded {
for e in ${EXCLUDED_CHECKS[@]}; do
if [[ $1 -ef "$e" ]]; then
if [[ $1 -ef "${e}" ]]; then
return
fi
done
@@ -95,7 +95,7 @@ function is-excluded {
function is-quick {
for e in ${QUICK_CHECKS[@]}; do
if [[ $1 -ef "$e" ]]; then
if [[ $1 -ef "${e}" ]]; then
return
fi
done
@@ -106,7 +106,7 @@ function is-explicitly-chosen {
local name="${1#verify-}"
name="${name%.*}"
for e in ${WHAT}; do
if [[ $e == "$name" ]]; then
if [[ "${e}" == "${name}" ]]; then
return
fi
done