Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kubectl to build/release scripts. #1818

Merged
merged 1 commit into from
Oct 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ There is also early support for building Docker "run" containers

## Key scripts

* `make-binaries.sh`: This will compile all of the Kubernetes binaries
* `make-server.sh`: This will compile all of the Kubernetes server binaries for linux/amd64
* `make-client.sh`: This will make all cross-compiled client binaries
* `run-tests.sh`: This will run the Kubernetes unit tests
* `run-integration.sh`: This will build and run the integration test
* `make-cross.sh`: This will make all cross-compiled binaries (currently just `kubecfg`)
* `copy-output.sh`: This will copy the contents of `_output/build` from any remote Docker container to the local `_output/build`. Right now this is only necessary on Mac OS X with `boot2docker`.
* `make-clean.sh`: Clean out the contents of `_output/build` and remove any local built container images.
* `shell.sh`: Drop into a `bash` shell in a build container with a snapshot of the current repo code.
Expand Down
29 changes: 17 additions & 12 deletions build/build-image/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ cd "${KUBE_ROOT}"
readonly KUBE_TARGET="${KUBE_ROOT}/_output/build"
readonly KUBE_GO_PACKAGE=github.com/GoogleCloudPlatform/kubernetes

server_targets=(
cmd/proxy
cmd/apiserver
cmd/controller-manager
cmd/kubelet
plugin/cmd/scheduler
)

client_targets=(
cmd/kubecfg
cmd/kubectl
)

mkdir -p "${KUBE_TARGET}"

if [[ ! -f "/kube-build-image" ]]; then
Expand All @@ -46,19 +59,11 @@ function kube::build::make_binary() {
}

function kube::build::make_binaries() {
local -a targets=(
cmd/proxy
cmd/apiserver
cmd/controller-manager
cmd/kubelet
cmd/kubecfg
plugin/cmd/scheduler
)

if [[ -n "${1-}" ]]; then
targets=("$1")
fi
[[ $# -gt 0 ]] || {
echo "!!! Internal error. kube::build::make_binaries called with no targets."
}

local -a targets=("$@")
local -a binaries=()
local target
for target in "${targets[@]}"; do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/build/build-image/common.sh"

readonly CROSS_BINARIES=(
./cmd/kubecfg
)
platforms=(linux/amd64 $KUBE_CROSSPLATFORMS)
targets=("${client_targets[@]}")

if [[ $# -gt 0 ]]; then
targets=("$@")
fi

for platform in ${KUBE_CROSSPLATFORMS}; do
for platform in "${platforms[@]}"; do
(
# Subshell to contain these exports
export GOOS=${platform%/*}
export GOARCH=${platform##*/}
for binary in "${CROSS_BINARIES[@]}"; do
kube::build::make_binaries "${binary}"
done

kube::build::make_binaries "${targets[@]}"
)
done
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/build/build-image/common.sh"

kube::build::make_binaries "$@"
targets=("${server_targets[@]}")
if [[ $# -gt 0 ]]; then
targets=("$@")
fi

kube::build::make_binaries "${targets[@]}"
1 change: 1 addition & 0 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ readonly DOCKER_MOUNT_ARGS=(--volume "${LOCAL_OUTPUT_BUILD}:${REMOTE_OUTPUT_DIR}

readonly KUBE_CLIENT_BINARIES=(
kubecfg
kubectl
)

readonly KUBE_SERVER_BINARIES=(
Expand Down
4 changes: 2 additions & 2 deletions build/make-cross.sh → build/make-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Make all of the Kubernetes binaries for cross compile targets
# Make all of the client Kubernetes binaries for cross compile targets
#
# This makes the docker build image, builds the cross binaries and copies them
# out of the docker container.
Expand All @@ -28,5 +28,5 @@ source "$KUBE_ROOT/build/common.sh"

kube::build::verify_prereqs
kube::build::build_image
kube::build::run_build_command build/build-image/make-cross.sh
kube::build::run_build_command build/build-image/make-client.sh "$@"
kube::build::copy_output
4 changes: 2 additions & 2 deletions build/make-binaries.sh → build/make-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Make all of the Kubernetes binaries.
# Make all of the Kubernetes server binaries.
#
# This makes the docker build image, builds the binaries and copies them out
# of the docker container.
Expand All @@ -27,5 +27,5 @@ source "$KUBE_ROOT/build/common.sh"

kube::build::verify_prereqs
kube::build::build_image
kube::build::run_build_command build/build-image/make-binaries.sh "$@"
kube::build::run_build_command build/build-image/make-server.sh "$@"
kube::build::copy_output
4 changes: 2 additions & 2 deletions build/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ KUBE_RELEASE_RUN_TESTS=${KUBE_RELEASE_RUN_TESTS-y}

kube::build::verify_prereqs
kube::build::build_image
kube::build::run_build_command build/build-image/make-binaries.sh
kube::build::run_build_command build/build-image/make-cross.sh
kube::build::run_build_command build/build-image/make-client.sh
kube::build::run_build_command build/build-image/make-server.sh

if [[ $KUBE_RELEASE_RUN_TESTS =~ ^[yY]$ ]]; then
kube::build::run_build_command build/build-image/run-tests.sh
Expand Down
2 changes: 1 addition & 1 deletion cluster/kubecfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ if [[ ! -x "$kubecfg" ]]; then
echo "It looks as if you don't have a compiled kubecfg binary."
echo
echo "If you are running from a clone of the git repo, please run"
echo "'./build/make-cross.sh'. Note that this requires having Docker installed."
echo "'./build/make-client.sh'. Note that this requires having Docker installed."
echo
echo "If you are running from a binary release tarball, something is wrong. "
echo "Look at http://kubernetes.io/ for information on how to contact the "
Expand Down