forked from kubernetes-retired/kube-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·31 lines (25 loc) · 852 Bytes
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
set -euo pipefail
COMMIT=$(git rev-parse HEAD)
TAG=$(git describe --exact-match --abbrev=0 --tags "${COMMIT}" 2> /dev/null || true)
OUTPUT_PATH=${OUTPUT_PATH:-"bin/kube-aws"}
if [ -z "$TAG" ]; then
VERSION=$COMMIT
else
VERSION=$TAG
fi
# check for changed files (not untracked files)
if [ -n "$(git diff --shortstat 2> /dev/null | tail -n1)" ]; then
VERSION="${VERSION}+dirty"
fi
echo Building kube-aws ${VERSION}
go generate ./core/controlplane/config
go generate ./core/nodepool/config
go generate ./core/root/config
if [[ ! "${BUILD_GOOS:-}" == "" ]];then
export GOOS=$BUILD_GOOS
fi
if [[ ! "${BUILD_GOARCH:-}" == "" ]];then
export GOARCH=$BUILD_GOARCH
fi
go build -ldflags "-X github.com/kubernetes-incubator/kube-aws/core/controlplane/cluster.VERSION=${VERSION}" -a -tags netgo -installsuffix netgo -o "$OUTPUT_PATH" ./