github.com/kubernetes-incubator/kube-aws@v0.16.4/build (about) 1 #!/bin/bash 2 set -euo pipefail 3 4 COMMIT=$(git rev-parse HEAD) 5 TAG=$(git describe --exact-match --abbrev=0 --tags "${COMMIT}" 2> /dev/null || true) 6 BRANCH=$(git branch | grep \* | cut -d ' ' -f2 | sed -e 's/[^a-zA-Z0-9+=._:/-]*//g' || true) 7 OUTPUT_PATH=${OUTPUT_PATH:-"bin/kube-aws"} 8 VERSION="" 9 ETCD_VERSION="v3.4.9" 10 KUBERNETES_VERSION="v1.16.10" 11 12 if [ -z "$TAG" ]; then 13 [[ -n "$BRANCH" ]] && VERSION="${BRANCH}/" 14 VERSION="${VERSION}${COMMIT:0:8}" 15 else 16 VERSION=$TAG 17 fi 18 19 # check for changed files (not untracked files) 20 if [ -n "$(git diff --shortstat 2> /dev/null | tail -n1)" ]; then 21 VERSION="${VERSION}+dirty" 22 fi 23 24 echo "Building kube-aws ${VERSION} (default Kubernetes version ${KUBERNETES_VERSION})" 25 26 printf 'Checking existence of the `packr` command that is used for embedding files into the resulting binary...' 27 if ! which packr 1>/dev/null; then 28 echo not found. installing... 29 go get -u github.com/gobuffalo/packr/packr 30 echo 'Installed `packr`.' 31 else 32 echo "found. Skipped installation." 33 fi 34 35 packr -vz 36 37 if [[ ! "${BUILD_GOOS:-}" == "" ]];then 38 export GOOS=$BUILD_GOOS 39 fi 40 if [[ ! "${BUILD_GOARCH:-}" == "" ]];then 41 export GOARCH=$BUILD_GOARCH 42 fi 43 go build -ldflags "-X github.com/kubernetes-incubator/kube-aws/pkg/model.VERSION=${VERSION} -X github.com/kubernetes-incubator/kube-aws/pkg/api.KUBERNETES_VERSION=${KUBERNETES_VERSION} -X github.com/kubernetes-incubator/kube-aws/pkg/api.ETCD_VERSION=${ETCD_VERSION}" -a -tags netgo -installsuffix netgo -o "$OUTPUT_PATH" ./