Rework hack/ and build/ directories.
* Rewrite a bunch of the hack/ directory with modular reusable bash libraries. * Have 'build/*' build on 'hack/*'. The stuff in build now just runs hack/* in a docker container. * Use a docker data container to enable faster incremental builds. * Standardize output to _output/{local,dockerized}/bin/OS/ARCH/*. This regularized placement makes cross compilation work. * Move travis specific scripts under hack/travis With new dockerized incremental builds, I can do a no-op `make quick-release` in ~30s. This is a significant improvement.
This commit is contained in:
@@ -18,12 +18,13 @@ There is also early support for building Docker "run" containers
|
||||
|
||||
## Key scripts
|
||||
|
||||
* `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
|
||||
* `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.
|
||||
* `run.sh`: Run a command in a build docker container. Common invocations:
|
||||
* `run.sh hack/build-go.sh`: Build just linux binaries in the container. Pass options and packages as necessary.
|
||||
* `run.sh hack/build-cross.sh`: Build all binaries for all platforms
|
||||
* `run.sh hack/test-go.sh`: Run all unit tests
|
||||
* `run.sh hack/test-integration.sh`: Run integration test
|
||||
* `copy-output.sh`: This will copy the contents of `_output/dockerized/bin` from any remote Docker container to the local `_output/dockerized/bin`. Right now this is only necessary on Mac OS X with `boot2docker` when your git repo isn't under `/Users`.
|
||||
* `make-clean.sh`: Clean out the contents of `_output/dockerized` 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.
|
||||
* `release.sh`: Build everything, test it, and (optionally) upload the results to a GCS bucket.
|
||||
|
||||
@@ -81,10 +82,10 @@ If the release script is set to upload to GCS, it'll do the following:
|
||||
|
||||
These are in no particular order
|
||||
|
||||
* [ ] Harmonize with scripts in `hack/`. How much do we support building outside of Docker and these scripts?
|
||||
* [X] Harmonize with scripts in `hack/`. How much do we support building outside of Docker and these scripts?
|
||||
* [ ] Get a cluster up and running with the Docker images. Perhaps start with a local cluster and move up to a GCE cluster.
|
||||
* [ ] Implement (#186)[https://github.com/GoogleCloudPlatform/kubernetes/issues/186]. This will make it easier to develop Kubernetes.
|
||||
* [ ] Deprecate/replace most of the stuff in the hack/
|
||||
* [X] Deprecate/replace most of the stuff in the hack/
|
||||
* [ ] Create an install script that'll let us do a `curl https://[URL] | bash` to get that tarball down and ensure that other dependencies (cloud SDK?) are installed and configured correctly.
|
||||
* [ ] Support/test Windows as a client.
|
||||
* [ ] Finish support for the Dockerized runtime. Issue (#19)[https://github.com/GoogleCloudPlatform/kubernetes/issues/19]. A key issue here is to make this fast/light enough that we can use it for development workflows.
|
||||
|
@@ -25,6 +25,10 @@ ENV GOARCH amd64
|
||||
# Get the code coverage tool and godep
|
||||
RUN go get code.google.com/p/go.tools/cmd/cover github.com/tools/godep
|
||||
|
||||
# We use rsync to copy some binaries around. It is faster (0.3s vs. 1.1s) on my
|
||||
# machine vs. `install`
|
||||
RUN apt-get update && apt-get install -y rsync
|
||||
|
||||
# Download and symlink etcd. We need this for our integration tests.
|
||||
RUN mkdir -p /usr/local/src/etcd &&\
|
||||
cd /usr/local/src/etcd &&\
|
||||
@@ -39,6 +43,10 @@ WORKDIR /go/src/github.com/GoogleCloudPlatform/kubernetes
|
||||
|
||||
# Propagate the git tree version into the build image
|
||||
ADD kube-version-defs /kube-version-defs
|
||||
ENV KUBE_GIT_VERSION_FILE /kube-version-defs
|
||||
|
||||
# Make output from the dockerized build go someplace else
|
||||
ENV KUBE_OUTPUT_SUBPATH _output/dockerized
|
||||
|
||||
# Upload Kubernetes source
|
||||
ADD kube-source.tar.gz /go/src/github.com/GoogleCloudPlatform/kubernetes
|
||||
|
@@ -1,81 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script sets up a go workspace locally and builds all go components.
|
||||
# You can 'source' this file if you want to set up GOPATH in your local shell.
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
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
|
||||
cmd/e2e
|
||||
)
|
||||
|
||||
mkdir -p "${KUBE_TARGET}"
|
||||
|
||||
if [[ ! -f "/kube-build-image" ]]; then
|
||||
echo "WARNING: This script should be run in the kube-build container image!" >&2
|
||||
fi
|
||||
|
||||
if [[ -f "/kube-version-defs" ]]; then
|
||||
source "/kube-version-defs"
|
||||
else
|
||||
echo "WARNING: No version information provided in build image"
|
||||
fi
|
||||
|
||||
function kube::build::make_binary() {
|
||||
local -r gopkg=$1
|
||||
local -r bin=${gopkg##*/}
|
||||
|
||||
echo "+++ Building ${bin} for ${GOOS}/${GOARCH}"
|
||||
pushd "${KUBE_ROOT}" >/dev/null
|
||||
godep go build -ldflags "${KUBE_LD_FLAGS-}" -o "${ARCH_TARGET}/${bin}" "${gopkg}"
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
function kube::build::make_binaries() {
|
||||
[[ $# -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
|
||||
binaries+=("${KUBE_GO_PACKAGE}/${target}")
|
||||
done
|
||||
|
||||
ARCH_TARGET="${KUBE_TARGET}/${GOOS}/${GOARCH}"
|
||||
mkdir -p "${ARCH_TARGET}"
|
||||
|
||||
local b
|
||||
for b in "${binaries[@]}"; do
|
||||
kube::build::make_binary "$b"
|
||||
done
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/build/build-image/common.sh"
|
||||
|
||||
platforms=(linux/amd64 $KUBE_CROSSPLATFORMS)
|
||||
targets=("${client_targets[@]}")
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
targets=("$@")
|
||||
fi
|
||||
|
||||
for platform in "${platforms[@]}"; do
|
||||
(
|
||||
# Subshell to contain these exports
|
||||
export GOOS=${platform%/*}
|
||||
export GOARCH=${platform##*/}
|
||||
|
||||
kube::build::make_binaries "${targets[@]}"
|
||||
)
|
||||
done
|
@@ -1,29 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/build/build-image/common.sh"
|
||||
|
||||
targets=("${server_targets[@]}")
|
||||
if [[ $# -gt 0 ]]; then
|
||||
targets=("$@")
|
||||
fi
|
||||
|
||||
kube::build::make_binaries "${targets[@]}"
|
@@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/build/build-image/common.sh"
|
||||
|
||||
kube::build::make_binaries "./cmd/integration"
|
||||
|
||||
readonly ETCD_DIR="${KUBE_ROOT}/_output/etcd"
|
||||
mkdir -p "${ETCD_DIR}"
|
||||
|
||||
echo "+++ Running integration test"
|
||||
|
||||
etcd -name test -data-dir ${ETCD_DIR} > "${KUBE_ROOT}/_output/etcd.log" &
|
||||
readonly ETCD_PID=$!
|
||||
|
||||
sleep 5
|
||||
|
||||
"${KUBE_TARGET}/linux/amd64/integration"
|
||||
|
||||
kill $ETCD_PID
|
@@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/build/build-image/common.sh"
|
||||
|
||||
echo "+++ Running unit tests"
|
||||
|
||||
if [[ -n "${1-}" ]]; then
|
||||
godep go test -cover -coverprofile=tmp.out "$KUBE_GO_PACKAGE/$1"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
godep go test ./...
|
140
build/common.sh
140
build/common.sh
@@ -25,7 +25,7 @@ cd "${KUBE_ROOT}"
|
||||
# This'll canonicalize the path
|
||||
KUBE_ROOT=$PWD
|
||||
|
||||
source hack/config-go.sh
|
||||
source hack/lib/init.sh
|
||||
|
||||
# Incoming options
|
||||
#
|
||||
@@ -49,37 +49,38 @@ readonly KUBE_BUILD_IMAGE_REPO=kube-build
|
||||
readonly KUBE_BUILD_IMAGE_CROSS_TAG=cross
|
||||
readonly KUBE_BUILD_IMAGE_CROSS="${KUBE_BUILD_IMAGE_REPO}:${KUBE_BUILD_IMAGE_CROSS_TAG}"
|
||||
readonly KUBE_BUILD_GOLANG_VERSION=1.3
|
||||
# KUBE_BUILD_DATA_CONTAINER_NAME=kube-build-data-<hash>
|
||||
|
||||
readonly KUBE_GO_PACKAGE="github.com/GoogleCloudPlatform/kubernetes"
|
||||
|
||||
# We set up a volume so that we have the same _output directory from one run of
|
||||
# the container to the next.
|
||||
# Here we map the output directories across both the local and remote _output
|
||||
# directories:
|
||||
#
|
||||
# Note that here "LOCAL" is local to the docker daemon. In the boot2docker case
|
||||
# this is still inside the VM. We use the same directory in both cases though.
|
||||
# *_OUTPUT_ROOT - the base of all output in that environment.
|
||||
# *_OUTPUT_SUBPATH - location where golang stuff is built/cached. Also
|
||||
# persisted across docker runs with a volume mount.
|
||||
# *_OUTPUT_BINPATH - location where final binaries are placed. If the remote
|
||||
# is really remote, this is the stuff that has to be copied
|
||||
# back.
|
||||
readonly LOCAL_OUTPUT_ROOT="${KUBE_ROOT}/_output"
|
||||
readonly LOCAL_OUTPUT_BUILD="${LOCAL_OUTPUT_ROOT}/build"
|
||||
readonly LOCAL_OUTPUT_SUBPATH="${LOCAL_OUTPUT_ROOT}/dockerized"
|
||||
readonly LOCAL_OUTPUT_BINPATH="${LOCAL_OUTPUT_SUBPATH}/bin"
|
||||
readonly LOCAL_OUTPUT_IMAGE_STAGING="${LOCAL_OUTPUT_ROOT}/images"
|
||||
|
||||
readonly REMOTE_OUTPUT_ROOT="/go/src/${KUBE_GO_PACKAGE}/_output"
|
||||
readonly REMOTE_OUTPUT_DIR="${REMOTE_OUTPUT_ROOT}/build"
|
||||
readonly DOCKER_MOUNT_ARGS=(--volume "${LOCAL_OUTPUT_BUILD}:${REMOTE_OUTPUT_DIR}")
|
||||
readonly REMOTE_OUTPUT_SUBPATH="${REMOTE_OUTPUT_ROOT}/dockerized"
|
||||
readonly REMOTE_OUTPUT_BINPATH="${REMOTE_OUTPUT_SUBPATH}/bin"
|
||||
|
||||
readonly KUBE_CLIENT_BINARIES=(
|
||||
kubecfg
|
||||
kubectl
|
||||
readonly DOCKER_MOUNT_ARGS_BASE=(--volume "${LOCAL_OUTPUT_BINPATH}:${REMOTE_OUTPUT_BINPATH}")
|
||||
# DOCKER_MOUNT_ARGS=("${DOCKER_MOUNT_ARGS_BASE[@]}" --volumes-from "${KUBE_BUILD_DATA_CONTAINER_NAME}")
|
||||
|
||||
# We create a Docker data container to cache incremental build artifacts. We
|
||||
# need to cache both the go tree in _output and the go tree under Godeps.
|
||||
readonly REMOTE_OUTPUT_GOPATH="${REMOTE_OUTPUT_SUBPATH}/go"
|
||||
readonly REMOTE_GODEP_GOPATH="/go/src/${KUBE_GO_PACKAGE}/Godeps/_workspace/pkg"
|
||||
readonly DOCKER_DATA_MOUNT_ARGS=(
|
||||
--volume "${REMOTE_OUTPUT_GOPATH}"
|
||||
--volume "${REMOTE_GODEP_GOPATH}"
|
||||
)
|
||||
|
||||
readonly KUBE_SERVER_BINARIES=(
|
||||
apiserver
|
||||
controller-manager
|
||||
kubelet
|
||||
proxy
|
||||
scheduler
|
||||
)
|
||||
|
||||
readonly KUBE_SERVER_PLATFORMS=(
|
||||
linux/amd64
|
||||
)
|
||||
|
||||
readonly KUBE_RUN_IMAGE_BASE="kubernetes"
|
||||
readonly KUBE_RUN_IMAGES=(
|
||||
@@ -102,26 +103,32 @@ readonly RELEASE_DIR="${LOCAL_OUTPUT_ROOT}/release-tars"
|
||||
# up some dynamic constants.
|
||||
#
|
||||
# Vars set:
|
||||
# KUBE_ROOT_HASH
|
||||
# KUBE_BUILD_IMAGE_TAG
|
||||
# KUBE_BUILD_IMAGE
|
||||
# KUBE_BUILD_CONTAINER_NAME
|
||||
# KUBE_ROOT_HASH
|
||||
# KUBE_BUILD_DATA_CONTAINER_NAME
|
||||
# DOCKER_MOUNT_ARGS
|
||||
function kube::build::verify_prereqs() {
|
||||
if [[ -z "$(which docker)" ]]; then
|
||||
echo "Can't find 'docker' in PATH, please fix and retry." >&2
|
||||
echo "See https://docs.docker.com/installation/#installation for installation instructions." >&2
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if kube::build::is_osx; then
|
||||
if [[ -z "$(which boot2docker)" ]]; then
|
||||
echo "It looks like you are running on Mac OS X and boot2docker can't be found." >&2
|
||||
echo "See: https://docs.docker.com/installation/mac/" >&2
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
if [[ $(boot2docker status) != "running" ]]; then
|
||||
echo "boot2docker VM isn't started. Please run 'boot2docker start'" >&2
|
||||
return 1
|
||||
exit 1
|
||||
else
|
||||
# Reach over and set the clock. After sleep/resume the clock will skew.
|
||||
echo "+++ Setting boot2docker clock"
|
||||
boot2docker ssh sudo date -u -D "%Y%m%d%H%M.%S" --set "$(date -u +%Y%m%d%H%M.%S)" >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -130,20 +137,23 @@ function kube::build::verify_prereqs() {
|
||||
echo "Can't connect to 'docker' daemon. please fix and retry."
|
||||
echo
|
||||
echo "Possible causes:"
|
||||
echo " - On Mac OS X, boot2docker VM isn't started"
|
||||
echo " - On Mac OS X, DOCKER_HOST env variable isn't set approriately"
|
||||
echo " - On Mac OS X, boot2docker VM isn't installed or started"
|
||||
echo " - On Mac OS X, docker env variable isn't set approriately. Run:"
|
||||
echo " \$(boot2docker shellinit)"
|
||||
echo " - On Linux, user isn't in 'docker' group. Add and relogin."
|
||||
echo " - Something like 'sudo usermod -a -G docker ${USER-user}'"
|
||||
echo " - RHEL7 bug and workaround: https://bugzilla.redhat.com/show_bug.cgi?id=1119282#c8"
|
||||
echo " - On Linux, Docker daemon hasn't been started or has crashed"
|
||||
} >&2
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
KUBE_ROOT_HASH=$(kube::build::short_hash "$KUBE_ROOT")
|
||||
KUBE_BUILD_IMAGE_TAG="build-${KUBE_ROOT_HASH}"
|
||||
KUBE_BUILD_IMAGE="${KUBE_BUILD_IMAGE_REPO}:${KUBE_BUILD_IMAGE_TAG}"
|
||||
KUBE_BUILD_CONTAINER_NAME="kube-build-${KUBE_ROOT_HASH}"
|
||||
KUBE_BUILD_DATA_CONTAINER_NAME="kube-build-data-${KUBE_ROOT_HASH}"
|
||||
DOCKER_MOUNT_ARGS=("${DOCKER_MOUNT_ARGS_BASE[@]}" --volumes-from "${KUBE_BUILD_DATA_CONTAINER_NAME}")
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -156,19 +166,22 @@ function kube::build::is_osx() {
|
||||
function kube::build::clean_output() {
|
||||
# Clean out the output directory if it exists.
|
||||
if kube::build::build_image_built ; then
|
||||
echo "+++ Cleaning out _output/build via docker build image"
|
||||
kube::build::run_build_command bash -c "rm -rf '${REMOTE_OUTPUT_DIR}'/*"
|
||||
echo "+++ Cleaning out _output/dockerized/bin/ via docker build image"
|
||||
kube::build::run_build_command bash -c "rm -rf '${REMOTE_OUTPUT_BINPATH}'/*"
|
||||
else
|
||||
echo "!!! Build image not built. Cannot clean via docker build image."
|
||||
fi
|
||||
|
||||
echo "+++ Removing data container"
|
||||
docker rm "${KUBE_BUILD_DATA_CONTAINER_NAME}" >/dev/null 2>&1 || true
|
||||
|
||||
echo "+++ Cleaning out local _output directory"
|
||||
rm -rf "${LOCAL_OUTPUT_ROOT}"
|
||||
}
|
||||
|
||||
# Make sure the _output directory is created and mountable by docker
|
||||
function kube::build::prepare_output() {
|
||||
mkdir -p "${LOCAL_OUTPUT_ROOT}"
|
||||
mkdir -p "${LOCAL_OUTPUT_SUBPATH}"
|
||||
|
||||
# On RHEL/Fedora SELinux is enabled by default and currently breaks docker
|
||||
# volume mounts. We can work around this by explicitly adding a security
|
||||
@@ -249,13 +262,14 @@ function kube::build::build_image() {
|
||||
build
|
||||
cmd
|
||||
examples
|
||||
Godeps/Godeps.json
|
||||
Godeps/_workspace/src
|
||||
Godeps/Godeps.json
|
||||
hack
|
||||
LICENSE
|
||||
pkg
|
||||
plugin
|
||||
README.md
|
||||
test
|
||||
third_party
|
||||
)
|
||||
|
||||
@@ -263,9 +277,10 @@ function kube::build::build_image() {
|
||||
|
||||
mkdir -p "${build_context_dir}"
|
||||
tar czf "${build_context_dir}/kube-source.tar.gz" "${source[@]}"
|
||||
cat >"${build_context_dir}/kube-version-defs" <<EOF
|
||||
KUBE_LD_FLAGS="$(kube::version_ldflags)"
|
||||
EOF
|
||||
|
||||
kube::version::get_version_vars
|
||||
kube::version::save_version_vars "${build_context_dir}/kube-version-defs"
|
||||
|
||||
cp build/build-image/Dockerfile ${build_context_dir}/Dockerfile
|
||||
kube::build::docker_build "${KUBE_BUILD_IMAGE}" "${build_context_dir}"
|
||||
}
|
||||
@@ -281,7 +296,7 @@ function kube::build::build_image_cross() {
|
||||
}
|
||||
|
||||
# Builds the runtime image. Assumes that the appropriate binaries are already
|
||||
# built and in _output/build/.
|
||||
# built and in $LOCAL_OUTPUT_BINPATH.
|
||||
function kube::build::run_image() {
|
||||
[[ ${KUBE_BUILD_RUN_IMAGES} =~ ^[yY]$ ]] || return 0
|
||||
|
||||
@@ -290,7 +305,7 @@ function kube::build::run_image() {
|
||||
# First build the base image. This one brings in all of the binaries.
|
||||
mkdir -p "${build_context_base}"
|
||||
tar czf "${build_context_base}/kube-bins.tar.gz" \
|
||||
-C "${LOCAL_OUTPUT_ROOT}/build/linux/amd64" \
|
||||
-C "${LOCAL_OUTPUT_BINPATH}/linux/amd64" \
|
||||
"${KUBE_RUN_IMAGES[@]}"
|
||||
cp -R build/run-images/base/* "${build_context_base}/"
|
||||
kube::build::docker_build "${KUBE_RUN_IMAGE_BASE}" "${build_context_base}"
|
||||
@@ -350,11 +365,26 @@ function kube::build::clean_images() {
|
||||
docker rmi $(docker images -q --filter 'dangling=true') 2> /dev/null || true
|
||||
}
|
||||
|
||||
function kube::build::ensure_data_container() {
|
||||
if ! docker inspect "${KUBE_BUILD_DATA_CONTAINER_NAME}" >/dev/null 2>&1; then
|
||||
echo "+++ Creating data container"
|
||||
local -ra docker_cmd=(
|
||||
docker run
|
||||
"${DOCKER_DATA_MOUNT_ARGS[@]}"
|
||||
--name "${KUBE_BUILD_DATA_CONTAINER_NAME}"
|
||||
"${KUBE_BUILD_IMAGE}"
|
||||
true
|
||||
)
|
||||
"${docker_cmd[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Run a command in the kube-build image. This assumes that the image has
|
||||
# already been built. This will sync out all output data from the build.
|
||||
function kube::build::run_build_command() {
|
||||
[[ $# != 0 ]] || { echo "Invalid input." >&2; return 4; }
|
||||
|
||||
kube::build::ensure_data_container
|
||||
kube::build::prepare_output
|
||||
|
||||
local -a docker_run_opts=(
|
||||
@@ -389,10 +419,10 @@ function kube::build::run_build_command() {
|
||||
# docker) or if it is "local" and we can access the output without going through
|
||||
# docker.
|
||||
function kube::build::is_output_remote() {
|
||||
rm -f "${LOCAL_OUTPUT_BUILD}/test_for_remote"
|
||||
kube::build::run_build_command touch "${REMOTE_OUTPUT_DIR}/test_for_remote"
|
||||
rm -f "${LOCAL_OUTPUT_SUBPATH}/test_for_remote"
|
||||
kube::build::run_build_command touch "${REMOTE_OUTPUT_BINPATH}/test_for_remote"
|
||||
|
||||
[[ ! -e "${LOCAL_OUTPUT_BUILD}/test_for_remote" ]]
|
||||
[[ ! -e "${LOCAL_OUTPUT_BINPATH}/test_for_remote" ]]
|
||||
}
|
||||
|
||||
# If the Docker server is remote, copy the results back out.
|
||||
@@ -409,14 +439,14 @@ function kube::build::copy_output() {
|
||||
# container pointed at the same volume, tar the output directory and ship
|
||||
# that tar over stdout.
|
||||
|
||||
echo "+++ Syncing back _output directory from boot2docker VM"
|
||||
rm -rf "${LOCAL_OUTPUT_BUILD}"
|
||||
mkdir -p "${LOCAL_OUTPUT_BUILD}"
|
||||
echo "+++ Syncing back _output/dockerized/bin directory from remote Docker"
|
||||
rm -rf "${LOCAL_OUTPUT_BINPATH}"
|
||||
mkdir -p "${LOCAL_OUTPUT_BINPATH}"
|
||||
|
||||
# The '</dev/null' here makes us run docker in a "non-interactive" mode. Not
|
||||
# doing this corrupts the output stream.
|
||||
kube::build::run_build_command sh -c "tar c -C ${REMOTE_OUTPUT_DIR} . ; sleep 1" </dev/null \
|
||||
| tar xv -C "${LOCAL_OUTPUT_BUILD}"
|
||||
kube::build::run_build_command sh -c "tar c -C ${REMOTE_OUTPUT_BINPATH} . ; sleep 1" </dev/null \
|
||||
| tar xv -C "${LOCAL_OUTPUT_BINPATH}"
|
||||
|
||||
# I (jbeda) also tried getting rsync working using 'docker run' as the
|
||||
# 'remote shell'. This mostly worked but there was a hang when
|
||||
@@ -424,7 +454,7 @@ function kube::build::copy_output() {
|
||||
#
|
||||
# local DOCKER="docker run -i --rm --name=${KUBE_BUILD_CONTAINER_NAME} ${DOCKER_MOUNT} ${KUBE_BUILD_IMAGE}"
|
||||
# DOCKER+=" bash -c 'shift ; exec \"\$@\"' --"
|
||||
# rsync --blocking-io -av -e "${DOCKER}" foo:${REMOTE_OUTPUT_DIR}/ ${LOCAL_OUTPUT_BUILD}
|
||||
# rsync --blocking-io -av -e "${DOCKER}" foo:${REMOTE_OUTPUT_BINPATH}/ ${LOCAL_OUTPUT_BINPATH}
|
||||
else
|
||||
echo "+++ Output directory is local. No need to copy results out."
|
||||
fi
|
||||
@@ -448,7 +478,7 @@ function kube::release::package_tarballs() {
|
||||
function kube::release::package_client_tarballs() {
|
||||
# Find all of the built kubecfg binaries
|
||||
local platform platforms
|
||||
platforms=($(cd "${LOCAL_OUTPUT_ROOT}/build" ; echo */*))
|
||||
platforms=($(cd "${LOCAL_OUTPUT_BINPATH}" ; echo */*))
|
||||
for platform in "${platforms[@]}" ; do
|
||||
local platform_tag=${platform/\//-} # Replace a "/" for a "-"
|
||||
echo "+++ Building tarball: client $platform_tag"
|
||||
@@ -458,9 +488,9 @@ function kube::release::package_client_tarballs() {
|
||||
mkdir -p "${release_stage}/client/bin"
|
||||
|
||||
# This fancy expression will expand to prepend a path
|
||||
# (${LOCAL_OUTPUT_ROOT}/build/${platform}/) to every item in the
|
||||
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the
|
||||
# KUBE_CLIENT_BINARIES array.
|
||||
cp "${KUBE_CLIENT_BINARIES[@]/#/${LOCAL_OUTPUT_ROOT}/build/${platform}/}" \
|
||||
cp "${KUBE_CLIENT_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
|
||||
"${release_stage}/client/bin/"
|
||||
|
||||
local package_name="${RELEASE_DIR}/kubernetes-client-${platform_tag}.tar.gz"
|
||||
@@ -480,9 +510,9 @@ function kube::release::package_server_tarballs() {
|
||||
mkdir -p "${release_stage}/server/bin"
|
||||
|
||||
# This fancy expression will expand to prepend a path
|
||||
# (${LOCAL_OUTPUT_ROOT}/build/${platform}/) to every item in the
|
||||
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the
|
||||
# KUBE_SERVER_BINARIES array.
|
||||
cp "${KUBE_SERVER_BINARIES[@]/#/${LOCAL_OUTPUT_ROOT}/build/${platform}/}" \
|
||||
cp "${KUBE_SERVER_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
|
||||
"${release_stage}/server/bin/"
|
||||
|
||||
local package_name="${RELEASE_DIR}/kubernetes-server-${platform_tag}.tar.gz"
|
||||
@@ -517,7 +547,7 @@ function kube::release::package_full_tarball() {
|
||||
rm -rf "${release_stage}"
|
||||
mkdir -p "${release_stage}"
|
||||
|
||||
cp -R "${LOCAL_OUTPUT_ROOT}/build" "${release_stage}/platforms"
|
||||
cp -R "${LOCAL_OUTPUT_BINPATH}" "${release_stage}/platforms"
|
||||
|
||||
# We want everything in /cluster except saltbase. That is only needed on the
|
||||
# server.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,5 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,32 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "$KUBE_ROOT/build/common.sh"
|
||||
|
||||
kube::build::verify_prereqs
|
||||
kube::build::build_image
|
||||
kube::build::run_build_command build/build-image/make-client.sh "$@"
|
||||
kube::build::copy_output
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,31 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Make all of the Kubernetes server binaries.
|
||||
#
|
||||
# This makes the docker build image, builds the binaries and copies them out
|
||||
# of the docker container.
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "$KUBE_ROOT/build/common.sh"
|
||||
|
||||
kube::build::verify_prereqs
|
||||
kube::build::build_image
|
||||
kube::build::run_build_command build/build-image/make-server.sh "$@"
|
||||
kube::build::copy_output
|
@@ -1,5 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
@@ -29,12 +29,11 @@ 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-client.sh
|
||||
kube::build::run_build_command build/build-image/make-server.sh
|
||||
kube::build::run_build_command hack/build-cross.sh
|
||||
|
||||
if [[ $KUBE_RELEASE_RUN_TESTS =~ ^[yY]$ ]]; then
|
||||
kube::build::run_build_command build/build-image/run-tests.sh
|
||||
kube::build::run_build_command build/build-image/run-integration.sh
|
||||
kube::build::run_build_command hack/test-go.sh
|
||||
kube::build::run_build_command hack/test-integration.sh
|
||||
fi
|
||||
|
||||
kube::build::copy_output
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
|
@@ -1,28 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Run all of the golang unit tests.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "$KUBE_ROOT/build/common.sh"
|
||||
|
||||
kube::build::verify_prereqs
|
||||
kube::build::build_image
|
||||
kube::build::run_build_command build/build-image/run-tests.sh "$@"
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
@@ -14,7 +14,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Run the integration test.
|
||||
# Run a command in the docker build container. Typically this will be one of
|
||||
# the commands in `hack/`. When running in the build container the user is sure
|
||||
# to have a consistent reproducible build environment.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
@@ -25,5 +27,8 @@ 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 "./cmd/integration"
|
||||
kube::build::run_build_command build/build-image/run-integration.sh
|
||||
kube::build::run_build_command "$@"
|
||||
|
||||
if [[ ${KUBE_RUN_COPY_OUTPUT:-y} =~ ^[yY]$ ]]; then
|
||||
kube::build::copy_output
|
||||
fi
|
@@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
@@ -27,4 +27,4 @@ source "$KUBE_ROOT/build/common.sh"
|
||||
|
||||
kube::build::verify_prereqs
|
||||
kube::build::build_image
|
||||
kube::build::run_build_command bash
|
||||
kube::build::run_build_command bash || true
|
||||
|
Reference in New Issue
Block a user