Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b18bc2ea
Commit
b18bc2ea
authored
Jan 21, 2019
by
Roy Lenferink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved some more bash script variable definitions
parent
f788854e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
72 additions
and
72 deletions
+72
-72
etcd.sh
hack/lib/etcd.sh
+2
-2
golang.sh
hack/lib/golang.sh
+11
-11
init.sh
hack/lib/init.sh
+9
-9
logging.sh
hack/lib/logging.sh
+13
-13
swagger.sh
hack/lib/swagger.sh
+7
-7
test.sh
hack/lib/test.sh
+2
-2
util.sh
hack/lib/util.sh
+5
-5
local-up-cluster.sh
hack/local-up-cluster.sh
+2
-2
test-e2e-node.sh
hack/make-rules/test-e2e-node.sh
+1
-1
test.sh
hack/make-rules/test.sh
+12
-12
update.sh
hack/make-rules/update.sh
+5
-5
verify.sh
hack/make-rules/verify.sh
+3
-3
No files found.
hack/lib/etcd.sh
View file @
b18bc2ea
...
@@ -48,9 +48,9 @@ kube::etcd::validate() {
...
@@ -48,9 +48,9 @@ kube::etcd::validate() {
# validate installed version is at least equal to minimum
# validate installed version is at least equal to minimum
version
=
$(
etcd
--version
|
tail
-n
+1 |
head
-n
1 |
cut
-d
" "
-f
3
)
version
=
$(
etcd
--version
|
tail
-n
+1 |
head
-n
1 |
cut
-d
" "
-f
3
)
if
[[
$(
kube::etcd::version
${
ETCD_VERSION
})
-gt
$(
kube::etcd::version
${
version
})
]]
;
then
if
[[
$(
kube::etcd::version
${
ETCD_VERSION
})
-gt
$(
kube::etcd::version
${
version
})
]]
;
then
export
PATH
=
${
KUBE_ROOT
}
/third_party/etcd:
$
PATH
export
PATH
=
${
KUBE_ROOT
}
/third_party/etcd:
$
{
PATH
}
hash
etcd
hash
etcd
echo
$PATH
echo
"
${
PATH
}
"
version
=
$(
etcd
--version
|
head
-n
1 |
cut
-d
" "
-f
3
)
version
=
$(
etcd
--version
|
head
-n
1 |
cut
-d
" "
-f
3
)
if
[[
$(
kube::etcd::version
${
ETCD_VERSION
})
-gt
$(
kube::etcd::version
${
version
})
]]
;
then
if
[[
$(
kube::etcd::version
${
ETCD_VERSION
})
-gt
$(
kube::etcd::version
${
version
})
]]
;
then
kube::log::usage
"etcd version
${
ETCD_VERSION
}
or greater required."
kube::log::usage
"etcd version
${
ETCD_VERSION
}
or greater required."
...
...
hack/lib/golang.sh
View file @
b18bc2ea
...
@@ -88,10 +88,10 @@ readonly KUBE_NODE_BINARIES=("${KUBE_NODE_TARGETS[@]##*/}")
...
@@ -88,10 +88,10 @@ readonly KUBE_NODE_BINARIES=("${KUBE_NODE_TARGETS[@]##*/}")
readonly
KUBE_NODE_BINARIES_WIN
=(
"
${
KUBE_NODE_BINARIES
[@]/%/.exe
}
"
)
readonly
KUBE_NODE_BINARIES_WIN
=(
"
${
KUBE_NODE_BINARIES
[@]/%/.exe
}
"
)
if
[[
-n
"
${
KUBE_BUILD_PLATFORMS
:-}
"
]]
;
then
if
[[
-n
"
${
KUBE_BUILD_PLATFORMS
:-}
"
]]
;
then
IFS
=
" "
read
-ra
KUBE_SERVER_PLATFORMS
<<<
"
$
KUBE_BUILD_PLATFORMS
"
IFS
=
" "
read
-ra
KUBE_SERVER_PLATFORMS
<<<
"
$
{
KUBE_BUILD_PLATFORMS
}
"
IFS
=
" "
read
-ra
KUBE_NODE_PLATFORMS
<<<
"
$
KUBE_BUILD_PLATFORMS
"
IFS
=
" "
read
-ra
KUBE_NODE_PLATFORMS
<<<
"
$
{
KUBE_BUILD_PLATFORMS
}
"
IFS
=
" "
read
-ra
KUBE_TEST_PLATFORMS
<<<
"
$
KUBE_BUILD_PLATFORMS
"
IFS
=
" "
read
-ra
KUBE_TEST_PLATFORMS
<<<
"
$
{
KUBE_BUILD_PLATFORMS
}
"
IFS
=
" "
read
-ra
KUBE_CLIENT_PLATFORMS
<<<
"
$
KUBE_BUILD_PLATFORMS
"
IFS
=
" "
read
-ra
KUBE_CLIENT_PLATFORMS
<<<
"
$
{
KUBE_BUILD_PLATFORMS
}
"
readonly
KUBE_SERVER_PLATFORMS
readonly
KUBE_SERVER_PLATFORMS
readonly
KUBE_NODE_PLATFORMS
readonly
KUBE_NODE_PLATFORMS
readonly
KUBE_TEST_PLATFORMS
readonly
KUBE_TEST_PLATFORMS
...
@@ -268,11 +268,11 @@ kube::golang::is_statically_linked_library() {
...
@@ -268,11 +268,11 @@ kube::golang::is_statically_linked_library() {
[[
"
$(
go
env
GOHOSTOS
)
"
==
"darwin"
&&
"
$(
go
env
GOOS
)
"
==
"darwin"
&&
[[
"
$(
go
env
GOHOSTOS
)
"
==
"darwin"
&&
"
$(
go
env
GOOS
)
"
==
"darwin"
&&
"
$1
"
==
*
"/kubectl"
]]
&&
return
1
"
$1
"
==
*
"/kubectl"
]]
&&
return
1
if
[[
-n
"
${
KUBE_CGO_OVERRIDES
:+x
}
"
]]
;
then
if
[[
-n
"
${
KUBE_CGO_OVERRIDES
:+x
}
"
]]
;
then
for
e
in
"
${
KUBE_CGO_OVERRIDES
[@]
}
"
;
do
[[
"
$
1
"
==
*
"/
$e
"
]]
&&
return
1
;
done
;
for
e
in
"
${
KUBE_CGO_OVERRIDES
[@]
}
"
;
do
[[
"
$
{
1
}
"
==
*
"/
${
e
}
"
]]
&&
return
1
;
done
;
fi
fi
for
e
in
"
${
KUBE_STATIC_LIBRARIES
[@]
}
"
;
do
[[
"
$
1
"
==
*
"/
$e
"
]]
&&
return
0
;
done
;
for
e
in
"
${
KUBE_STATIC_LIBRARIES
[@]
}
"
;
do
[[
"
$
{
1
}
"
==
*
"/
${
e
}
"
]]
&&
return
0
;
done
;
if
[[
-n
"
${
KUBE_STATIC_OVERRIDES
:+x
}
"
]]
;
then
if
[[
-n
"
${
KUBE_STATIC_OVERRIDES
:+x
}
"
]]
;
then
for
e
in
"
${
KUBE_STATIC_OVERRIDES
[@]
}
"
;
do
[[
"
$
1
"
==
*
"/
$e
"
]]
&&
return
0
;
done
;
for
e
in
"
${
KUBE_STATIC_OVERRIDES
[@]
}
"
;
do
[[
"
$
{
1
}
"
==
*
"/
${
e
}
"
]]
&&
return
0
;
done
;
fi
fi
return
1
;
return
1
;
}
}
...
@@ -426,7 +426,7 @@ kube::golang::setup_env() {
...
@@ -426,7 +426,7 @@ kube::golang::setup_env() {
# resultant binaries. Go will not let us use GOBIN with `go install` and
# resultant binaries. Go will not let us use GOBIN with `go install` and
# cross-compiling, and `go install -o <file>` only works for a single pkg.
# cross-compiling, and `go install -o <file>` only works for a single pkg.
local
subdir
local
subdir
subdir
=
$(
kube::realpath
.
|
sed
"s|
$
KUBE_ROOT
||"
)
subdir
=
$(
kube::realpath
.
|
sed
"s|
$
{
KUBE_ROOT
}
||"
)
cd
"
${
KUBE_GOPATH
}
/src/
${
KUBE_GO_PACKAGE
}
/
${
subdir
}
"
cd
"
${
KUBE_GOPATH
}
/src/
${
KUBE_GO_PACKAGE
}
/
${
subdir
}
"
# Set GOROOT so binaries that parse code can work properly.
# Set GOROOT so binaries that parse code can work properly.
...
@@ -458,7 +458,7 @@ kube::golang::place_bins() {
...
@@ -458,7 +458,7 @@ kube::golang::place_bins() {
# The substitution on platform_src below will replace all slashes with
# The substitution on platform_src below will replace all slashes with
# underscores. It'll transform darwin/amd64 -> darwin_amd64.
# underscores. It'll transform darwin/amd64 -> darwin_amd64.
local
platform_src
=
"/
${
platform
//\//_
}
"
local
platform_src
=
"/
${
platform
//\//_
}
"
if
[[
"
$
platform
"
==
"
$host_platform
"
]]
;
then
if
[[
"
$
{
platform
}
"
==
"
${
host_platform
}
"
]]
;
then
platform_src
=
""
platform_src
=
""
rm
-f
"
${
THIS_PLATFORM_BIN
}
"
rm
-f
"
${
THIS_PLATFORM_BIN
}
"
ln
-s
"
${
KUBE_OUTPUT_BINPATH
}
/
${
platform
}
"
"
${
THIS_PLATFORM_BIN
}
"
ln
-s
"
${
KUBE_OUTPUT_BINPATH
}
/
${
platform
}
"
"
${
THIS_PLATFORM_BIN
}
"
...
@@ -479,7 +479,7 @@ kube::golang::outfile_for_binary() {
...
@@ -479,7 +479,7 @@ kube::golang::outfile_for_binary() {
local
binary
=
$1
local
binary
=
$1
local
platform
=
$2
local
platform
=
$2
local
output_path
=
"
${
KUBE_GOPATH
}
/bin"
local
output_path
=
"
${
KUBE_GOPATH
}
/bin"
if
[[
"
$
platform
"
!=
"
$host_platform
"
]]
;
then
if
[[
"
$
{
platform
}
"
!=
"
${
host_platform
}
"
]]
;
then
output_path
=
"
${
output_path
}
/
${
platform
//\//_
}
"
output_path
=
"
${
output_path
}
/
${
platform
//\//_
}
"
fi
fi
local
bin
=
$(
basename
"
${
binary
}
"
)
local
bin
=
$(
basename
"
${
binary
}
"
)
...
@@ -502,7 +502,7 @@ kube::golang::path_for_coverage_dummy_test() {
...
@@ -502,7 +502,7 @@ kube::golang::path_for_coverage_dummy_test() {
local
package
=
"
$1
"
local
package
=
"
$1
"
local
path
=
"
${
KUBE_GOPATH
}
/src/
${
package
}
"
local
path
=
"
${
KUBE_GOPATH
}
/src/
${
package
}
"
local
name
=
$(
basename
"
${
package
}
"
)
local
name
=
$(
basename
"
${
package
}
"
)
echo
"
$
path
/zz_generated_
${
name
}
_test.go"
echo
"
$
{
path
}
/zz_generated_
${
name
}
_test.go"
}
}
# Argument: the name of a Kubernetes package (e.g. k8s.io/kubernetes/cmd/kube-scheduler).
# Argument: the name of a Kubernetes package (e.g. k8s.io/kubernetes/cmd/kube-scheduler).
...
...
hack/lib/init.sh
View file @
b18bc2ea
...
@@ -132,15 +132,15 @@ KUBE_NONSERVER_GROUP_VERSIONS="
...
@@ -132,15 +132,15 @@ KUBE_NONSERVER_GROUP_VERSIONS="
function
kube::readlinkdashf
{
function
kube::readlinkdashf
{
# run in a subshell for simpler 'cd'
# run in a subshell for simpler 'cd'
(
(
if
[[
-d
"
$
1
"
]]
;
then
# This also catch symlinks to dirs.
if
[[
-d
"
$
{
1
}
"
]]
;
then
# This also catch symlinks to dirs.
cd
"
$
1
"
cd
"
$
{
1
}
"
pwd
-P
pwd
-P
else
else
cd
"
$(
dirname
"
$
1
"
)
"
cd
"
$(
dirname
"
$
{
1
}
"
)
"
local
f
local
f
f
=
$(
basename
"
$
1
"
)
f
=
$(
basename
"
$
{
1
}
"
)
if
[[
-L
"
$
f
"
]]
;
then
if
[[
-L
"
$
{
f
}
"
]]
;
then
readlink
"
$
f
"
readlink
"
$
{
f
}
"
else
else
echo
"
$(
pwd
-P
)
/
${
f
}
"
echo
"
$(
pwd
-P
)
/
${
f
}
"
fi
fi
...
@@ -176,9 +176,9 @@ function kube::readlinkdashf {
...
@@ -176,9 +176,9 @@ function kube::readlinkdashf {
# testone $T/linkdir/linkfile
# testone $T/linkdir/linkfile
# testone $T/linkdir/linkdir
# testone $T/linkdir/linkdir
kube::realpath
()
{
kube::realpath
()
{
if
[[
!
-e
"
$
1
"
]]
;
then
if
[[
!
-e
"
$
{
1
}
"
]]
;
then
echo
"
$
1
: No such file or directory"
>
&2
echo
"
$
{
1
}
: No such file or directory"
>
&2
return
1
return
1
fi
fi
kube::readlinkdashf
"
$
1
"
kube::readlinkdashf
"
$
{
1
}
"
}
}
hack/lib/logging.sh
View file @
b18bc2ea
...
@@ -37,7 +37,7 @@ kube::log::errexit() {
...
@@ -37,7 +37,7 @@ kube::log::errexit() {
kube::log::error
"
${
i
}
:
${
BASH_SOURCE
[
${
i
}
+1]
}
:
${
BASH_LINENO
[
${
i
}
]
}
${
FUNCNAME
[
${
i
}
]
}
(...)"
kube::log::error
"
${
i
}
:
${
BASH_SOURCE
[
${
i
}
+1]
}
:
${
BASH_LINENO
[
${
i
}
]
}
${
FUNCNAME
[
${
i
}
]
}
(...)"
done
done
fi
fi
kube::log::error_exit
"Error in
${
BASH_SOURCE
[1]
}
:
${
BASH_LINENO
[0]
}
. '
${
BASH_COMMAND
}
' exited with status
$
err
"
"
${
1
:-
1
}
"
1
kube::log::error_exit
"Error in
${
BASH_SOURCE
[1]
}
:
${
BASH_LINENO
[0]
}
. '
${
BASH_COMMAND
}
' exited with status
$
{
err
}
"
"
${
1
:-
1
}
"
1
}
}
kube::log::install_errexit
()
{
kube::log::install_errexit
()
{
...
@@ -63,9 +63,9 @@ kube::log::stack() {
...
@@ -63,9 +63,9 @@ kube::log::stack() {
for
((
i
=
1
;
i <
=
${#
FUNCNAME
[@]
}
-
${
stack_skip
}
;
i++
))
for
((
i
=
1
;
i <
=
${#
FUNCNAME
[@]
}
-
${
stack_skip
}
;
i++
))
do
do
local
frame_no
=
$((
i
-
1
+
stack_skip
))
local
frame_no
=
$((
i
-
1
+
stack_skip
))
local
source_file
=
${
BASH_SOURCE
[
$
frame_no
]
}
local
source_file
=
${
BASH_SOURCE
[
$
{
frame_no
}
]
}
local
source_lineno
=
${
BASH_LINENO
[
$((
frame_no
-
1
))
]
}
local
source_lineno
=
${
BASH_LINENO
[
$((
frame_no
-
1
))
]
}
local
funcname
=
${
FUNCNAME
[
$
frame_no
]
}
local
funcname
=
${
FUNCNAME
[
$
{
frame_no
}
]
}
echo
"
${
i
}
:
${
source_file
}
:
${
source_lineno
}
${
funcname
}
(...)"
>
&2
echo
"
${
i
}
:
${
source_file
}
:
${
source_lineno
}
${
funcname
}
(...)"
>
&2
done
done
fi
fi
...
@@ -83,7 +83,7 @@ kube::log::error_exit() {
...
@@ -83,7 +83,7 @@ kube::log::error_exit() {
stack_skip
=
$((
stack_skip
+
1
))
stack_skip
=
$((
stack_skip
+
1
))
if
[[
${
KUBE_VERBOSE
}
-ge
4
]]
;
then
if
[[
${
KUBE_VERBOSE
}
-ge
4
]]
;
then
local
source_file
=
${
BASH_SOURCE
[
$
stack_skip
]
}
local
source_file
=
${
BASH_SOURCE
[
$
{
stack_skip
}
]
}
local
source_line
=
${
BASH_LINENO
[
$((
stack_skip
-
1
))
]
}
local
source_line
=
${
BASH_LINENO
[
$((
stack_skip
-
1
))
]
}
echo
"!!! Error in
${
source_file
}
:
${
source_line
}
"
>
&2
echo
"!!! Error in
${
source_file
}
:
${
source_line
}
"
>
&2
[[
-z
${
1
-
}
]]
||
{
[[
-z
${
1
-
}
]]
||
{
...
@@ -101,10 +101,10 @@ kube::log::error_exit() {
...
@@ -101,10 +101,10 @@ kube::log::error_exit() {
# Log an error but keep going. Don't dump the stack or exit.
# Log an error but keep going. Don't dump the stack or exit.
kube::log::error
()
{
kube::log::error
()
{
timestamp
=
$(
date
+
"[%m%d %H:%M:%S]"
)
timestamp
=
$(
date
+
"[%m%d %H:%M:%S]"
)
echo
"!!!
$
timestamp
${
1
-
}
"
>
&2
echo
"!!!
$
{
timestamp
}
${
1
-
}
"
>
&2
shift
shift
for
message
;
do
for
message
;
do
echo
"
$
message
"
>
&2
echo
"
$
{
message
}
"
>
&2
done
done
}
}
...
@@ -113,7 +113,7 @@ kube::log::usage() {
...
@@ -113,7 +113,7 @@ kube::log::usage() {
echo
>
&2
echo
>
&2
local
message
local
message
for
message
;
do
for
message
;
do
echo
"
$
message
"
>
&2
echo
"
$
{
message
}
"
>
&2
done
done
echo
>
&2
echo
>
&2
}
}
...
@@ -121,7 +121,7 @@ kube::log::usage() {
...
@@ -121,7 +121,7 @@ kube::log::usage() {
kube::log::usage_from_stdin
()
{
kube::log::usage_from_stdin
()
{
local
messages
=()
local
messages
=()
while
read
-r
line
;
do
while
read
-r
line
;
do
messages+
=(
"
$
line
"
)
messages+
=(
"
$
{
line
}
"
)
done
done
kube::log::usage
"
${
messages
[@]
}
"
kube::log::usage
"
${
messages
[@]
}
"
...
@@ -135,21 +135,21 @@ kube::log::info() {
...
@@ -135,21 +135,21 @@ kube::log::info() {
fi
fi
for
message
;
do
for
message
;
do
echo
"
$
message
"
echo
"
$
{
message
}
"
done
done
}
}
# Just like kube::log::info, but no \n, so you can make a progress bar
# Just like kube::log::info, but no \n, so you can make a progress bar
kube::log::progress
()
{
kube::log::progress
()
{
for
message
;
do
for
message
;
do
echo
-e
-n
"
$
message
"
echo
-e
-n
"
$
{
message
}
"
done
done
}
}
kube::log::info_from_stdin
()
{
kube::log::info_from_stdin
()
{
local
messages
=()
local
messages
=()
while
read
-r
line
;
do
while
read
-r
line
;
do
messages+
=(
"
$
line
"
)
messages+
=(
"
$
{
line
}
"
)
done
done
kube::log::info
"
${
messages
[@]
}
"
kube::log::info
"
${
messages
[@]
}
"
...
@@ -163,9 +163,9 @@ kube::log::status() {
...
@@ -163,9 +163,9 @@ kube::log::status() {
fi
fi
timestamp
=
$(
date
+
"[%m%d %H:%M:%S]"
)
timestamp
=
$(
date
+
"[%m%d %H:%M:%S]"
)
echo
"+++
$
timestamp
$1
"
echo
"+++
$
{
timestamp
}
${
1
}
"
shift
shift
for
message
;
do
for
message
;
do
echo
"
$
message
"
echo
"
$
{
message
}
"
done
done
}
}
hack/lib/swagger.sh
View file @
b18bc2ea
...
@@ -34,9 +34,9 @@ kube::swagger::gen_types_swagger_doc() {
...
@@ -34,9 +34,9 @@ kube::swagger::gen_types_swagger_doc() {
echo
"Generating swagger type docs for
${
group_version
}
at
${
gv_dir
}
"
echo
"Generating swagger type docs for
${
group_version
}
at
${
gv_dir
}
"
echo
-e
"
$(
cat
hack/boilerplate/boilerplate.generatego.txt
)
\n
"
>
"
$
TMPFILE
"
echo
-e
"
$(
cat
hack/boilerplate/boilerplate.generatego.txt
)
\n
"
>
"
$
{
TMPFILE
}
"
echo
"package
${
group_version
##*/
}
"
>>
"
$
TMPFILE
"
echo
"package
${
group_version
##*/
}
"
>>
"
$
{
TMPFILE
}
"
cat
>>
"
$
TMPFILE
"
<<
EOF
cat
>>
"
$
{
TMPFILE
}
"
<<
EOF
// This file contains a collection of methods that can be used from go-restful to
// This file contains a collection of methods that can be used from go-restful to
// generate Swagger API documentation for its models. Please read this PR for more
// generate Swagger API documentation for its models. Please read this PR for more
...
@@ -54,10 +54,10 @@ EOF
...
@@ -54,10 +54,10 @@ EOF
go run cmd/genswaggertypedocs/swagger_type_docs.go
-s
\
go run cmd/genswaggertypedocs/swagger_type_docs.go
-s
\
"
${
gv_dir
}
/types.go"
\
"
${
gv_dir
}
/types.go"
\
-f
-
\
-f
-
\
>>
"
$
TMPFILE
"
>>
"
$
{
TMPFILE
}
"
echo
"// AUTO-GENERATED FUNCTIONS END HERE"
>>
"
$
TMPFILE
"
echo
"// AUTO-GENERATED FUNCTIONS END HERE"
>>
"
$
{
TMPFILE
}
"
gofmt
-w
-s
"
$
TMPFILE
"
gofmt
-w
-s
"
$
{
TMPFILE
}
"
mv
"
$
TMPFILE
"
""
${
gv_dir
}
"/types_swagger_doc_generated.go"
mv
"
$
{
TMPFILE
}
"
""
${
gv_dir
}
"/types_swagger_doc_generated.go"
}
}
hack/lib/test.sh
View file @
b18bc2ea
...
@@ -35,8 +35,8 @@ kube::test::clear_all() {
...
@@ -35,8 +35,8 @@ kube::test::clear_all() {
# Defaults to 2 levels so you can call this to find your own caller
# Defaults to 2 levels so you can call this to find your own caller
kube::test::get_caller
()
{
kube::test::get_caller
()
{
local
levels
=
${
1
:-
2
}
local
levels
=
${
1
:-
2
}
local
caller_file
=
"
${
BASH_SOURCE
[
$
levels
]
}
"
local
caller_file
=
"
${
BASH_SOURCE
[
$
{
levels
}
]
}
"
local
caller_line
=
"
${
BASH_LINENO
[
$
levels
-1]
}
"
local
caller_line
=
"
${
BASH_LINENO
[
$
{
levels
}
-1]
}
"
echo
"
$(
basename
"
${
caller_file
}
"
)
:
${
caller_line
}
"
echo
"
$(
basename
"
${
caller_file
}
"
)
:
${
caller_line
}
"
}
}
...
...
hack/lib/util.sh
View file @
b18bc2ea
...
@@ -45,9 +45,9 @@ kube::util::wait_for_url() {
...
@@ -45,9 +45,9 @@ kube::util::wait_for_url() {
}
}
local
i
local
i
for
i
in
$(
seq
1
"
$
times
"
)
;
do
for
i
in
$(
seq
1
"
$
{
times
}
"
)
;
do
local
out
local
out
if
out
=
$(
curl
--max-time
"
$
maxtime
"
-gkfs
"
$url
"
2>/dev/null
)
;
then
if
out
=
$(
curl
--max-time
"
$
{
maxtime
}
"
-gkfs
"
${
url
}
"
2>/dev/null
)
;
then
kube::log::status
"On try
${
i
}
,
${
prefix
}
:
${
out
}
"
kube::log::status
"On try
${
i
}
,
${
prefix
}
:
${
out
}
"
return
0
return
0
fi
fi
...
@@ -441,11 +441,11 @@ kube::util::ensure_no_staging_repos_in_gopath() {
...
@@ -441,11 +441,11 @@ kube::util::ensure_no_staging_repos_in_gopath() {
kube::util::ensure_single_dir_gopath
kube::util::ensure_single_dir_gopath
local
error
=
0
local
error
=
0
for
repo_file
in
"
${
KUBE_ROOT
}
"
/staging/src/k8s.io/
*
;
do
for
repo_file
in
"
${
KUBE_ROOT
}
"
/staging/src/k8s.io/
*
;
do
if
[[
!
-d
"
$
repo_file
"
]]
;
then
if
[[
!
-d
"
$
{
repo_file
}
"
]]
;
then
# not a directory or there were no files
# not a directory or there were no files
continue
;
continue
;
fi
fi
repo
=
"
$(
basename
"
$
repo_file
"
)
"
repo
=
"
$(
basename
"
$
{
repo_file
}
"
)
"
if
[
-e
"
${
GOPATH
}
/src/k8s.io/
${
repo
}
"
]
;
then
if
[
-e
"
${
GOPATH
}
/src/k8s.io/
${
repo
}
"
]
;
then
echo
"k8s.io/
${
repo
}
exists in GOPATH. Remove before running godep-save.sh."
1>&2
echo
"k8s.io/
${
repo
}
exists in GOPATH. Remove before running godep-save.sh."
1>&2
error
=
1
error
=
1
...
@@ -722,7 +722,7 @@ function kube::util::ensure-cfssl {
...
@@ -722,7 +722,7 @@ function kube::util::ensure-cfssl {
mkdir
-p
"
${
cfssldir
}
"
mkdir
-p
"
${
cfssldir
}
"
pushd
"
${
cfssldir
}
"
>
/dev/null
pushd
"
${
cfssldir
}
"
>
/dev/null
echo
"Unable to successfully run 'cfssl' from
$
PATH
; downloading instead..."
echo
"Unable to successfully run 'cfssl' from
$
{
PATH
}
; downloading instead..."
kernel
=
$(
uname
-s
)
kernel
=
$(
uname
-s
)
case
"
${
kernel
}
"
in
case
"
${
kernel
}
"
in
Linux
)
Linux
)
...
...
hack/local-up-cluster.sh
View file @
b18bc2ea
...
@@ -965,9 +965,9 @@ create_csi_crd() {
...
@@ -965,9 +965,9 @@ create_csi_crd() {
echo "
create_csi_crd
$1
"
echo "
create_csi_crd
$1
"
YAML_FILE=
${
KUBE_ROOT
}
/cluster/addons/storage-crds/
$1
.yaml
YAML_FILE=
${
KUBE_ROOT
}
/cluster/addons/storage-crds/
$1
.yaml
if [ -e
$YAML_FILE
]; then
if [ -e
"
${
YAML_FILE
}
"
]; then
echo "
Create
$1
crd
"
echo "
Create
$1
crd
"
${
KUBECTL
}
--kubeconfig="
${
CERT_DIR
}
/admin.kubeconfig
" create -f
$
YAML_FILE
${
KUBECTL
}
--kubeconfig="
${
CERT_DIR
}
/admin.kubeconfig
" create -f
$
{
YAML_FILE
}
else
else
echo "
No
$1
available.
"
echo "
No
$1
available.
"
fi
fi
...
...
hack/make-rules/test-e2e-node.sh
View file @
b18bc2ea
...
@@ -169,7 +169,7 @@ else
...
@@ -169,7 +169,7 @@ else
# Test using the host the script was run on
# Test using the host the script was run on
# Provided for backwards compatibility
# Provided for backwards compatibility
go run
test
/e2e_node/runner/local/run_local.go
\
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
}
\
--test-flags
=
"--container-runtime=
${
runtime
}
\
--alsologtostderr --v 4 --report-dir=
${
artifacts
}
--node-name
$(
hostname
)
\
--alsologtostderr --v 4 --report-dir=
${
artifacts
}
--node-name
$(
hostname
)
\
${
test_args
}
"
--build-dependencies
=
true
2>&1 |
tee
-i
"
${
artifacts
}
/build-log.txt"
${
test_args
}
"
--build-dependencies
=
true
2>&1 |
tee
-i
"
${
artifacts
}
/build-log.txt"
...
...
hack/make-rules/test.sh
View file @
b18bc2ea
...
@@ -149,7 +149,7 @@ while getopts "hp:i:" opt ; do
...
@@ -149,7 +149,7 @@ while getopts "hp:i:" opt ; do
exit
0
exit
0
;;
;;
p
)
p
)
PARALLEL
=
"
$
OPTARG
"
PARALLEL
=
"
$
{
OPTARG
}
"
if
!
isnum
"
${
PARALLEL
}
"
||
[[
"
${
PARALLEL
}
"
-le
0
]]
;
then
if
!
isnum
"
${
PARALLEL
}
"
||
[[
"
${
PARALLEL
}
"
-le
0
]]
;
then
kube::log::usage
"'
$0
': argument to -p must be numeric and greater than 0"
kube::log::usage
"'
$0
': argument to -p must be numeric and greater than 0"
kube::test::usage
kube::test::usage
...
@@ -166,7 +166,7 @@ while getopts "hp:i:" opt ; do
...
@@ -166,7 +166,7 @@ while getopts "hp:i:" opt ; do
exit
1
exit
1
;;
;;
:
)
:
)
kube::log::usage
"Option -
$
OPTARG
<value>"
kube::log::usage
"Option -
$
{
OPTARG
}
<value>"
kube::test::usage
kube::test::usage
exit
1
exit
1
;;
;;
...
@@ -223,15 +223,15 @@ verifyAndSuggestPackagePath() {
...
@@ -223,15 +223,15 @@ verifyAndSuggestPackagePath() {
local
original_package_path
=
"
$3
"
local
original_package_path
=
"
$3
"
local
suggestion_package_path
=
"
$4
"
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
# Because k8s sets a localized $GOPATH for testing, seeing the actual
# directory can be confusing. Instead, just show $GOPATH if it exists in the
# directory can be confusing. Instead, just show $GOPATH if it exists in the
# $specified_package_path.
# $specified_package_path.
local
printable_package_path
=
$(
echo
"
$
specified_package_path
"
|
sed
"s|
$GOPATH
|
\$
GOPATH
|"
)
local
printable_package_path
=
$(
echo
"
$
{
specified_package_path
}
"
|
sed
"s|
${
GOPATH
}
|
\$
{GOPATH}
|"
)
kube::log::error
"specified test path '
$
printable_package_path
' does not exist"
kube::log::error
"specified test path '
$
{
printable_package_path
}
' does not exist"
if
[
-d
"
$
alternative_package_path
"
]
;
then
if
[
-d
"
$
{
alternative_package_path
}
"
]
;
then
kube::log::info
"try changing
\"
$
original_package_path
\"
to
\"
$suggestion_package_path
\"
"
kube::log::info
"try changing
\"
$
{
original_package_path
}
\"
to
\"
${
suggestion_package_path
}
\"
"
fi
fi
exit
1
exit
1
fi
fi
...
@@ -241,13 +241,13 @@ verifyPathsToPackagesUnderTest() {
...
@@ -241,13 +241,13 @@ verifyPathsToPackagesUnderTest() {
local
packages_under_test
=(
$@
)
local
packages_under_test
=(
$@
)
for
package_path
in
"
${
packages_under_test
[@]
}
"
;
do
for
package_path
in
"
${
packages_under_test
[@]
}
"
;
do
local
local_package_path
=
"
$
package_path
"
local
local_package_path
=
"
$
{
package_path
}
"
local
go_package_path
=
"
$
GOPATH
/src/
$package_path
"
local
go_package_path
=
"
$
{
GOPATH
}
/src/
${
package_path
}
"
if
[[
"
${
package_path
:0:2
}
"
==
"./"
]]
;
then
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
else
verifyAndSuggestPackagePath
"
$
go_package_path
"
"
$local_package_path
"
"
$package_path
"
"./
$package_path
"
verifyAndSuggestPackagePath
"
$
{
go_package_path
}
"
"
${
local_package_path
}
"
"
${
package_path
}
"
"./
${
package_path
}
"
fi
fi
done
done
}
}
...
@@ -317,7 +317,7 @@ runTests() {
...
@@ -317,7 +317,7 @@ runTests() {
# https://github.com/golang/go/issues/16540
# 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"
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
for
path
in
$(
echo
${
cover_ignore_dirs
}
|
sed
's/|/ /g'
)
;
do
echo
-e
"skipped
\t
k8s.io/kubernetes/
$
path
"
echo
-e
"skipped
\t
k8s.io/kubernetes/
$
{
path
}
"
done
done
printf
"%s
\n
"
"
${
@
}
"
\
printf
"%s
\n
"
"
${
@
}
"
\
...
...
hack/make-rules/update.sh
View file @
b18bc2ea
...
@@ -61,17 +61,17 @@ BASH_TARGETS="
...
@@ -61,17 +61,17 @@ BASH_TARGETS="
update-bazel"
update-bazel"
for
t
in
${
BASH_TARGETS
}
;
do
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
${
SILENT
}
;
then
if
!
bash
"
${
KUBE_ROOT
}
/hack/
$
t
.sh"
1> /dev/null
;
then
if
!
bash
"
${
KUBE_ROOT
}
/hack/
$
{
t
}
.sh"
1> /dev/null
;
then
echo
-e
"
${
color_red
}
Running
$
t
FAILED
${
color_norm
}
"
echo
-e
"
${
color_red
}
Running
$
{
t
}
FAILED
${
color_norm
}
"
if
!
${
ALL
}
;
then
if
!
${
ALL
}
;
then
exit
1
exit
1
fi
fi
fi
fi
else
else
if
!
bash
"
${
KUBE_ROOT
}
/hack/
$
t
.sh"
;
then
if
!
bash
"
${
KUBE_ROOT
}
/hack/
$
{
t
}
.sh"
;
then
echo
-e
"
${
color_red
}
Running
$
t
FAILED
${
color_norm
}
"
echo
-e
"
${
color_red
}
Running
$
{
t
}
FAILED
${
color_norm
}
"
if
!
${
ALL
}
;
then
if
!
${
ALL
}
;
then
exit
1
exit
1
fi
fi
...
...
hack/make-rules/verify.sh
View file @
b18bc2ea
...
@@ -86,7 +86,7 @@ QUICK_CHECKS=$(ls ${QUICK_PATTERNS[@]/#/${KUBE_ROOT}\/hack\/} 2>/dev/null || tru
...
@@ -86,7 +86,7 @@ QUICK_CHECKS=$(ls ${QUICK_PATTERNS[@]/#/${KUBE_ROOT}\/hack\/} 2>/dev/null || tru
function
is-excluded
{
function
is-excluded
{
for
e
in
${
EXCLUDED_CHECKS
[@]
}
;
do
for
e
in
${
EXCLUDED_CHECKS
[@]
}
;
do
if
[[
$1
-ef
"
$
e
"
]]
;
then
if
[[
$1
-ef
"
$
{
e
}
"
]]
;
then
return
return
fi
fi
done
done
...
@@ -95,7 +95,7 @@ function is-excluded {
...
@@ -95,7 +95,7 @@ function is-excluded {
function
is-quick
{
function
is-quick
{
for
e
in
${
QUICK_CHECKS
[@]
}
;
do
for
e
in
${
QUICK_CHECKS
[@]
}
;
do
if
[[
$1
-ef
"
$
e
"
]]
;
then
if
[[
$1
-ef
"
$
{
e
}
"
]]
;
then
return
return
fi
fi
done
done
...
@@ -106,7 +106,7 @@ function is-explicitly-chosen {
...
@@ -106,7 +106,7 @@ function is-explicitly-chosen {
local
name
=
"
${
1
#verify-
}
"
local
name
=
"
${
1
#verify-
}
"
name
=
"
${
name
%.*
}
"
name
=
"
${
name
%.*
}
"
for
e
in
${
WHAT
}
;
do
for
e
in
${
WHAT
}
;
do
if
[[
$e
==
"
$name
"
]]
;
then
if
[[
"
${
e
}
"
==
"
${
name
}
"
]]
;
then
return
return
fi
fi
done
done
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment