Parallelize architectures in "make release"

On my desktop, this took the KUBE_RELEASE_RUN_TESTS=n
"make release" down from 172s to 115s
This commit is contained in:
Zach Loafman 2015-04-01 17:29:22 -07:00
parent 412a836bf7
commit 44b4c9ff26
2 changed files with 38 additions and 19 deletions

View File

@ -511,10 +511,11 @@ function kube::release::package_client_tarballs() {
# Find all of the built client binaries # Find all of the built client binaries
local platform platforms local platform platforms
platforms=($(cd "${LOCAL_OUTPUT_BINPATH}" ; echo */*)) platforms=($(cd "${LOCAL_OUTPUT_BINPATH}" ; echo */*))
for platform in "${platforms[@]}" ; do for platform in "${platforms[@]}"; do
local platform_tag=${platform/\//-} # Replace a "/" for a "-" local platform_tag=${platform/\//-} # Replace a "/" for a "-"
kube::log::status "Building tarball: client $platform_tag" kube::log::status "Starting tarball: client $platform_tag"
(
local release_stage="${RELEASE_STAGE}/client/${platform_tag}/kubernetes" local release_stage="${RELEASE_STAGE}/client/${platform_tag}/kubernetes"
rm -rf "${release_stage}" rm -rf "${release_stage}"
mkdir -p "${release_stage}/client/bin" mkdir -p "${release_stage}/client/bin"
@ -534,7 +535,11 @@ function kube::release::package_client_tarballs() {
local package_name="${RELEASE_DIR}/kubernetes-client-${platform_tag}.tar.gz" local package_name="${RELEASE_DIR}/kubernetes-client-${platform_tag}.tar.gz"
kube::release::create_tarball "${package_name}" "${release_stage}/.." kube::release::create_tarball "${package_name}" "${release_stage}/.."
) &
done done
kube::log::status "Waiting on tarballs"
wait || { kube::log::error "client tarball creation failed"; exit 1; }
} }
# Package up all of the server binaries # Package up all of the server binaries

View File

@ -313,10 +313,11 @@ kube::golang::build_binaries() {
local binaries local binaries
binaries=($(kube::golang::binaries_from_targets "${targets[@]}")) binaries=($(kube::golang::binaries_from_targets "${targets[@]}"))
kube::log::status "Building go targets for ${platforms[@]} in parallel (output will appear in a burst when complete):" "${targets[@]}"
local platform local platform
for platform in "${platforms[@]}"; do for platform in "${platforms[@]}"; do (
kube::golang::set_platform_envs "${platform}" kube::golang::set_platform_envs "${platform}"
kube::log::status "Building go targets for ${platform}:" "${targets[@]}" kube::log::status "${platform}: Parallel go build started"
local -a statics=() local -a statics=()
local -a nonstatics=() local -a nonstatics=()
@ -369,6 +370,19 @@ kube::golang::build_binaries() {
"${statics[@]:+${statics[@]}}" "${statics[@]:+${statics[@]}}"
fi fi
fi fi
kube::log::status "${platform}: Parallel go build finished"
) &> "/tmp//${platform//\//_}.build" &
done done
local fails=0
for job in $(jobs -p); do
wait ${job} || let "fails+=1"
done
for platform in "${platforms[@]}"; do
cat "/tmp//${platform//\//_}.build"
done
exit ${fails}
) )
} }