Skip to content

Commit dc3edee

Browse files
authored
Merge pull request kubernetes#73107 from rlenferink/patch-2
Bash script syntax improvements
2 parents 3ec18a5 + 6df3deb commit dc3edee

File tree

12 files changed

+128
-128
lines changed

12 files changed

+128
-128
lines changed

hack/gen-swagger-doc/gen-swagger-docs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ top_level_models=$(grep '&[A-Za-z]*{},' /register.go | sed 's/.*&//;s/{},//')
3737
VERSION="${1#*_}"
3838
for m in ${top_level_models}
3939
do
40-
if grep -xq "=== ${VERSION}.$m" ./definitions.adoc
40+
if grep -xq "=== ${VERSION}.${m}" ./definitions.adoc
4141
then
42-
buf+="* <<${VERSION}.$m>>\n"
42+
buf+="* <<${VERSION}.${m}>>\n"
4343
fi
4444
done
45-
sed -i "1i $buf" ./definitions.adoc
45+
sed -i "1i ${buf}" ./definitions.adoc
4646

4747
# fix the links in .adoc, replace <<x.y>> with link:definitions.html#_x_y[x.y], and lowercase the _x_y part
4848
sed -i -e 's|<<\(.*\)\.\(.*\)>>|link:#_\L\1_\2\E[\1.\2]|g' ./definitions.adoc

hack/jenkins/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ set -o xtrace
3030
# is an incoming variable Jenkins provides us for this job's scratch
3131
# space.
3232
export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME
33-
export PATH=$PATH:/usr/local/go/bin
33+
export PATH=${PATH}:/usr/local/go/bin
3434

3535
# Skip gcloud update checking
3636
export CLOUDSDK_COMPONENT_MANAGER_DISABLE_UPDATE_CHECK=true

hack/jenkins/gotest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ set -o xtrace
2828
# space.
2929
export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME
3030
export GOPATH=${HOME}/_gopath
31-
export PATH=${GOPATH}/bin:${HOME}/third_party/etcd:/usr/local/go/bin:$PATH
31+
export PATH=${GOPATH}/bin:${HOME}/third_party/etcd:/usr/local/go/bin:${PATH}
3232

3333
# Install a few things needed by unit and /integration tests.
3434
command -v etcd &>/dev/null || ./hack/install-etcd.sh

hack/jenkins/upload-to-gcs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ function print_started() {
139139
# will be available as started["metadata"][KEY.lower()].
140140
echo " \"metadata\": {"
141141
local sep="" # leading commas are easy to track
142-
for env_var in $metadata_keys; do
142+
for env_var in ${metadata_keys}; do
143143
local var_upper="${env_var#BUILD_METADATA_}"
144-
echo " $sep\"${var_upper,,}\": \"${!env_var}\""
144+
echo " ${sep}\"${var_upper,,}\": \"${!env_var}\""
145145
sep=","
146146
done
147147
echo " },"

hack/jenkins/verify-dockerized.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set -o xtrace
2121

2222
retry() {
2323
for i in {1..5}; do
24-
"$@" && return 0 || sleep $i
24+
"$@" && return 0 || sleep "${i}"
2525
done
2626
"$@"
2727
}

hack/jenkins/verify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ set -o xtrace
2828
# space.
2929
export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME
3030
export GOPATH=${HOME}/_gopath
31-
export PATH=${GOPATH}/bin:${HOME}/third_party/etcd:/usr/local/go/bin:$PATH
31+
export PATH=${GOPATH}/bin:${HOME}/third_party/etcd:/usr/local/go/bin:${PATH}
3232

3333
# Install a few things needed by the verification tests.
3434
command -v etcd &>/dev/null || ./hack/install-etcd.sh

hack/lib/logging.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ kube::log::errexit() {
3434
kube::log::error "Call tree:"
3535
for ((i=1;i<${#FUNCNAME[@]}-1;i++))
3636
do
37-
kube::log::error " $i: ${BASH_SOURCE[$i+1]}:${BASH_LINENO[$i]} ${FUNCNAME[$i]}(...)"
37+
kube::log::error " ${i}: ${BASH_SOURCE[${i}+1]}:${BASH_LINENO[${i}]} ${FUNCNAME[${i}]}(...)"
3838
done
3939
fi
4040
kube::log::error_exit "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}. '${BASH_COMMAND}' exited with status $err" "${1:-1}" 1
@@ -66,7 +66,7 @@ kube::log::stack() {
6666
local source_file=${BASH_SOURCE[$frame_no]}
6767
local source_lineno=${BASH_LINENO[$((frame_no - 1))]}
6868
local funcname=${FUNCNAME[$frame_no]}
69-
echo " $i: ${source_file}:${source_lineno} ${funcname}(...)" >&2
69+
echo " ${i}: ${source_file}:${source_lineno} ${funcname}(...)" >&2
7070
done
7171
fi
7272
}

0 commit comments

Comments
 (0)