Repository: mesos
Updated Branches:
  refs/heads/1.3.x 522896273 -> 699f80dc3


Introduced `mesos-build` along with pre-built docker images.

The layout of `mesos-build` is similar to `mesos-tidy`.

The `mesos-build.sh` will be the user-facing driver, and `buildbot.sh`
invokes `mesos-build.sh` along with the clean-up (`docker rmi`) phase.
The `mesos-build` directory contains docker files and a common
`entrypoint.sh`. The docker images are built with all of the
dependencies required, and the various testing configurations are set
within `entrypoint.sh`.

Review: https://reviews.apache.org/r/65464


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/699f80dc
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/699f80dc
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/699f80dc

Branch: refs/heads/1.3.x
Commit: 699f80dc31d2ac1fe1ac8da3a751a761c85e679f
Parents: 5228962
Author: Michael Park <mp...@apache.org>
Authored: Thu Feb 1 11:14:28 2018 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Mon Feb 12 17:23:54 2018 -0800

----------------------------------------------------------------------
 support/jenkins/buildbot.sh                 |  8 ++-
 support/mesos-build.sh                      | 45 +++++++++++++
 support/mesos-build/centos-7.dockerfile     | 64 ++++++++++++++++++
 support/mesos-build/enable-devtoolset-4.sh  |  2 +
 support/mesos-build/entrypoint.sh           | 83 ++++++++++++++++++++++++
 support/mesos-build/ubuntu-16.04.dockerfile | 56 ++++++++++++++++
 6 files changed, 257 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/699f80dc/support/jenkins/buildbot.sh
----------------------------------------------------------------------
diff --git a/support/jenkins/buildbot.sh b/support/jenkins/buildbot.sh
index dab4b72..745e404 100755
--- a/support/jenkins/buildbot.sh
+++ b/support/jenkins/buildbot.sh
@@ -21,4 +21,10 @@ set -o pipefail
 
 MESOS_DIR=$(git rev-parse --show-toplevel)
 
-"${MESOS_DIR}"/support/docker-build.sh
+function remove_image {
+  docker rmi $(docker images -q mesos/mesos-build) || true
+}
+
+trap remove_image EXIT
+
+"${MESOS_DIR}"/support/mesos-build.sh

http://git-wip-us.apache.org/repos/asf/mesos/blob/699f80dc/support/mesos-build.sh
----------------------------------------------------------------------
diff --git a/support/mesos-build.sh b/support/mesos-build.sh
new file mode 100755
index 0000000..d146cc1
--- /dev/null
+++ b/support/mesos-build.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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 -o pipefail
+
+: "${OS:?"Environment variable 'OS' must be set"}"
+: "${BUILDTOOL:?"Environment variable 'BUILDTOOL' must be set"}"
+: "${COMPILER:?"Environment variable 'COMPILER' must be set"}"
+: "${CONFIGURATION:?"Environment variable 'CONFIGURATION' must be set"}"
+: "${ENVIRONMENT:?"Environment variable 'ENVIRONMENT' must be set"}"
+: "${JOBS:=$(nproc)}"
+
+MESOS_DIR=$(git rev-parse --show-toplevel)
+
+# Check for unstaged or uncommitted changes.
+if ! $(git diff-index --quiet HEAD --); then
+  echo 'Please commit or stash any changes before running `mesos-build`.'
+  exit 1
+fi
+
+docker run \
+  --rm \
+  -v "${MESOS_DIR}":/SRC:Z \
+  -e BUILDTOOL="${BUILDTOOL}" \
+  -e COMPILER="${COMPILER}" \
+  -e CONFIGURATION="${CONFIGURATION}" \
+  -e ENVIRONMENT="${ENVIRONMENT}" \
+  -e JOBS="${JOBS}" \
+  "mesos/mesos-build:${OS//:/-}"

http://git-wip-us.apache.org/repos/asf/mesos/blob/699f80dc/support/mesos-build/centos-7.dockerfile
----------------------------------------------------------------------
diff --git a/support/mesos-build/centos-7.dockerfile 
b/support/mesos-build/centos-7.dockerfile
new file mode 100644
index 0000000..acdb44d
--- /dev/null
+++ b/support/mesos-build/centos-7.dockerfile
@@ -0,0 +1,64 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+FROM centos:7
+
+# Add repo for newer Clang.
+# We don't use `llvm-toolset-7` due to a `devtoolset-7` bug that we run into
+# with CMake builds: https://bugzilla.redhat.com/show_bug.cgi?id=1519073
+RUN curl -sSL 
https://copr.fedorainfracloud.org/coprs/alonid/llvm-3.9.0/repo/epel-7/alonid-llvm-3.9.0-epel-7.repo
 \
