Skip to content
Snippets Groups Projects
Commit 22b28264 authored by Jan Tattermusch's avatar Jan Tattermusch Committed by GitHub
Browse files

Merge pull request #9178 from jtattermusch/docker_inception_is_evil

Cleanup and speedup sanity tests
parents 4118da2c 7dd2cc6f
No related branches found
No related tags found
No related merge requests found
RUN apt-get update && apt-get -y install wget
RUN echo deb http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list
RUN echo deb-src http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list
RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key| apt-key add -
RUN apt-get update && apt-get -y install clang-format-3.8
%YAML 1.2
--- |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FROM ubuntu:15.10
<%include file="../clang_format.include"/>
ADD clang_format_all_the_things.sh /
CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"]
...@@ -52,18 +52,12 @@ ...@@ -52,18 +52,12 @@
# ./compile.sh without a local protoc dependency # ./compile.sh without a local protoc dependency
# TODO(mattkwong): install dependencies to support latest Bazel version if newer # TODO(mattkwong): install dependencies to support latest Bazel version if newer
# version is needed # version is needed
RUN git clone https://github.com/bazelbuild/bazel.git /bazel && \ RUN git clone https://github.com/bazelbuild/bazel.git /bazel && ${"\\"}
cd /bazel && git checkout tags/0.4.1 && ./compile.sh cd /bazel && git checkout tags/0.4.1 && ./compile.sh
RUN ln -s /bazel/output/bazel /bin/ RUN ln -s /bazel/output/bazel /bin/
#=================== <%include file="../../clang_format.include"/>
# Docker "inception" <%include file="../../run_tests_addons.include"/>
# Note this is quite the ugly hack.
# This makes sure that the docker binary we inject has its dependencies.
RUN curl https://get.docker.com/ | sh
RUN apt-get remove --purge -y docker-engine
RUN mkdir /var/local/jenkins
# Define the default command. # Define the default command.
CMD ["bash"] CMD ["bash"]
......
...@@ -37,7 +37,7 @@ readonly PROTOBUF_INSTALL_PREFIX="$(mktemp -d)" ...@@ -37,7 +37,7 @@ readonly PROTOBUF_INSTALL_PREFIX="$(mktemp -d)"
pushd third_party/protobuf pushd third_party/protobuf
./autogen.sh ./autogen.sh
./configure --prefix="$PROTOBUF_INSTALL_PREFIX" ./configure --prefix="$PROTOBUF_INSTALL_PREFIX"
make make -j 8
make install make install
#ldconfig #ldconfig
popd popd
...@@ -51,7 +51,7 @@ fi ...@@ -51,7 +51,7 @@ fi
# stack up and change to nanopb's proto generator directory # stack up and change to nanopb's proto generator directory
pushd third_party/nanopb/generator/proto pushd third_party/nanopb/generator/proto
export PATH="$PROTOC_BIN_PATH:$PATH" export PATH="$PROTOC_BIN_PATH:$PATH"
make make -j 8
# back to the root directory # back to the root directory
popd popd
......
...@@ -32,9 +32,15 @@ set -ex ...@@ -32,9 +32,15 @@ set -ex
# change to root directory # change to root directory
cd $(dirname $0)/../.. cd $(dirname $0)/../..
REPO_ROOT=$(pwd)
# build clang-format docker image if [ "$CLANG_FORMAT_SKIP_DOCKER" == "" ]
docker build -t grpc_clang_format tools/dockerfile/grpc_clang_format then
# build clang-format docker image
docker build -t grpc_clang_format tools/dockerfile/grpc_clang_format
# run clang-format against the checked out codebase # run clang-format against the checked out codebase
docker run -e TEST=$TEST -e CHANGED_FILES="$CHANGED_FILES" --rm=true -v ${HOST_GIT_ROOT:-`pwd`}:/local-code -t grpc_clang_format /clang_format_all_the_things.sh docker run -e TEST=$TEST -e CHANGED_FILES="$CHANGED_FILES" -e CLANG_FORMAT_ROOT="/local-code" --rm=true -v "${REPO_ROOT}":/local-code -t grpc_clang_format /clang_format_all_the_things.sh
else
CLANG_FORMAT_ROOT="${REPO_ROOT}" tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
fi
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FROM ubuntu:wily FROM ubuntu:15.10
RUN apt-get update
RUN apt-get -y install wget RUN apt-get update && apt-get -y install wget
RUN echo deb http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list RUN echo deb http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list
RUN echo deb-src http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list RUN echo deb-src http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list
RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key| apt-key add - RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key| apt-key add -
RUN apt-get update RUN apt-get update && apt-get -y install clang-format-3.8
RUN apt-get -y install clang-format-3.8
ADD clang_format_all_the_things.sh / ADD clang_format_all_the_things.sh /
CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"] CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"]
...@@ -44,7 +44,7 @@ for dir in $DIRS ...@@ -44,7 +44,7 @@ for dir in $DIRS
do do
for glob in $GLOB for glob in $GLOB
do do
files="$files `find /local-code/$dir -name $glob -and -not -name *.generated.* -and -not -name *.pb.h -and -not -name *.pb.c -and -not -name *.pb.cc`" files="$files `find ${CLANG_FORMAT_ROOT}/$dir -name $glob -and -not -name *.generated.* -and -not -name *.pb.h -and -not -name *.pb.c -and -not -name *.pb.cc`"
done done
done done
...@@ -54,7 +54,7 @@ if [ -n "$CHANGED_FILES" ]; then ...@@ -54,7 +54,7 @@ if [ -n "$CHANGED_FILES" ]; then
files=$(comm -12 <(echo $files | tr ' ' '\n' | sort -u) <(echo $CHANGED_FILES | tr ' ' '\n' | sort -u)) files=$(comm -12 <(echo $files | tr ' ' '\n' | sort -u) <(echo $CHANGED_FILES | tr ' ' '\n' | sort -u))
fi fi
if [ "x$TEST" = "x" ] if [ "$TEST" == "" ]
then then
echo $files | xargs $CLANG_FORMAT -i echo $files | xargs $CLANG_FORMAT -i
else else
......
...@@ -97,17 +97,27 @@ RUN apt-get install -y openjdk-8-jdk ...@@ -97,17 +97,27 @@ RUN apt-get install -y openjdk-8-jdk
# ./compile.sh without a local protoc dependency # ./compile.sh without a local protoc dependency
# TODO(mattkwong): install dependencies to support latest Bazel version if newer # TODO(mattkwong): install dependencies to support latest Bazel version if newer
# version is needed # version is needed
RUN git clone https://github.com/bazelbuild/bazel.git /bazel && cd /bazel && git checkout tags/0.4.1 && ./compile.sh RUN git clone https://github.com/bazelbuild/bazel.git /bazel && \
cd /bazel && git checkout tags/0.4.1 && ./compile.sh
RUN ln -s /bazel/output/bazel /bin/ RUN ln -s /bazel/output/bazel /bin/
#=================== RUN apt-get update && apt-get -y install wget
# Docker "inception" RUN echo deb http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list
# Note this is quite the ugly hack. RUN echo deb-src http://llvm.org/apt/wily/ llvm-toolchain-wily-3.8 main >> /etc/apt/sources.list
# This makes sure that the docker binary we inject has its dependencies. RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key| apt-key add -
RUN curl https://get.docker.com/ | sh RUN apt-get update && apt-get -y install clang-format-3.8
RUN apt-get remove --purge -y docker-engine
# Prepare ccache
RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
RUN ln -s /usr/bin/ccache /usr/local/bin/g++
RUN ln -s /usr/bin/ccache /usr/local/bin/cc
RUN ln -s /usr/bin/ccache /usr/local/bin/c++
RUN ln -s /usr/bin/ccache /usr/local/bin/clang
RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
RUN mkdir /var/local/jenkins RUN mkdir /var/local/jenkins
# Define the default command. # Define the default command.
CMD ["bash"] CMD ["bash"]
...@@ -77,8 +77,6 @@ docker run \ ...@@ -77,8 +77,6 @@ docker run \
-v /tmp/ccache:/tmp/ccache \ -v /tmp/ccache:/tmp/ccache \
-v /tmp/npm-cache:/tmp/npm-cache \ -v /tmp/npm-cache:/tmp/npm-cache \
-v /tmp/xdg-cache-home:/tmp/xdg-cache-home \ -v /tmp/xdg-cache-home:/tmp/xdg-cache-home \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/bin/docker \
-w /var/local/git/grpc \ -w /var/local/git/grpc \
--name=$CONTAINER_NAME \ --name=$CONTAINER_NAME \
$DOCKER_IMAGE_NAME \ $DOCKER_IMAGE_NAME \
......
...@@ -820,8 +820,12 @@ class Sanity(object): ...@@ -820,8 +820,12 @@ class Sanity(object):
def test_specs(self): def test_specs(self):
import yaml import yaml
with open('tools/run_tests/sanity/sanity_tests.yaml', 'r') as f: with open('tools/run_tests/sanity/sanity_tests.yaml', 'r') as f:
environ={'TEST': 'true'}
if _is_use_docker_child():
environ['CLANG_FORMAT_SKIP_DOCKER'] = 'true'
return [self.config.job_spec(cmd['script'].split(), return [self.config.job_spec(cmd['script'].split(),
timeout_seconds=30*60, environ={'TEST': 'true'}, timeout_seconds=30*60,
environ=environ,
cpu_cost=cmd.get('cpu_cost', 1)) cpu_cost=cmd.get('cpu_cost', 1))
for cmd in yaml.load(f)] for cmd in yaml.load(f)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment