diff --git a/contrib/mesos/ci/build-release.sh b/contrib/mesos/ci/build-release.sh new file mode 100755 index 00000000000..baa675f1a75 --- /dev/null +++ b/contrib/mesos/ci/build-release.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Copyright 2015 The Kubernetes Authors 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. + +# Cleans output files/images and builds a full release from scratch +# +# Prerequisite: +# ./cluster/mesos/docker/test/build.sh +# +# Example Usage: +# ./contrib/mesos/ci/build-release.sh + +set -o errexit +set -o nounset +set -o pipefail +set -o errtrace + +KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE}")/../../.." && pwd) + +"${KUBE_ROOT}/contrib/mesos/ci/run.sh" make clean + +export KUBERNETES_CONTRIB=mesos +export KUBE_RELEASE_RUN_TESTS="${KUBE_RELEASE_RUN_TESTS:-N}" +export KUBE_SKIP_CONFIRMATIONS=Y + +"${KUBE_ROOT}/build/release.sh" diff --git a/contrib/mesos/ci/build.sh b/contrib/mesos/ci/build.sh new file mode 100755 index 00000000000..1155a0b402d --- /dev/null +++ b/contrib/mesos/ci/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Copyright 2015 The Kubernetes Authors 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. + +# Cleans output files/images and builds linux binaries from scratch +# +# Prerequisite: +# ./cluster/mesos/docker/test/build.sh +# +# Example Usage: +# ./contrib/mesos/ci/build.sh + +set -o errexit +set -o nounset +set -o pipefail +set -o errtrace + +TEST_ARGS="$@" + +KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE}")/../../.." && pwd) + +export KUBERNETES_CONTRIB=mesos + +"${KUBE_ROOT}/contrib/mesos/ci/run.sh" make clean all ${TEST_ARGS} diff --git a/contrib/mesos/ci/run-with-cluster.sh b/contrib/mesos/ci/run-with-cluster.sh new file mode 100755 index 00000000000..cdab0398dfb --- /dev/null +++ b/contrib/mesos/ci/run-with-cluster.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Copyright 2015 The Kubernetes Authors 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. + +# Deploys a test cluster, runs the specified command, and destroys the test cluster. +# Runs all commands inside the mesosphere/kubernetes-mesos-test docker image (built on demand). +# Uses the mesos/docker cluster provider. +# +# Prerequisite: +# ./cluster/mesos/docker/test/build.sh +# +# Example Usage: +# ./contrib/mesos/ci/run-with-cluster.sh ./cluster/test-smoke.sh -v=2 + +set -o errexit +set -o nounset +set -o pipefail +set -o errtrace + +RUN_CMD="$@" +[ -z "${RUN_CMD:-}" ] && echo "No command supplied" && exit 1 + +KUBERNETES_PROVIDER="mesos/docker" + +MESOS_DOCKER_WORK_DIR="${MESOS_DOCKER_WORK_DIR:-${HOME}/tmp/kubernetes}" + +KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE}")/../../.." && pwd) + +# Clean (test artifacts) +echo "Cleaning work dir" +echo "${MESOS_DOCKER_WORK_DIR}" +rm -rf "${MESOS_DOCKER_WORK_DIR}" +mkdir -p "${MESOS_DOCKER_WORK_DIR}" + +echo "Detecting docker client" +# Mount docker client binary to avoid client/compose/daemon version conflicts +if [ -n "${DOCKER_MACHINE_NAME:-}" ] && which docker-machine; then + # On a Mac with docker-machine, use the binary in the VM, not the host binary + DOCKER_BIN_PATH="$(docker-machine ssh "${DOCKER_MACHINE_NAME}" which docker)" +else + DOCKER_BIN_PATH="$(which docker)" +fi +echo "${DOCKER_BIN_PATH}" + +# Clean (k8s output & images), Build, Kube-Up, Test, Kube-Down +cd "${KUBE_ROOT}" +exec docker run \ + --rm \ + -v "${KUBE_ROOT}:/go/src/github.com/GoogleCloudPlatform/kubernetes" \ + -v "/var/run/docker.sock:/var/run/docker.sock" \ + -v "${DOCKER_BIN_PATH}:/usr/bin/docker" \ + -v "${MESOS_DOCKER_WORK_DIR}/auth:${MESOS_DOCKER_WORK_DIR}/auth" \ + -v "${MESOS_DOCKER_WORK_DIR}/log:${MESOS_DOCKER_WORK_DIR}/log" \ + -v "${MESOS_DOCKER_WORK_DIR}/mesosslave1/mesos:${MESOS_DOCKER_WORK_DIR}/mesosslave1/mesos" \ + -v "${MESOS_DOCKER_WORK_DIR}/mesosslave2/mesos:${MESOS_DOCKER_WORK_DIR}/mesosslave2/mesos" \ + -v "${MESOS_DOCKER_WORK_DIR}/overlay:${MESOS_DOCKER_WORK_DIR}/overlay" \ + -v "${MESOS_DOCKER_WORK_DIR}/reports:${MESOS_DOCKER_WORK_DIR}/reports" \ + -e "MESOS_DOCKER_WORK_DIR=${MESOS_DOCKER_WORK_DIR}" \ + -e "MESOS_DOCKER_IMAGE_DIR=/var/tmp/kubernetes" \ + -e "MESOS_DOCKER_OVERLAY_DIR=${MESOS_DOCKER_WORK_DIR}/overlay" \ + -e "KUBERNETES_CONTRIB=mesos" \ + -e "KUBERNETES_PROVIDER=mesos/docker" \ + -e "TERM=ansi" \ + -e "USER=root" \ + -e "E2E_REPORT_DIR=${MESOS_DOCKER_WORK_DIR}/reports" \ + mesosphere/kubernetes-mesos-test \ + -ceux "\ + make clean all && \ + trap 'timeout 5m ./cluster/kube-down.sh' EXIT && \ + ./cluster/kube-up.sh && \ + trap 'test \$? != 0 && export MESOS_DOCKER_DUMP_LOGS=true; timeout 5m ./cluster/kube-down.sh' EXIT && \ + ${RUN_CMD} + " diff --git a/contrib/mesos/ci/run.sh b/contrib/mesos/ci/run.sh new file mode 100755 index 00000000000..cdcfc1a8743 --- /dev/null +++ b/contrib/mesos/ci/run.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# Copyright 2015 The Kubernetes Authors 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. + +# Runs the specified command in the test container (mesosphere/kubernetes-mesos-test). +# +# Prerequisite: +# ./cluster/mesos/docker/test/build.sh +# +# Example Usage: +# ./contrib/mesos/ci/run.sh make test + +set -o errexit +set -o nounset +set -o pipefail +set -o errtrace + +RUN_CMD="$@" +[ -z "${RUN_CMD:-}" ] && echo "No command supplied" && exit 1 + +KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE}")/../../.." && pwd) + +echo "Detecting docker client" +# Mount docker client binary to avoid client/compose/daemon version conflicts +if [ -n "${DOCKER_MACHINE_NAME:-}" ] && which docker-machine; then + # On a Mac with docker-machine, use the binary in the VM, not the host binary + DOCKER_BIN_PATH="$(docker-machine ssh "${DOCKER_MACHINE_NAME}" which docker)" +else + DOCKER_BIN_PATH="$(which docker)" +fi +echo "${DOCKER_BIN_PATH}" + +# Clean (k8s output & images) & Build +cd "${KUBE_ROOT}" +exec docker run \ + --rm \ + -v "${KUBE_ROOT}:/go/src/github.com/GoogleCloudPlatform/kubernetes" \ + -v "/var/run/docker.sock:/var/run/docker.sock" \ + -v "${DOCKER_BIN_PATH}:/usr/bin/docker" \ + -e "KUBERNETES_CONTRIB=mesos" \ + -e "TERM=ansi" \ + -e "USER=root" \ + mesosphere/kubernetes-mesos-test \ + -ceux "${RUN_CMD}" diff --git a/contrib/mesos/ci/test-e2e.sh b/contrib/mesos/ci/test-e2e.sh new file mode 100755 index 00000000000..d796a8816dd --- /dev/null +++ b/contrib/mesos/ci/test-e2e.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copyright 2015 The Kubernetes Authors 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. + +# Deploys a test cluster, runs the e2e tests, and destroys the test cluster. +# +# Prerequisite: +# ./cluster/mesos/docker/test/build.sh +# +# Example Usage: +# ./contrib/mesos/ci/test-e2e.sh -v=2 + +set -o errexit +set -o nounset +set -o pipefail +set -o errtrace + +TEST_ARGS="$@" + +KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE}")/../../.." && pwd) + +"${KUBE_ROOT}/contrib/mesos/ci/run-with-cluster.sh" ./cluster/test-e2e.sh ${TEST_ARGS} \ No newline at end of file diff --git a/contrib/mesos/ci/test-integration.sh b/contrib/mesos/ci/test-integration.sh new file mode 100755 index 00000000000..f9beaf11460 --- /dev/null +++ b/contrib/mesos/ci/test-integration.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copyright 2015 The Kubernetes Authors 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. + +# Cleans & runs the integration tests in the test container (mesosphere/kubernetes-mesos-test). +# +# Prerequisite: +# ./cluster/mesos/docker/test/build.sh +# +# Example Usage: +# ./contrib/mesos/ci/test-integration.sh + +set -o errexit +set -o nounset +set -o pipefail +set -o errtrace + +TEST_ARGS="$@" + +KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE}")/../../.." && pwd) + +"${KUBE_ROOT}/contrib/mesos/ci/run.sh" make clean test_integration ${TEST_ARGS} diff --git a/contrib/mesos/ci/test-smoke.sh b/contrib/mesos/ci/test-smoke.sh new file mode 100755 index 00000000000..79ba47390ce --- /dev/null +++ b/contrib/mesos/ci/test-smoke.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copyright 2015 The Kubernetes Authors 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. + +# Deploys a test cluster, runs the smoke tests, and destroys the test cluster. +# +# Prerequisite: +# ./cluster/mesos/docker/test/build.sh +# +# Example Usage: +# ./contrib/mesos/ci/test-smoke.sh -v=2 + +set -o errexit +set -o nounset +set -o pipefail +set -o errtrace + +TEST_ARGS="$@" + +KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE}")/../../.." && pwd) + +"${KUBE_ROOT}/contrib/mesos/ci/run-with-cluster.sh" ./cluster/test-smoke.sh ${TEST_ARGS} \ No newline at end of file diff --git a/contrib/mesos/ci/test-unit.sh b/contrib/mesos/ci/test-unit.sh new file mode 100755 index 00000000000..943026bfb49 --- /dev/null +++ b/contrib/mesos/ci/test-unit.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copyright 2015 The Kubernetes Authors 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. + +# Cleans & runs the unit tests in the test container (mesosphere/kubernetes-mesos-test). +# +# Prerequisite: +# ./cluster/mesos/docker/test/build.sh +# +# Example Usage: +# ./contrib/mesos/ci/test-unit.sh + +set -o errexit +set -o nounset +set -o pipefail +set -o errtrace + +TEST_ARGS="$@" + +KUBE_ROOT=$(cd "$(dirname "${BASH_SOURCE}")/../../.." && pwd) + +"${KUBE_ROOT}/contrib/mesos/ci/run.sh" make clean test ${TEST_ARGS}