Commit 96c1bc17 authored by Joe Beda's avatar Joe Beda

Set shell options for reliability.

Tweak a few other small things in our shell scripts.
parent d43a6ec5
......@@ -46,18 +46,20 @@ function kube::build::make_binary() {
}
function kube::build::make_binaries() {
if [[ ${#targets[@]} -eq 0 ]]; then
targets=(
cmd/proxy
cmd/apiserver
cmd/controller-manager
cmd/kubelet
cmd/kubecfg
plugin/cmd/scheduler
)
local -a targets=(
cmd/proxy
cmd/apiserver
cmd/controller-manager
cmd/kubelet
cmd/kubecfg
plugin/cmd/scheduler
)
if [[ -n "${1-}" ]]; then
targets=("$1")
fi
binaries=()
local -a binaries=()
local target
for target in "${targets[@]}"; do
binaries+=("${KUBE_GO_PACKAGE}/${target}")
......@@ -66,11 +68,6 @@ function kube::build::make_binaries() {
ARCH_TARGET="${KUBE_TARGET}/${GOOS}/${GOARCH}"
mkdir -p "${ARCH_TARGET}"
if [[ -n "$1" ]]; then
kube::build::make_binary "$1"
exit 0
fi
local b
for b in "${binaries[@]}"; do
kube::build::make_binary "$b"
......
......@@ -14,7 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/build/build-image/common.sh"
......
......@@ -14,7 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/build/build-image/common.sh"
......
......@@ -14,7 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/build/build-image/common.sh"
......
......@@ -14,14 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
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
if [[ -n "${1-}" ]]; then
godep go test -cover -coverprofile=tmp.out "$KUBE_GO_PACKAGE/$1"
exit 0
fi
......
......@@ -53,7 +53,7 @@ readonly LOCAL_OUTPUT_BUILD="${LOCAL_OUTPUT_ROOT}/build"
readonly REMOTE_OUTPUT_ROOT="/go/src/${KUBE_GO_PACKAGE}/_output"
readonly REMOTE_OUTPUT_DIR="${REMOTE_OUTPUT_ROOT}/build"
readonly DOCKER_CONTAINER_NAME=kube-build
readonly DOCKER_MOUNT="-v ${LOCAL_OUTPUT_BUILD}:${REMOTE_OUTPUT_DIR}"
readonly DOCKER_MOUNT_ARGS=(--volume "${LOCAL_OUTPUT_BUILD}:${REMOTE_OUTPUT_DIR}")
readonly KUBE_CLIENT_BINARIES=(
kubecfg
......@@ -114,6 +114,7 @@ function kube::build::verify_prereqs() {
echo " - On Mac OS X, boot2docker VM isn't started" >&2
echo " - On Mac OS X, DOCKER_HOST env variable isn't set approriately" >&2
echo " - On Linux, user isn't in 'docker' group. Add and relogin." >&2
echo " Something like 'sudo usermod -a -G docker ${USER-user}'" >&2
echo " - On Linux, Docker daemon hasn't been started or has crashed" >&2
return 1
fi
......@@ -207,25 +208,23 @@ function kube::build::run_image() {
function kube::build::docker_build() {
local -r image=$1
local -r context_dir=$2
local -r build_cmd="docker build -t ${image} ${context_dir}"
local -ra build_cmd=(docker build -t "${image}" "${context_dir}")
echo "+++ Building Docker image ${image}. This can take a while."
set +e # We are handling the error here manually
local docker_output
docker_output=$(${build_cmd} 2>&1)
if [[ $? -ne 0 ]]; then
set -e
echo "+++ Docker build command failed for ${image}" >&2
echo >&2
echo "${docker_output}" >&2
echo >&2
echo "To retry manually, run:" >&2
echo >&2
echo " ${build_cmd}" >&2
echo >&2
docker_output=$("${build_cmd[@]}" 2>&1) || {
cat <<EOF >&2
+++ Docker build command failed for ${image}
${docker_output}
To retry manually, run:
${build_cmd[*]}
EOF
return 1
fi
set -e
}
}
function kube::build::clean_image() {
......@@ -252,18 +251,21 @@ function kube::build::clean_images() {
# 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() {
[[ -n "$@" ]] || { echo "Invalid input." >&2; return 4; }
[[ $# != 0 ]] || { echo "Invalid input." >&2; return 4; }
local -r docker="docker run --name=${DOCKER_CONTAINER_NAME} --attach=stdout --attach=stderr --attach=stdin --tty ${DOCKER_MOUNT} ${KUBE_BUILD_IMAGE}"
local -ra docker_cmd=(
docker run "--name=${DOCKER_CONTAINER_NAME}"
--interactive --tty
"${DOCKER_MOUNT_ARGS[@]}" "${KUBE_BUILD_IMAGE}")
# Remove the container if it is left over from some previous aborted run
docker rm ${DOCKER_CONTAINER_NAME} >/dev/null 2>&1 || true
${docker} "$@"
docker rm "${DOCKER_CONTAINER_NAME}" >/dev/null 2>&1 || true
"${docker_cmd[@]}" "$@"
# Remove the container after we run. '--rm' might be appropriate but it
# appears that sometimes it fails. See
# https://github.com/docker/docker/issues/3968
docker rm ${DOCKER_CONTAINER_NAME} >/dev/null 2>&1 || true
docker rm "${DOCKER_CONTAINER_NAME}" >/dev/null 2>&1 || true
}
# If the Docker server is remote, copy the results back out.
......@@ -278,21 +280,23 @@ function kube::build::copy_output() {
# The easiest thing I (jbeda) could figure out was to launch another
# container pointed at the same volume, tar the output directory and ship
# that tar over stdou.
local -r docker="docker run -a stdout --name=${DOCKER_CONTAINER_NAME} ${DOCKER_MOUNT} ${KUBE_BUILD_IMAGE}"
local -ra docker_cmd=(
docker run -a stdout "--name=${DOCKER_CONTAINER_NAME}"
"${DOCKER_MOUNT_ARGS[@]}" "${KUBE_BUILD_IMAGE}")
# Kill any leftover container
docker rm ${DOCKER_CONTAINER_NAME} >/dev/null 2>&1 || true
docker rm "${DOCKER_CONTAINER_NAME}" >/dev/null 2>&1 || true
echo "+++ Syncing back _output directory from boot2docker VM"
rm -rf "${LOCAL_OUTPUT_BUILD}"
mkdir -p "${LOCAL_OUTPUT_BUILD}"
${docker} sh -c "tar c -C ${REMOTE_OUTPUT_DIR} . ; sleep 1" \
"${docker_cmd[@]}" sh -c "tar c -C ${REMOTE_OUTPUT_DIR} . ; sleep 1" \
| tar xv -C "${LOCAL_OUTPUT_BUILD}"
# Remove the container after we run. '--rm' might be appropriate but it
# appears that sometimes it fails. See
# https://github.com/docker/docker/issues/3968
docker rm ${DOCKER_CONTAINER_NAME} >/dev/null 2>&1 || true
docker rm "${DOCKER_CONTAINER_NAME}" >/dev/null 2>&1 || true
# I (jbeda) also tried getting rsync working using 'docker run' as the
# 'remote shell'. This mostly worked but there was a hang when
......@@ -440,7 +444,7 @@ function kube::release::gcs::verify_prereqs() {
if [[ -z "${GCLOUD_ACCOUNT-}" ]]; then
GCLOUD_ACCOUNT=$(gcloud auth list 2>/dev/null | awk '/(active)/ { print $2 }')
fi
if [[ -z "${GCLOUD_ACCOUNT}" ]]; then
if [[ -z "${GCLOUD_ACCOUNT-}" ]]; then
echo "No account authorized through gcloud. Please fix with:"
echo
echo " gcloud auth login"
......@@ -450,7 +454,7 @@ function kube::release::gcs::verify_prereqs() {
if [[ -z "${GCLOUD_PROJECT-}" ]]; then
GCLOUD_PROJECT=$(gcloud config list project | awk '{project = $3} END {print project}')
fi
if [[ -z "${GCLOUD_PROJECT}" ]]; then
if [[ -z "${GCLOUD_PROJECT-}" ]]; then
echo "No account authorized through gcloud. Please fix with:"
echo
echo " gcloud config set project <project id>"
......@@ -471,9 +475,9 @@ function kube::release::gcs::ensure_release_bucket() {
KUBE_GCS_RELEASE_PREFIX=${KUBE_GCS_RELEASE_PREFIX-devel/}
KUBE_GCS_DOCKER_REG_PREFIX=${KUBE_GCS_DOCKER_REG_PREFIX-docker-reg/}
if ! gsutil ls gs://${KUBE_GCS_RELEASE_BUCKET} >/dev/null 2>&1 ; then
if ! gsutil ls "gs://${KUBE_GCS_RELEASE_BUCKET}" >/dev/null 2>&1 ; then
echo "Creating Google Cloud Storage bucket: $RELEASE_BUCKET"
gsutil mb gs://${KUBE_GCS_RELEASE_BUCKET}
gsutil mb "gs://${KUBE_GCS_RELEASE_BUCKET}"
fi
}
......@@ -487,7 +491,8 @@ function kube::release::gcs::ensure_docker_registry() {
# Grovel around and find the OAuth token in the gcloud config
local -r boto=~/.config/gcloud/legacy_credentials/${GCLOUD_ACCOUNT}/.boto
local -r refresh_token=$(grep 'gs_oauth2_refresh_token =' $boto | awk '{ print $3 }')
local refresh_token
refresh_token=$(grep 'gs_oauth2_refresh_token =' "$boto" | awk '{ print $3 }')
if [[ -z "$refresh_token" ]]; then
echo "Couldn't find OAuth 2 refresh token in ${boto}" >&2
......@@ -498,14 +503,16 @@ function kube::release::gcs::ensure_docker_registry() {
docker rm ${reg_container_name} >/dev/null 2>&1 || true
echo "+++ Starting GCS backed Docker registry"
local docker="docker run -d --name=${reg_container_name} "
docker+="-e GCS_BUCKET=${KUBE_GCS_RELEASE_BUCKET} "
docker+="-e STORAGE_PATH=${KUBE_GCS_DOCKER_REG_PREFIX} "
docker+="-e GCP_OAUTH2_REFRESH_TOKEN=${refresh_token} "
docker+="-p 127.0.0.1:5000:5000 "
docker+="google/docker-registry"
${docker}
local -ra docker_cmd=(
docker run -d "--name=${reg_container_name}"
-e "GCS_BUCKET=${KUBE_GCS_RELEASE_BUCKET}"
-e "STORAGE_PATH=${KUBE_GCS_DOCKER_REG_PREFIX}"
-e "GCP_OAUTH2_REFRESH_TOKEN=${refresh_token}"
-p 127.0.0.1:5000:5000
google/docker-registry
)
"${docker[@]}"
# Give it time to spin up before we start throwing stuff at it
sleep 5
......
......@@ -18,6 +18,9 @@
#
# This is a no-op on Linux when the Docker daemon is local. This is only
# necessary on Mac OS X with boot2docker.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "$KUBE_ROOT/build/common.sh"
......
......@@ -18,6 +18,9 @@
#
# 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"
......
......@@ -20,6 +20,9 @@
# Kubernetes into a tar file and put it in the right place in the output
# directory. It will then copy over the Dockerfile and build the kube-build
# image.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.."
source "$KUBE_ROOT/build/common.sh"
......
......@@ -15,6 +15,9 @@
# limitations under the License.
# Clean out the output directory on the docker host.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "$KUBE_ROOT/build/common.sh"
......
......@@ -19,6 +19,10 @@
# 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"
......
......@@ -19,6 +19,10 @@
# This script will make the 'run image' after building all of the necessary
# binaries.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "$KUBE_ROOT/build/common.sh"
......
......@@ -18,6 +18,10 @@
# images and other build artifacts. All intermediate artifacts will be hosted
# publicly on Google Cloud Storage currently.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "$KUBE_ROOT/build/common.sh"
......
......@@ -16,6 +16,10 @@
# Run the integration test.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "$KUBE_ROOT/build/common.sh"
......
......@@ -16,6 +16,10 @@
# 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"
......
......@@ -18,6 +18,10 @@
#
# This container will have a snapshot of the current sources.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "$KUBE_ROOT/build/common.sh"
......
......@@ -16,8 +16,9 @@
# Tear down a Kubernetes cluster.
# exit on any error
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/cluster/kube-env.sh"
......
......@@ -19,8 +19,9 @@
# This will find the release tar, cause it to be downloaded, unpacked, installed
# and enacted.
# exit on any error
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/cluster/kube-env.sh"
......
......@@ -20,8 +20,9 @@
# that directly. If not then we assume we are doing development stuff and take
# the defaults in the release config.
# exit on any error
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/cluster/kube-env.sh"
......
......@@ -14,6 +14,10 @@
# 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}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
......@@ -22,34 +26,36 @@ source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
case "$(uname -s)" in
Darwin)
host_os=darwin
;;
;;
Linux)
host_os=linux
;;
;;
*)
echo "Unsupported host OS. Must be Linux or Mac OS X." >&2
exit 1
;;
esac
case "$(uname -m)" in
x86_64*)
host_arch=amd64
;;
;;
i?86_64*)
host_arch=amd64
;;
;;
amd64*)
host_arch=amd64
;;
;;
arm*)
host_arch=arm
;;
;;
i?86*)
host_arch=x86
;;
;;
*)
echo "Unsupported host arch. Must be x86_64, 386 or arm." >&2
exit 1
echo "Unsupported host arch. Must be x86_64, 386 or arm." >&2
exit 1
;;
esac
kubecfg="${KUBE_ROOT}/_output/build/${host_os}/${host_arch}/kubecfg"
......@@ -84,8 +90,8 @@ else
fi
detect-master > /dev/null
if [[ "$KUBE_MASTER_IP" != "" ]] && [[ "$KUBERNETES_MASTER" == "" ]]; then
if [[ -n "${KUBE_MASTER_IP-}" && -z "${KUBERNETES_MASTER-}" ]]; then
export KUBERNETES_MASTER=https://${KUBE_MASTER_IP}
fi
"$kubecfg" "${auth_config[@]}" "$@"
"$kubecfg" "${auth_config[@]:+${auth_config[@]}}" "$@"
......@@ -21,7 +21,8 @@ set -o errexit
set -o nounset
set -o pipefail
readonly SALT_ROOT=$(dirname "${BASH_SOURCE}")
SALT_ROOT=$(dirname "${BASH_SOURCE}")
readonly SALT_ROOT
readonly SERVER_BIN_TAR=${1-}
if [[ -z "$SERVER_BIN_TAR" ]]; then
......@@ -31,7 +32,7 @@ fi
# Create a temp dir for untaring
KUBE_TEMP=$(mktemp -d -t kubernetes.XXXXXX)
trap "rm -rf ${KUBE_TEMP}" EXIT
trap 'rm -rf "${KUBE_TEMP}"' EXIT
# This file is meant to run on the master. It will install the salt configs
# into the appropriate place on the master.
......
......@@ -20,8 +20,9 @@
# that directly. If not then we assume we are doing development stuff and take
# the defaults in the release config.
# exit on any error
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/cluster/kube-env.sh"
......@@ -44,13 +45,15 @@ fi
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
# Grep returns an exit status of 1 when line is not found, so we need the : to always return a 0 exit status
count=$(grep -c ${MINION_NAMES[i]} ${MINIONS_FILE}) || :
if [ "$count" == "0" ]; then
if [[ "$count" == "0" ]]; then
echo "Failed to find ${MINION_NAMES[i]}, cluster is probably broken."
exit 1
fi
# Make sure the kubelet is healthy
if [ "$(curl -s --insecure --user ${KUBE_USER}:${KUBE_PASSWORD} https://${KUBE_MASTER_IP}/proxy/minion/${MINION_NAMES[$i]}/healthz)" != "ok" ]; then
curl_output=$(curl -s --insecure --user "${KUBE_USER}:${KUBE_PASSWORD}" \
"https://${KUBE_MASTER_IP}/proxy/minion/${MINION_NAMES[$i]}/healthz")
if [[ "${curl_output}" != "ok" ]]; then
echo "Kubelet failed to install on ${MINION_NAMES[$i]}. Your cluster is unlikely to work correctly."
echo "Please run ./cluster/kube-down.sh and re-create the cluster. (sorry!)"
exit 1
......
......@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_COVER=" " KUBE_RACE=" " hack/test-go.sh "" -test.run="^X" -benchtime=1s -bench=. -benchmem
\ No newline at end of file
KUBE_COVER=" " KUBE_RACE=" " hack/test-go.sh "" -test.run="^X" -benchtime=1s -bench=. -benchmem
......@@ -199,6 +199,7 @@ export KUBE_GO_PACKAGE
set -o errexit
set -o nounset
set -o pipefail
go_pkg_dir="${KUBE_TARGET}/src/${KUBE_GO_PACKAGE}"
go_pkg_basedir=$(dirname "${go_pkg_dir}")
mkdir -p "${go_pkg_basedir}"
......
......@@ -16,6 +16,10 @@
# This script will build a dev release and push it to an existing cluster.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
# Build a release
......
......@@ -17,7 +17,9 @@
# This script will build a dev release and bring up a new cluster with that
# release.
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
......
......@@ -17,9 +17,11 @@
# Launches an nginx container and verifies it can be reached. Assumes that
# we're being called by hack/e2e-test.sh (we use some env vars it sets up).
# Exit on error
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/$KUBERNETES_PROVIDER/util.sh"
......@@ -41,17 +43,17 @@ function teardown() {
trap "teardown" EXIT
POD_ID_LIST=$($KUBECFG '-template={{range.Items}}{{.ID}} {{end}}' -l replicationController=myNginx list pods)
pod_id_list=$($KUBECFG '-template={{range.Items}}{{.ID}} {{end}}' -l replicationController=myNginx list pods)
# Container turn up on a clean cluster can take a while for the docker image pull.
ALL_RUNNING=0
while [ $ALL_RUNNING -ne 1 ]; do
all_running=0
while [[ $all_running -ne 1 ]]; do
echo "Waiting for all containers in pod to come up."
sleep 5
ALL_RUNNING=1
for id in $POD_ID_LIST; do
CURRENT_STATUS=$($KUBECFG -template '{{and .CurrentState.Info.mynginx.State.Running .CurrentState.Info.net.State.Running}}' get pods/$id)
if [ "$CURRENT_STATUS" != "{0001-01-01 00:00:00 +0000 UTC}" ]; then
ALL_RUNNING=0
all_running=1
for id in $pod_id_list; do
current_status=$($KUBECFG -template '{{and .CurrentState.Info.mynginx.State.Running .CurrentState.Info.net.State.Running}}' get pods/$id) || true
if [[ "$current_status" != "{0001-01-01 00:00:00 +0000 UTC}" ]]; then
all_running=0
fi
done
done
......@@ -65,9 +67,9 @@ sleep 5
# Verify that something is listening (nginx should give us a 404)
for (( i=0; i<${#KUBE_MINION_IP_ADDRESSES[@]}; i++)); do
IP_ADDRESS=${KUBE_MINION_IP_ADDRESSES[$i]}
echo "Trying to reach nginx instance that should be running at ${IP_ADDRESS}:8080..."
curl "http://${IP_ADDRESS}:8080"
ip_address=${KUBE_MINION_IP_ADDRESSES[$i]}
echo "Trying to reach nginx instance that should be running at ${ip_address}:8080..."
curl "http://${ip_address}:8080"
done
exit 0
......@@ -18,8 +18,11 @@
# works. Assumes that we're being called by hack/e2e-test.sh (we use some env
# vars it sets up).
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/$KUBERNETES_PROVIDER/util.sh"
......
......@@ -20,6 +20,7 @@ set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/$KUBERNETES_PROVIDER/util.sh"
......
......@@ -17,6 +17,10 @@
# Starts a Kubernetes cluster, runs the e2e test suite, and shuts it
# down.
set -o errexit
set -o nounset
set -o pipefail
# Use testing config
export KUBE_CONFIG_FILE="config-test.sh"
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
......@@ -34,9 +38,6 @@ ALREADY_UP=${1:-0}
LEAVE_UP=${2:-0}
TEAR_DOWN=${3:-0}
# Exit on error
set -e
if [[ $TEAR_DOWN -ne 0 ]]; then
detect-project
trap test-teardown EXIT
......
......@@ -14,9 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
cd third_party
git clone https://github.com/coreos/etcd.git
cd etcd
git checkout ab4bcc18694644d12f0c038339d8d039072502b1
git checkout ab4bcc18694644d12f0c038339d8d039072502b1
./build
......@@ -16,7 +16,9 @@
# This script installs std -race on Travis (see https://code.google.com/p/go/issues/detail?id=6479)
set -e
set -o errexit
set -o nounset
set -o pipefail
if [ "${TRAVIS}" == "true" ]; then
GO_VERSION=($(go version))
......
......@@ -17,18 +17,21 @@
# This command checks that the built commands can function together for
# simple scenarios. It does not require Docker so it can run in travis.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/util.sh"
source "${KUBE_ROOT}/hack/config-go.sh"
function cleanup()
{
set +e
kill ${APISERVER_PID} 1>&2 2>/dev/null
kill ${CTLRMGR_PID} 1>&2 2>/dev/null
kill ${KUBELET_PID} 1>&2 2>/dev/null
kill ${PROXY_PID} 1>&2 2>/dev/null
kill ${ETCD_PID} 1>&2 2>/dev/null
[[ -n ${APISERVER_PID-} ]] && kill ${APISERVER_PID} 1>&2 2>/dev/null
[[ -n ${CTLRMGR_PID-} ]] && kill ${CTLRMGR_PID} 1>&2 2>/dev/null
[[ -n ${KUBELET_PID-} ]] && kill ${KUBELET_PID} 1>&2 2>/dev/null
[[ -n ${PROXY_PID-} ]] && kill ${PROXY_PID} 1>&2 2>/dev/null
[[ -n ${ETCD_PID-} ]] && kill ${ETCD_PID} 1>&2 2>/dev/null
rm -rf ${ETCD_DIR} 1>&2 2>/dev/null
echo
echo "Complete"
......
......@@ -14,8 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/config-go.sh"
......@@ -138,7 +139,7 @@ if [[ "${iterations}" -gt 1 ]]; then
fi
fi
if [[ -n "$1" ]]; then
if [[ -n "${1-}" ]]; then
covdir="/tmp/k8s_coverage/$(date "+%s")"
echo saving coverage output in "${covdir}"
for arg; do
......
......@@ -14,6 +14,10 @@
# 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}")/..
result=0
......
......@@ -16,6 +16,11 @@
# GoFmt apparently is changing @ head...
set -o errexit
set -o nounset
set -o pipefail
GO_VERSION=($(go version))
if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3') ]]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment