From f0c389628173da01dfbf66d49cdd9a6fac4d893b Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Thu, 28 Aug 2014 22:55:17 -0700 Subject: [PATCH] Build tweaks Wrap long lines. Add GOFLAGS support to build and test. Comments. --- hack/build-go.sh | 19 +++++++++++++------ hack/test-go.sh | 16 +++++++++++----- release/build-release.sh | 1 + 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/hack/build-go.sh b/hack/build-go.sh index 24707a7b4c5d8..dd363f81ce7ec 100755 --- a/hack/build-go.sh +++ b/hack/build-go.sh @@ -36,7 +36,12 @@ version_ldflags=$(kube::version_ldflags) if [[ $# == 0 ]]; then # Update $@ with the default list of targets to build. - set -- cmd/proxy cmd/apiserver cmd/controller-manager cmd/kubelet cmd/kubecfg plugin/cmd/scheduler + set -- \ + cmd/proxy \ + cmd/apiserver \ + cmd/controller-manager \ + cmd/kubelet cmd/kubecfg \ + plugin/cmd/scheduler fi binaries=() @@ -44,8 +49,10 @@ for arg; do binaries+=("${KUBE_GO_PACKAGE}/${arg}") done -# Note that the flags to 'go build' are duplicated in the salt build setup for -# our cluster deploy. If we add more command line options to our standard build -# we'll want to duplicate them there. As we move to distributing pre- built -# binaries we can eliminate this duplication. -go install -ldflags "${version_ldflags}" "${binaries[@]}" +# Note that the flags to 'go build' are duplicated in the salt build setup +# (release/build-release.sh) for our cluster deploy. If we add more command +# line options to our standard build we'll want to duplicate them there. As we +# move to distributing pre- built binaries we can eliminate this duplication. +go install ${GOFLAGS:-} \ + -ldflags "${version_ldflags}" \ + "${binaries[@]}" diff --git a/hack/test-go.sh b/hack/test-go.sh index 378e96708ab13..baa823be5498f 100755 --- a/hack/test-go.sh +++ b/hack/test-go.sh @@ -30,13 +30,11 @@ find_test_dirs() { cd src/${KUBE_GO_PACKAGE} find . -not \( \ \( \ - -wholename './third_party' \ - -wholename './Godeps' \ + -wholename './output' \ -o -wholename './release' \ -o -wholename './target' \ -o -wholename '*/third_party/*' \ -o -wholename '*/Godeps/*' \ - -o -wholename '*/output/*' \ \) -prune \ \) -name '*_test.go' -print0 | xargs -0n1 dirname | sort -u | xargs -n1 printf "${KUBE_GO_PACKAGE}/%s\n" } @@ -93,8 +91,16 @@ if [[ -n "${iterations}" ]]; then fi if [[ -n "$1" ]]; then - go test -race ${KUBE_TIMEOUT} ${KUBE_COVER} -coverprofile=tmp.out "${KUBE_GO_PACKAGE}/$1" "${@:2}" + go test ${GOFLAGS} \ + -race \ + ${KUBE_TIMEOUT} \ + ${KUBE_COVER} -coverprofile=tmp.out \ + "${KUBE_GO_PACKAGE}/$1" "${@:2}" exit 0 fi -find_test_dirs | xargs go test -race -timeout 30s ${KUBE_COVER} "${@:2}" +find_test_dirs | xargs go test ${GOFLAGS:-} \ + -race \ + -timeout 30s \ + ${KUBE_COVER} \ + "${@:2}" diff --git a/release/build-release.sh b/release/build-release.sh index 57a562f1d9ea5..b161b324747c3 100755 --- a/release/build-release.sh +++ b/release/build-release.sh @@ -45,6 +45,7 @@ cp -r $KUBE_DIR/cluster/saltbase $MASTER_RELEASE_DIR/src/saltbase # on. version_ldflags=$(kube::version_ldflags) +# Note: go_opt must stay in sync with the flags in hack/build-go.sh. cat << EOF > $MASTER_RELEASE_DIR/src/saltbase/pillar/common.sls instance_prefix: $INSTANCE_PREFIX-minion go_opt: -ldflags '${version_ldflags}'