mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 03:38:15 +00:00
Improve the speed of do-nothing build.
As thockin found out here https://github.com/kubernetes/kubernetes/issues/24518, vast majority of the do-nothing build time is spent in rebuilding the test binaries. There is no staleness check support for test binaries. This commit implements the staleness checks for test binaries and uses them while building packages. Tests are TBD. I am still trying to figure out how to test this.
This commit is contained in:
@@ -114,6 +114,7 @@ kube::golang::test_targets() {
|
||||
cmd/linkcheck
|
||||
examples/k8petstore/web-server/src
|
||||
vendor/github.com/onsi/ginkgo/ginkgo
|
||||
hack/cmd/teststale
|
||||
test/e2e/e2e.test
|
||||
test/e2e_node/e2e_node.test
|
||||
)
|
||||
@@ -443,15 +444,25 @@ kube::golang::build_binaries_for_platform() {
|
||||
fi
|
||||
fi
|
||||
|
||||
teststale=$(kube::golang::output_filename_for_binary "hack/cmd/teststale" "${platform}")
|
||||
for test in "${tests[@]:+${tests[@]}}"; do
|
||||
local outfile=$(kube::golang::output_filename_for_binary "${test}" \
|
||||
"${platform}")
|
||||
|
||||
local testpkg="$(dirname ${test})"
|
||||
if [[ "$(${teststale} -binary "${outfile}" -package "${testpkg}")" == "false" ]]; then
|
||||
continue
|
||||
fi
|
||||
go install "${goflags[@]:+${goflags[@]}}" \
|
||||
-ldflags "${goldflags}" \
|
||||
"${testpkg}"
|
||||
|
||||
mkdir -p "$(dirname ${outfile})"
|
||||
go test -c \
|
||||
"${goflags[@]:+${goflags[@]}}" \
|
||||
-ldflags "${goldflags}" \
|
||||
-o "${outfile}" \
|
||||
"$(dirname ${test})"
|
||||
"${testpkg}"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user