-
Notifications
You must be signed in to change notification settings - Fork 847
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run Integration tests in velocity (#4204)
* Run Integration Tests in Velocity - Build a base image (conditionally) if the build itself changed. This image already has SBT and all of the build dependencies downloaded. If possible, it will push/pull from dockerhub. - Then run this with the jenkins workspace volume mounted and run all of the integration tests, etc. We may want to consider assembly as well. - Disable docker integration tests in Velocity - Change build status to velocity instead of Travis - Disable the flakey tests - Run a forked JVM for every integration test. - Move more tools to use ephemeral ports.
- Loading branch information
1 parent
f62baf2
commit 7a560a2
Showing
15 changed files
with
178 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# Base docker image used to build inside of a CI environment. | ||
# This should be updated and pushed with bin/update-base-build.sh | ||
# when we change the SBT version, mesos lib, or dependencies | ||
# | ||
# While it is not absolutely necessary (with the exception of the | ||
# mesos lib), it will significantly speedup the build. | ||
# | ||
# We install docker 1.11.0 to /usr/bin - it likely should be overridden by | ||
# the user's docker so that the versions match | ||
# | ||
# CI Builds should base their build off of this image which is tagged | ||
# carefully | ||
|
||
FROM java:8-jdk | ||
|
||
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E56151BF && \ | ||
echo "deb http://repos.mesosphere.com/debian jessie-testing main" | tee /etc/apt/sources.list.d/mesosphere.list && \ | ||
echo "deb http://repos.mesosphere.com/debian jessie main" | tee -a /etc/apt/sources.list.d/mesosphere.list && \ | ||
apt-get update && \ | ||
apt-get install --no-install-recommends -y --force-yes mesos=1.0.0-2.0.89.debian81 && \ | ||
curl -o /tmp/docker.tgz https://get.docker.com/builds/Linux/x86_64/docker-1.11.0.tgz && \ | ||
cd /tmp && \ | ||
tar zxf docker.tgz && \ | ||
mv docker/docker /usr/bin/docker && \ | ||
chmod +x /usr/bin/docker | ||
|
||
COPY . /marathon | ||
RUN rm -rf /marathon/project/project/target && \ | ||
rm -rf /marathon/project/target && \ | ||
eval $(sed s/sbt.version/SBT_VERSION/ < /marathon/project/build.properties) && \ | ||
mkdir -p /usr/local/bin && \ | ||
wget -P /usr/local/bin/ https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/$SBT_VERSION/sbt-launch.jar && \ | ||
cp /marathon/project/sbt /usr/local/bin && \ | ||
chmod +x /usr/local/bin/sbt | ||
|
||
RUN cd /marathon && \ | ||
sbt -Dsbt.log.format=false update && \ | ||
rm -rf /marathon/* | ||
|
||
WORKDIR /marathon | ||
|
||
ENTRYPOINT ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cd $(dirname $0)/.. | ||
|
||
BASE_IMAGE_NAME=mesosphere/marathon-build-base | ||
BUILD_BASE_ID=$(md5sum Dockerfile.build *.sbt project/*.properties project/*.sbt project/*.scala | md5sum - | cut -f 1 -d ' ') | ||
TAGGED_IMAGE=$BASE_IMAGE_NAME:$BUILD_BASE_ID | ||
|
||
# Check if we need to build the base image | ||
if [[ "$(docker images -q $TAGGED_IMAGE 2>/dev/null)" = "" ]]; then | ||
# try to pull, if that works, we're all set | ||
if [[ "$DOCKER_HUB_USERNAME" != "" ]]; then | ||
docker login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_PASSWORD" -e "$DOCKER_HUB_PASSWORD" >&2 2>/dev/null || true | ||
fi | ||
if ! docker pull $TAGGED_IMAGE 1>&2; then | ||
docker build -t $TAGGED_IMAGE -f Dockerfile.build . >&2 | ||
if [[ "$DOCKER_HUB_USERNAME" != "" ]]; then | ||
docker push $TAGGED_IMAGE >&2 || true | ||
fi | ||
fi | ||
echo "Pulled $TAGGED_IMAGE" >&2 | ||
fi | ||
|
||
echo $TAGGED_IMAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 39 additions & 4 deletions
43
tests/integration/unit-integration-tests.sh
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,40 @@ | ||
#!/bin/bash | ||
set -v | ||
mkdir -p $HOME/.sbt/launchers/0.13.8/ | ||
test -r $HOME/.sbt/launchers/0.13.8/sbt-launch.jar || curl -L -o $HOME/.sbt/launchers/0.13.8/sbt-launch.jar http://dl.bintray.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.8/sbt-launch.jar | ||
java -Dfile.encoding=utf-8 -jar $HOME/.sbt/launchers/0.13.8/sbt-launch.jar -Dsbt.log.noformat=true "; clean; coverage; doc; assembly; coverageReport; coveralls" | ||
set -e | ||
|
||
if [[ -z $WORKSPACE ]]; then | ||
WORKSPACE=$(realpath $(dirname $0)/../..) | ||
TARGETS_DIR=$WORKSPACE/targets-docker | ||
else | ||
TARGET=$WORKSPACE/target | ||
fi | ||
|
||
export DOCKER_HUB_USERNAME | ||
export DOCKER_HUB_PASSWORD | ||
export DOCKER_HUB_EMAIL | ||
TAGGED_IMAGE=$($WORKSPACE/bin/build-base-image.sh) | ||
|
||
if [[ -z ${RUN_DOCKER_INTEGRATION_TESTS+x} ]]; then | ||
if [[ -n "$JENKINS_HOME" ]]; then | ||
# velocity can't run these tests (docker in docker in docker) | ||
RUN_DOCKER_INTEGRATION_TESTS="false" | ||
else | ||
if [[ -z ${DOCKER_MACHINE_NAME+x} ]]; then | ||
RUN_DOCKER_INTEGRATION_TESTS="true" | ||
else | ||
RUN_DOCKER_INTEGRATION_TESTS="false" | ||
fi | ||
fi | ||
fi | ||
|
||
export MARATHON_MAX_TASKS_PER_OFFER="${MARATHON_MAX_TASKS_PER_OFFER-1}" | ||
|
||
|
||
DOCKER_OPTIONS="run --entrypoint=/bin/bash --rm --name marathon-itests-$BUILD_ID --net host --privileged -e TARGETS_DIR=$TARGETS_DIR -e RUN_DOCKER_INTEGRATION_TESTS=$RUN_DOCKER_INTEGRATION_TESTS -e MARATHON_MAX_TASKS_PER_OFFER=$MARATHON_MAX_TASKS_PER_OFFER -v $WORKSPACE:/marathon -v $TARGET:/marathon/target -v /var/run/docker.sock:/var/run/docker.sock -v /etc/hosts:/etc/hosts -i" | ||
|
||
DOCKER_CMD="/usr/local/bin/sbt -Dsbt.log.format=false coverage doc test integration:test coverageReport coveralls mesos-simulation/integration:test" | ||
|
||
DOCKER_ARGS="$DOCKER_OPTIONS $TAGGED_IMAGE $DOCKER_CMD" | ||
|
||
echo "Running docker $DOCKER_ARGS" | ||
|
||
docker $DOCKER_ARGS 2>&1 |