-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from flant/new_build_script
CI: new scripts/build-release-binaries.sh scripts
- Loading branch information
Showing
4 changed files
with
65 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
release/build | ||
release-build |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
for f in $(find scripts/lib -type f -name "*.sh"); do | ||
source $f | ||
done | ||
|
||
VERSION=$1 | ||
if [ -z "$VERSION" ] ; then | ||
echo "Required version argument!" 1>&2 | ||
echo 1>&2 | ||
echo "Usage: $0 VERSION" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
build_binaries $VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
export RELEASE_BUILD_DIR=release-build | ||
|
||
go_get() { | ||
for os in linux darwin windows ; do | ||
for arch in amd64 ; do | ||
export GOOS=$os | ||
export GOARCH=$arch | ||
source $GOPATH/src/github.com/flant/kubedog/go-get.sh | ||
done | ||
done | ||
} | ||
|
||
go_build() { | ||
VERSION=$1 | ||
|
||
rm -rf $RELEASE_BUILD_DIR/$VERSION | ||
mkdir -p $RELEASE_BUILD_DIR/$VERSION | ||
chmod -R 0777 $RELEASE_BUILD_DIR/$VERSION | ||
|
||
for os in linux darwin windows ; do | ||
for arch in amd64 ; do | ||
outputFile=$RELEASE_BUILD_DIR/$VERSION/kubedog-$os-$arch-$VERSION | ||
if [ "$os" == "windows" ] ; then | ||
outputFile=$outputFile.exe | ||
fi | ||
|
||
echo "# Building kubedog $VERSION for $os $arch ..." | ||
|
||
GOOS=$os GOARCH=$arch \ | ||
go build -ldflags="-s -w -X github.com/flant/kubedog/pkg/kubedog.Version=$VERSION" \ | ||
-o $outputFile github.com/flant/kubedog/cmd/kubedog | ||
|
||
echo "# Built $outputFile" | ||
done | ||
done | ||
|
||
cd $RELEASE_BUILD_DIR/$VERSION/ | ||
sha256sum kubedog-* > SHA256SUMS | ||
cd - | ||
} | ||
|
||
build_binaries() { | ||
VERSION=$1 | ||
|
||
( go_get ) || ( exit 1 ) | ||
( go_build $VERSION ) || ( exit 1 ) | ||
} |