mirror of https://github.com/k3s-io/k3s
Build tweaks
Wrap long lines. Add GOFLAGS support to build and test. Comments.pull/6/head
parent
c380dd0426
commit
f0c3896281
|
@ -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[@]}"
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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}'
|
||||
|
|
Loading…
Reference in New Issue