Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
de5f77d8
Commit
de5f77d8
authored
Feb 29, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(build): add build script
parent
b916b2b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
0 deletions
+71
-0
build-go.sh
scripts/build-go.sh
+22
-0
common.sh
scripts/common.sh
+49
-0
No files found.
scripts/build-go.sh
0 → 100755
View file @
de5f77d8
#!/usr/bin/env bash
set
-o
errexit
set
-o
pipefail
[[
"
$TRACE
"
]]
&&
set
-x
readonly
REPO
=
github.com/kubernetes/deployment-manager
readonly
DIR
=
"
${
GOPATH
}
/src/
${
REPO
}
"
source
"
${
DIR
}
/scripts/common.sh"
if
[[
-z
"
${
VERSION
:-}
"
]]
;
then
VERSION
=
$(
version_from_git
)
fi
LDFLAGS
=
"-s -X
${
REPO
}
/pkg/version.DeploymentManagerVersion=
${
VERSION
}
"
echo
"Build version:
${
VERSION
}
"
build_binaries
"
$@
"
exit
0
scripts/common.sh
0 → 100644
View file @
de5f77d8
#!/usr/bin/env bash
set
-o
errexit
set
-o
pipefail
readonly
ALL_TARGETS
=(
cmd/dm cmd/expandybird cmd/manager cmd/resourcifier
)
error_exit
()
{
# Display error message and exit
echo
"error:
${
1
:-
"unknown error"
}
"
1>&2
exit
1
}
version_from_git
()
{
local
git_tag
=
$(
git describe
--tags
--abbrev
=
0 2>/dev/null
)
local
git_commit
=
$(
git rev-parse
--short
HEAD
)
echo
"
${
git_tag
}
+
${
git_commit
}
"
}
build_binary_cross
()
{
local
target
=
"
$1
"
echo
"Building
${
target
}
"
gox
-verbose
\
-ldflags
=
"
${
LDFLAGS
}
"
\
-os
=
"linux darwin"
\
-arch
=
"amd64 386"
\
-output
=
"bin/{{.OS}}-{{.Arch}}/{{.Dir}}"
"
${
REPO
}
/
${
target
}
"
}
build_binaries
()
{
local
-a
targets
=(
$@
)
if
[[
${#
targets
[@]
}
-eq
0
]]
;
then
targets
=(
"
${
ALL_TARGETS
[@]
}
"
)
fi
for
t
in
"
${
targets
[@]
}
"
;
do
build_binary
"
$t
"
done
}
build_binary
()
{
local
target
=
"
$1
"
local
binary
=
"
${
target
##*/
}
"
local
outfile
=
"bin/
${
binary
}
"
echo
"Building
${
target
}
"
go build
-o
"
$outfile
"
-ldflags
"
$LDFLAGS
"
"
${
REPO
}
/
${
target
}
"
}
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