+         -o /etc/yum.repos.d/llvm-3.9.0.repo
+
+# Install dependencies.
+RUN yum groupinstall -y 'Development Tools' && \
+    yum install -y centos-release-scl && \
+    yum install -y \
+      apr-devel \
+      apr-utils-devel \
+      clang-3.9.0 \
+      cyrus-sasl-devel \
+      cyrus-sasl-md5 \
+      devtoolset-4-gcc-c++ \
+      git \
+      java-1.8.0-openjdk-devel \
+      libcurl-devel \
+      libevent-devel \
+      libev-devel \
+      maven \
+      openssl-devel \
+      python-devel \
+      python-six \
+      subversion-devel \
+      which \
+      zlib-devel && \
+    yum clean all && \
+    rm -rf /var/cache/yum
+
+# Install newer CMake.
+RUN curl -sSL https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.sh \
+         -o /tmp/install-cmake.sh && \
+    sh /tmp/install-cmake.sh --skip-license --prefix=/usr/local && \
+    rm -f /tmp/install-cmake.sh
+
+ENV PATH /opt/llvm-3.9.0/bin:$PATH
+
+# Add an unprivileged user.
+RUN adduser mesos
+USER mesos
+
+COPY ["enable-devtoolset-4.sh", "/etc/profile.d"]
+COPY ["entrypoint.sh", "entrypoint.sh"]
+CMD ["bash", "-cl", "./entrypoint.sh"]

http://git-wip-us.apache.org/repos/asf/mesos/blob/699f80dc/support/mesos-build/enable-devtoolset-4.sh
----------------------------------------------------------------------
diff --git a/support/mesos-build/enable-devtoolset-4.sh 
b/support/mesos-build/enable-devtoolset-4.sh
new file mode 100755
index 0000000..c74bcde
--- /dev/null
+++ b/support/mesos-build/enable-devtoolset-4.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+source scl_source enable devtoolset-4

http://git-wip-us.apache.org/repos/asf/mesos/blob/699f80dc/support/mesos-build/entrypoint.sh
----------------------------------------------------------------------
diff --git a/support/mesos-build/entrypoint.sh 
b/support/mesos-build/entrypoint.sh
new file mode 100755
index 0000000..ec98cc8
--- /dev/null
+++ b/support/mesos-build/entrypoint.sh
@@ -0,0 +1,83 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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 -o pipefail
+
+SRCDIR=/tmp/SRC
+
+# Prepare sources
+git clone --depth 1 file:///SRC "${SRCDIR}"
+
+cd "${SRCDIR}"
+
+export GTEST_OUTPUT=xml:report.xml
+export DISTCHECK_CONFIGURE_FLAGS=${CONFIGURATION}
+export ${ENVIRONMENT}
+
+case ${COMPILER} in
+  gcc)
+    export CC=gcc
+    export CXX=g++
+    ;;
+  clang)
+    export CC=clang
+    export CXX=clang++
+    ;;
+  *)
+    echo "Unknown compiler ${COMPILER}"
+    exit 1
+    ;;
+esac
+
+case ${BUILDTOOL} in
+  autotools)
+    ./bootstrap
+    mkdir build && cd build
+    ../configure ${CONFIGURATION}
+    make -j "${JOBS}" distcheck 2>&1
+    ;;
+  cmake)
+    # Transform autotools-like parameters to cmake-like.
+    # Remove "'".
+    CONFIGURATION=${CONFIGURATION//\'/""}
+    # Replace "-" with "_".
+    CONFIGURATION=${CONFIGURATION//-/"_"}
+    # Replace "__" with "-D".
+    CONFIGURATION=${CONFIGURATION//__/"-D"}
+    # To Upper Case.
+    CONFIGURATION=${CONFIGURATION^^}
+
+    # Add "=1" suffix to each variable.
+    IFS=' ' read -r  -a array <<< "${CONFIGURATION}"
+
+    CONFIGURATION=""
+    for element in "${array[@]}"
+    do
+      CONFIGURATION="${CONFIGURATION} $element=1"
+    done
+
+    mkdir build && cd build
+    cmake ${CONFIGURATION} ..
+    make -j "${JOBS}" check 2>&1
+    ;;
+  *)
+    echo "Unknown build tool ${BUILDTOOL}"
+    exit 1
+    ;;
+esac

http://git-wip-us.apache.org/repos/asf/mesos/blob/699f80dc/support/mesos-build/ubuntu-16.04.dockerfile
----------------------------------------------------------------------
diff --git a/support/mesos-build/ubuntu-16.04.dockerfile 
b/support/mesos-build/ubuntu-16.04.dockerfile
new file mode 100644
index 0000000..0bbaa03
--- /dev/null
+++ b/support/mesos-build/ubuntu-16.04.dockerfile
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+FROM ubuntu:16.04
+
+# Install dependencies.
+RUN apt-get update && \
+    apt-get install -qy \
+      autoconf \
+      build-essential \
+      clang \
+      curl \
+      git \
+      iputils-ping \
+      libapr1-dev \
+      libcurl4-nss-dev \
+      libev-dev \
+      libevent-dev \
+      libsasl2-dev \
+      libssl-dev \
+      libsvn-dev \
+      libtool \
+      maven \
+      openjdk-8-jdk \
+      python-dev \
+      python-six \
+      sed \
+      zlib1g-dev && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists
+
+# Install newer CMake.
+RUN curl -sSL https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.sh \
+         -o /tmp/install-cmake.sh && \
+    sh /tmp/install-cmake.sh --skip-license --prefix=/usr/local && \
+    rm -f /tmp/install-cmake.sh
+
+# Add an unprivileged user.
+RUN adduser --disabled-password --gecos '' mesos
+USER mesos
+
+COPY ["entrypoint.sh", "entrypoint.sh"]
+CMD ["./entrypoint.sh"]

Reply via email to