@@ -22,7 +22,7 @@ set -o pipefail
22
22
#
23
23
# $ TRACE=1 test.sh
24
24
TRACE=${TRACE:- " " }
25
- if [ -n " $TRACE " ]; then
25
+ if [[ -n " ${ TRACE} " ] ]; then
26
26
set -x
27
27
fi
28
28
@@ -31,9 +31,9 @@ k8s_version=1.11.0
31
31
goarch=amd64
32
32
goos=" unknown"
33
33
34
- if [[ " $OSTYPE " == " linux" * ]]; then
34
+ if [[ " ${ OSTYPE} " == " linux" * ]]; then
35
35
goos=" linux"
36
- elif [[ " $OSTYPE " == " darwin" * ]]; then
36
+ elif [[ " ${ OSTYPE} " == " darwin" * ]]; then
37
37
goos=" darwin"
38
38
fi
39
39
47
47
#
48
48
# $ NO_COLOR=1 test.sh
49
49
NO_COLOR=${NO_COLOR:- " " }
50
- if [ -z " $NO_COLOR " ]; then
50
+ if [[ -z " ${ NO_COLOR} " ] ]; then
51
51
header=$' \e [1;33m'
52
52
reset=$' \e [0m'
53
53
else
@@ -61,7 +61,7 @@ function header_text {
61
61
62
62
tmp_root=/tmp
63
63
64
- kb_root_dir=$tmp_root /kubebuilder
64
+ kb_root_dir=${ tmp_root} /kubebuilder
65
65
66
66
# Skip fetching and untaring the tools by setting the SKIP_FETCH_TOOLS variable
67
67
# in your environment to any value:
@@ -75,30 +75,30 @@ SKIP_FETCH_TOOLS=${SKIP_FETCH_TOOLS:-""}
75
75
function prepare_staging_dir {
76
76
header_text " preparing staging dir"
77
77
78
- if [ -z " $SKIP_FETCH_TOOLS " ]; then
79
- rm -rf " $kb_root_dir "
78
+ if [[ -z " ${ SKIP_FETCH_TOOLS} " ] ]; then
79
+ rm -rf " ${ kb_root_dir} "
80
80
else
81
- rm -f " $kb_root_dir /kubebuilder/bin/kubebuilder"
82
- rm -f " $kb_root_dir /kubebuilder/bin/kubebuilder-gen"
83
- rm -f " $kb_root_dir /kubebuilder/bin/vendor.tar.gz"
81
+ rm -f " ${ kb_root_dir} /kubebuilder/bin/kubebuilder"
82
+ rm -f " ${ kb_root_dir} /kubebuilder/bin/kubebuilder-gen"
83
+ rm -f " ${ kb_root_dir} /kubebuilder/bin/vendor.tar.gz"
84
84
fi
85
85
}
86
86
87
87
# fetch k8s API gen tools and make it available under kb_root_dir/bin.
88
88
function fetch_tools {
89
- if [ -n " $SKIP_FETCH_TOOLS " ]; then
89
+ if [[ -n " $SKIP_FETCH_TOOLS " ] ]; then
90
90
return 0
91
91
fi
92
92
93
93
header_text " fetching tools"
94
- kb_tools_archive_name=" kubebuilder-tools-$k8s_version - $ goos- $ goarch .tar.gz"
95
- kb_tools_download_url=" https://storage.googleapis.com/kubebuilder-tools/$kb_tools_archive_name "
94
+ kb_tools_archive_name=" kubebuilder-tools-${ k8s_version} - ${ goos} - ${ goarch} .tar.gz"
95
+ kb_tools_download_url=" https://storage.googleapis.com/kubebuilder-tools/${ kb_tools_archive_name} "
96
96
97
- kb_tools_archive_path=" $tmp_root / $ kb_tools_archive_name"
98
- if [ ! -f $kb_tools_archive_path ]; then
99
- curl -fsL ${kb_tools_download_url} -o " $kb_tools_archive_path "
97
+ kb_tools_archive_path=" ${ tmp_root} / ${ kb_tools_archive_name} "
98
+ if [[ ! -f ${ kb_tools_archive_path} ] ]; then
99
+ curl -fsL ${kb_tools_download_url} -o " ${ kb_tools_archive_path} "
100
100
fi
101
- tar -zvxf " $kb_tools_archive_path " -C " $tmp_root /"
101
+ tar -zvxf " ${ kb_tools_archive_path} " -C " ${ tmp_root} /"
102
102
}
103
103
104
104
function setup_envs {
0 commit comments