Skip to content

Commit 2fb859d

Browse files
committed
Fix shellcheck failures on
update pull request update pull request
1 parent ea38af7 commit 2fb859d

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

hack/.shellcheck_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
./cluster/restore-from-backup.sh
2121
./cluster/test-e2e.sh
2222
./cluster/validate-cluster.sh
23-
./hack/ginkgo-e2e.sh
2423
./hack/lib/init.sh
2524
./hack/lib/swagger.sh
2625
./hack/lib/test.sh

hack/ginkgo-e2e.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
21+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222
source "${KUBE_ROOT}/cluster/common.sh"
2323
source "${KUBE_ROOT}/hack/lib/init.sh"
2424

@@ -38,8 +38,8 @@ GINKGO_NO_COLOR=${GINKGO_NO_COLOR:-n}
3838
# If 'y', will rerun failed tests once to give them a second chance.
3939
GINKGO_TOLERATE_FLAKES=${GINKGO_TOLERATE_FLAKES:-n}
4040

41-
: ${KUBECTL:="${KUBE_ROOT}/cluster/kubectl.sh"}
42-
: ${KUBE_CONFIG_FILE:="config-test.sh"}
41+
: "${KUBECTL:="${KUBE_ROOT}/cluster/kubectl.sh"}"
42+
: "${KUBE_CONFIG_FILE:="config-test.sh"}"
4343

4444
export KUBECTL KUBE_CONFIG_FILE
4545

@@ -48,11 +48,13 @@ source "${KUBE_ROOT}/cluster/kube-util.sh"
4848
function detect-master-from-kubeconfig() {
4949
export KUBECONFIG=${KUBECONFIG:-$DEFAULT_KUBECONFIG}
5050

51-
local cc=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o jsonpath="{.current-context}")
52-
if [[ ! -z "${KUBE_CONTEXT:-}" ]]; then
51+
local cc
52+
cc=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o jsonpath="{.current-context}")
53+
if [[ -n "${KUBE_CONTEXT:-}" ]]; then
5354
cc="${KUBE_CONTEXT}"
5455
fi
55-
local cluster=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o jsonpath="{.contexts[?(@.name == \"${cc}\")].context.cluster}")
56+
local cluster
57+
cluster=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o jsonpath="{.contexts[?(@.name == \"${cc}\")].context.cluster}")
5658
KUBE_MASTER_URL=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o jsonpath="{.clusters[?(@.name == \"${cluster}\")].cluster.server}")
5759
}
5860

@@ -86,8 +88,8 @@ fi
8688
if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then
8789
set_num_migs
8890
NODE_INSTANCE_GROUP=""
89-
for ((i=1; i<=${NUM_MIGS}; i++)); do
90-
if [[ ${i} == ${NUM_MIGS} ]]; then
91+
for ((i=1; i<=NUM_MIGS; i++)); do
92+
if [[ ${i} == "${NUM_MIGS}" ]]; then
9193
# We are assigning the same mig names as create-nodes function from cluster/gce/util.sh.
9294
NODE_INSTANCE_GROUP="${NODE_INSTANCE_GROUP}${NODE_INSTANCE_PREFIX}-group"
9395
else
@@ -101,7 +103,7 @@ fi
101103
# KUBERNETES_CONFORMANCE_PROVIDER is set to "gke".
102104
if [[ -z "${NODE_INSTANCE_GROUP:-}" ]] && [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then
103105
detect-node-instance-groups
104-
NODE_INSTANCE_GROUP=$(kube::util::join , "${NODE_INSTANCE_GROUPS[@]}")
106+
NODE_INSTANCE_GROUP=$(kube::util::join , "${NODE_INSTANCE_GROUP[@]}")
105107
fi
106108

107109
if [[ "${KUBERNETES_PROVIDER}" == "azure" ]]; then
@@ -138,8 +140,9 @@ fi
138140
# The --host setting is used only when providing --auth_config
139141
# If --kubeconfig is used, the host to use is retrieved from the .kubeconfig
140142
# file and the one provided with --host is ignored.
141-
# Add path for things like running kubectl binary.
142-
export PATH=$(dirname "${e2e_test}"):"${PATH}"
143+
# Add path for things like running kubectl binary.
144+
PATH=$(dirname "${e2e_test}"):"${PATH}"
145+
export PATH
143146
"${ginkgo}" "${ginkgo_args[@]:+${ginkgo_args[@]}}" "${e2e_test}" -- \
144147
"${auth_config[@]:+${auth_config[@]}}" \
145148
--ginkgo.flakeAttempts="${FLAKE_ATTEMPTS}" \

0 commit comments

Comments
 (0)