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
3a724b26
Commit
3a724b26
authored
Apr 01, 2015
by
Quinton Hoole
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6196 from zmerlynn/parallel_arch
Parallelize architectures in both the building and packaging phases of `make release`
parents
ce728391
0bbf4e99
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
57 deletions
+76
-57
common.sh
build/common.sh
+22
-17
golang.sh
hack/lib/golang.sh
+54
-40
No files found.
build/common.sh
View file @
3a724b26
...
@@ -511,30 +511,35 @@ function kube::release::package_client_tarballs() {
...
@@ -511,30 +511,35 @@ 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
"
Build
ing tarball: client
$platform_tag
"
kube::log::status
"
Start
ing tarball: client
$platform_tag
"
local
release_stage
=
"
${
RELEASE_STAGE
}
/client/
${
platform_tag
}
/kubernetes"
(
rm
-rf
"
${
release_stage
}
"
local
release_stage
=
"
${
RELEASE_STAGE
}
/client/
${
platform_tag
}
/kubernetes"
mkdir
-p
"
${
release_stage
}
/client/bin"
rm
-rf
"
${
release_stage
}
"
mkdir
-p
"
${
release_stage
}
/client/bin"
local
client_bins
=(
"
${
KUBE_CLIENT_BINARIES
[@]
}
"
)
local
client_bins
=(
"
${
KUBE_CLIENT_BINARIES
[@]
}
"
)
if
[[
"
${
platform
%/*
}
"
==
"windows"
]]
;
then
if
[[
"
${
platform
%/*
}
"
==
"windows"
]]
;
then
client_bins
=(
"
${
KUBE_CLIENT_BINARIES_WIN
[@]
}
"
)
client_bins
=(
"
${
KUBE_CLIENT_BINARIES_WIN
[@]
}
"
)
fi
fi
# This fancy expression will expand to prepend a path
# This fancy expression will expand to prepend a path
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the
# KUBE_CLIENT_BINARIES array.
# KUBE_CLIENT_BINARIES array.
cp
"
${
client_bins
[@]/#/
${
LOCAL_OUTPUT_BINPATH
}
/
${
platform
}
/
}
"
\
cp
"
${
client_bins
[@]/#/
${
LOCAL_OUTPUT_BINPATH
}
/
${
platform
}
/
}
"
\
"
${
release_stage
}
/client/bin/"
"
${
release_stage
}
/client/bin/"
kube::release::clean_cruft
kube::release::clean_cruft
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
...
...
hack/lib/golang.sh
View file @
3a724b26
...
@@ -313,62 +313,76 @@ kube::golang::build_binaries() {
...
@@ -313,62 +313,76 @@ 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
nonstatics
=()
for
binary
in
"
${
binaries
[@]
}
"
;
do
if
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
kube::golang::exit_if_stdlib_not_installed
;
statics+
=(
$binary
)
else
nonstatics+
=(
$binary
)
fi
done
if
[[
-n
${
use_go_build
:-}
]]
;
then
# Try and replicate the native binary placement of go install without
# calling go install. This means we have to iterate each binary.
local
output_path
=
"
${
KUBE_GOPATH
}
/bin"
if
[[
$platform
!=
$host_platform
]]
;
then
output_path
=
"
${
output_path
}
/
${
platform
//\//_
}
"
fi
local
-a
statics
=()
local
-a
nonstatics
=()
for
binary
in
"
${
binaries
[@]
}
"
;
do
for
binary
in
"
${
binaries
[@]
}
"
;
do
local
bin
=
$(
basename
"
${
binary
}
"
)
if
[[
${
GOOS
}
==
"windows"
]]
;
then
bin
=
"
${
bin
}
.exe"
fi
if
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
if
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
kube::golang::exit_if_stdlib_not_installed
;
kube::golang::exit_if_stdlib_not_installed
;
CGO_ENABLED
=
0 go build
-installsuffix
cgo
-o
"
${
output_path
}
/
${
bin
}
"
\
statics+
=(
$binary
)
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
binary
}
"
else
else
go build
-o
"
${
output_path
}
/
${
bin
}
"
\
nonstatics+
=(
$binary
)
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
binary
}
"
fi
fi
done
done
else
if
[[
-n
${
use_go_build
:-}
]]
;
then
# Try and replicate the native binary placement of go install without
# calling go install. This means we have to iterate each binary.
local
output_path
=
"
${
KUBE_GOPATH
}
/bin"
if
[[
$platform
!=
$host_platform
]]
;
then
output_path
=
"
${
output_path
}
/
${
platform
//\//_
}
"
fi
for
binary
in
"
${
binaries
[@]
}
"
;
do
local
bin
=
$(
basename
"
${
binary
}
"
)
if
[[
${
GOOS
}
==
"windows"
]]
;
then
bin
=
"
${
bin
}
.exe"
fi
if
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
kube::golang::exit_if_stdlib_not_installed
;
CGO_ENABLED
=
0 go build
-installsuffix
cgo
-o
"
${
output_path
}
/
${
bin
}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
binary
}
"
else
go build
-o
"
${
output_path
}
/
${
bin
}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
binary
}
"
fi
done
else
# Use go install.
# Use go install.
if
[[
"
${#
nonstatics
[@]
}
"
!=
0
]]
;
then
if
[[
"
${#
nonstatics
[@]
}
"
!=
0
]]
;
then
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
nonstatics
[@]
:+
${
nonstatics
[@]
}}
"
"
${
nonstatics
[@]
:+
${
nonstatics
[@]
}}
"
fi
fi
if
[[
"
${#
statics
[@]
}
"
!=
0
]]
;
then
if
[[
"
${#
statics
[@]
}
"
!=
0
]]
;
then
CGO_ENABLED
=
0 go
install
-installsuffix
cgo
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
CGO_ENABLED
=
0 go
install
-installsuffix
cgo
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
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
}
)
)
}
}
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