Skip to content

Commit

Permalink
Merge 567cf17 into f62baf2
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongilanfarr committed Aug 11, 2016
2 parents f62baf2 + 567cf17 commit f0528cc
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 8 deletions.
43 changes: 43 additions & 0 deletions Dockerfile.build
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"]
25 changes: 25 additions & 0 deletions bin/build-base-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/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 test "$(docker images -q $TAGGED_IMAGE 2>/dev/null)" = ""; then
# try to pull, if that works, we're all set
docker login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_PASSWORD" -e "$DOCKER_HUB_PASSWORD" >&2 || true

if ! docker pull $TAGGED_IMAGE 1>&2; then
docker build -t $TAGGED_IMAGE -f Dockerfile.build . >&2
docker push $TAGGED_IMAGE >&2 || true
fi
echo "Pulled $TAGGED_IMAGE" >&2
else
echo "Already built $TAGGED_IMAGE" >&2
fi

echo $TAGGED_IMAGE
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import mesosphere.marathon.state.Container._
import mesosphere.marathon.state.PathId._
import mesosphere.marathon.state._
import org.apache.mesos.Protos.ContainerInfo.DockerInfo.Network
import org.scalatest.{BeforeAndAfterAll, Matchers, OptionValues}
import play.api.libs.json.{JsObject, Json}
import org.scalatest.{ BeforeAndAfterAll, Matchers, OptionValues }
import play.api.libs.json.{ JsObject, Json }

import scala.collection.immutable.Seq

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import mesosphere.marathon.state.AppDefinition.VersionInfo.FullVersionInfo
import mesosphere.marathon.state.PathId._
import mesosphere.marathon.state._
import mesosphere.marathon.test.Mockito
import org.apache.mesos.{Protos => mesos}
import org.scalatest.{GivenWhenThen, Matchers}
import org.apache.mesos.{ Protos => mesos }
import org.scalatest.{ GivenWhenThen, Matchers }

import scala.collection.immutable.Seq

Expand Down
36 changes: 32 additions & 4 deletions tests/integration/unit-integration-tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
#!/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)/../..)
mkdir -p $WORKSPACE/target-docker
TARGET=$WORKSPACE/target-docker
else
TARGET=$WORKSPACE/target
fi

TAGGED_IMAGE=$($WORKSPACE/bin/build-base-image.sh)

if [[ -z ${RUN_DOCKER_INTEGRATION_TESTS+x} ]]; then
if [[ -z ${DOCKER_MACHINE_NAME+x} ]]; then
RUN_DOCKER_INTEGRATION_TESTS="true"
else
RUN_DOCKER_INTEGRATION_TESTS="false"
fi
fi

export MARATHON_MAX_TASKS_PER_OFFER="${MARATHON_MAX_TASKS_PER_OFFER-1}"


DOCKER_OPTIONS="run --rm --name marathon-itests-$BUILD_ID --net host --privileged -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="sbt -Dsbt.log.format=false coverage doc test integration:test coverageReport coveralls mesos-simulation/integration:test mesos-simulation/test:runMain mesosphere.mesos.scale.DisplayAppScalingResults"

DOCKER_ARGS="$DOCKER_OPTIONS -c \"$DOCKER_CMD\""

echo "Running docker $DOCKER_ARGS"

docker $DOCKER_ARGS

0 comments on commit f0528cc

Please sign in to comment.