mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Build tweaks
Wrap long lines. Add GOFLAGS support to build and test. Comments.
This commit is contained in:
parent
c380dd0426
commit
f0c3896281
@ -36,7 +36,12 @@ version_ldflags=$(kube::version_ldflags)
|
|||||||
|
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
# Update $@ with the default list of targets to build.
|
# 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
|
fi
|
||||||
|
|
||||||
binaries=()
|
binaries=()
|
||||||
@ -44,8 +49,10 @@ for arg; do
|
|||||||
binaries+=("${KUBE_GO_PACKAGE}/${arg}")
|
binaries+=("${KUBE_GO_PACKAGE}/${arg}")
|
||||||
done
|
done
|
||||||
|
|
||||||
# Note that the flags to 'go build' are duplicated in the salt build setup for
|
# Note that the flags to 'go build' are duplicated in the salt build setup
|
||||||
# our cluster deploy. If we add more command line options to our standard build
|
# (release/build-release.sh) for our cluster deploy. If we add more command
|
||||||
# we'll want to duplicate them there. As we move to distributing pre- built
|
# line options to our standard build we'll want to duplicate them there. As we
|
||||||
# binaries we can eliminate this duplication.
|
# move to distributing pre- built binaries we can eliminate this duplication.
|
||||||
go install -ldflags "${version_ldflags}" "${binaries[@]}"
|
go install ${GOFLAGS:-} \
|
||||||
|
-ldflags "${version_ldflags}" \
|
||||||
|
"${binaries[@]}"
|
||||||
|
@ -30,13 +30,11 @@ find_test_dirs() {
|
|||||||
cd src/${KUBE_GO_PACKAGE}
|
cd src/${KUBE_GO_PACKAGE}
|
||||||
find . -not \( \
|
find . -not \( \
|
||||||
\( \
|
\( \
|
||||||
-wholename './third_party' \
|
-wholename './output' \
|
||||||
-wholename './Godeps' \
|
|
||||||
-o -wholename './release' \
|
-o -wholename './release' \
|
||||||
-o -wholename './target' \
|
-o -wholename './target' \
|
||||||
-o -wholename '*/third_party/*' \
|
-o -wholename '*/third_party/*' \
|
||||||
-o -wholename '*/Godeps/*' \
|
-o -wholename '*/Godeps/*' \
|
||||||
-o -wholename '*/output/*' \
|
|
||||||
\) -prune \
|
\) -prune \
|
||||||
\) -name '*_test.go' -print0 | xargs -0n1 dirname | sort -u | xargs -n1 printf "${KUBE_GO_PACKAGE}/%s\n"
|
\) -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
|
fi
|
||||||
|
|
||||||
if [[ -n "$1" ]]; then
|
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
|
exit 0
|
||||||
fi
|
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.
|
# on.
|
||||||
version_ldflags=$(kube::version_ldflags)
|
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
|
cat << EOF > $MASTER_RELEASE_DIR/src/saltbase/pillar/common.sls
|
||||||
instance_prefix: $INSTANCE_PREFIX-minion
|
instance_prefix: $INSTANCE_PREFIX-minion
|
||||||
go_opt: -ldflags '${version_ldflags}'
|
go_opt: -ldflags '${version_ldflags}'
|
||||||
|
Loading…
Reference in New Issue
Block a user