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
7e486bd7
Commit
7e486bd7
authored
May 14, 2016
by
Madhusudan.C.S
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build and use the teststale binary on only the host platform.
parent
317a7d2e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
+34
-3
golang.sh
hack/lib/golang.sh
+34
-3
No files found.
hack/lib/golang.sh
View file @
7e486bd7
...
@@ -114,7 +114,6 @@ kube::golang::test_targets() {
...
@@ -114,7 +114,6 @@ kube::golang::test_targets() {
cmd/linkcheck
cmd/linkcheck
examples/k8petstore/web-server/src
examples/k8petstore/web-server/src
vendor/github.com/onsi/ginkgo/ginkgo
vendor/github.com/onsi/ginkgo/ginkgo
hack/cmd/teststale
test
/e2e/e2e.test
test
/e2e/e2e.test
test
/e2e_node/e2e_node.test
test
/e2e_node/e2e_node.test
)
)
...
@@ -375,6 +374,25 @@ kube::golang::fallback_if_stdlib_not_installable() {
...
@@ -375,6 +374,25 @@ kube::golang::fallback_if_stdlib_not_installable() {
use_go_build
=
true
use_go_build
=
true
}
}
# Builds the toolchain necessary for building kube. This needs to be
# built only on the host platform.
# TODO: This builds only the `teststale` binary right now. As we expand
# this function's capabilities we need to find this a right home.
# Ideally, not a shell script because testing shell scripts is painful.
kube::golang::build_kube_toolchain
()
{
local
targets
=(
hack/cmd/teststale
)
local
binaries
binaries
=(
$(
kube::golang::binaries_from_targets
"
${
targets
[@]
}
"
)
)
kube::log::status
"Building the toolchain targets:"
"
${
binaries
[@]
}
"
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
goldflags
}
"
\
"
${
binaries
[@]
:+
${
binaries
[@]
}}
"
}
# Try and replicate the native binary placement of go install without
# Try and replicate the native binary placement of go install without
# calling go install.
# calling go install.
kube::golang::output_filename_for_binary
()
{
kube::golang::output_filename_for_binary
()
{
...
@@ -444,15 +462,25 @@ kube::golang::build_binaries_for_platform() {
...
@@ -444,15 +462,25 @@ kube::golang::build_binaries_for_platform() {
fi
fi
fi
fi
teststale
=
$(
kube::golang::output_filename_for_binary
"hack/cmd/teststale"
"
${
platform
}
"
)
for
test
in
"
${
tests
[@]
:+
${
tests
[@]
}}
"
;
do
for
test
in
"
${
tests
[@]
:+
${
tests
[@]
}}
"
;
do
local
outfile
=
$(
kube::golang::output_filename_for_binary
"
${
test
}
"
\
local
outfile
=
$(
kube::golang::output_filename_for_binary
"
${
test
}
"
\
"
${
platform
}
"
)
"
${
platform
}
"
)
local
testpkg
=
"
$(
dirname
${
test
})
"
local
testpkg
=
"
$(
dirname
${
test
})
"
if
!
${
teststale
}
-binary
"
${
outfile
}
"
-package
"
${
testpkg
}
"
;
then
# Staleness check always happens on the host machine, so we don't
# have to locate the `teststale` binaries for the other platforms.
# Since we place the host binaries in `$KUBE_GOPATH/bin`, we can
# assume that the binary exists there, if it exists at all.
# Otherwise, something has gone wrong with building the `teststale`
# binary and we should safely proceed building the test binaries
# assuming that they are stale. There is no good reason to error
# out.
if
test
-x
"
${
KUBE_GOPATH
}
/bin/teststale"
&&
!
"
${
KUBE_GOPATH
}
/bin/teststale"
-binary
"
${
outfile
}
"
-package
"
${
testpkg
}
"
then
continue
continue
fi
fi
# `go test -c` below directly builds the binary. It builds the packages,
# `go test -c` below directly builds the binary. It builds the packages,
# but it never installs them. `go test -i` only installs the dependencies
# but it never installs them. `go test -i` only installs the dependencies
# of the test, but not the test package itself. So neither `go test -c`
# of the test, but not the test package itself. So neither `go test -c`
...
@@ -564,6 +592,9 @@ kube::golang::build_binaries() {
...
@@ -564,6 +592,9 @@ kube::golang::build_binaries() {
fi
fi
fi
fi
# First build the toolchain before building any other targets
kube::golang::build_kube_toolchain
if
[[
"
${
parallel
}
"
==
"true"
]]
;
then
if
[[
"
${
parallel
}
"
==
"true"
]]
;
then
kube::log::status
"Building go targets for
${
platforms
[@]
}
in parallel (output will appear in a burst when complete):"
"
${
targets
[@]
}
"
kube::log::status
"Building go targets for
${
platforms
[@]
}
in parallel (output will appear in a burst when complete):"
"
${
targets
[@]
}
"
local
platform
local
platform
...
...
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