Skip to content

Commit

Permalink
Build tweaks
Browse files Browse the repository at this point in the history
Wrap long lines.
Add GOFLAGS support to build and test.
Comments.
  • Loading branch information
thockin committed Aug 29, 2014
1 parent c380dd0 commit f0c3896
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
19 changes: 13 additions & 6 deletions hack/build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,23 @@ 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=()
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[@]}"
16 changes: 11 additions & 5 deletions hack/test-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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}"
1 change: 1 addition & 0 deletions release/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand Down

0 comments on commit f0c3896

Please sign in to comment.