Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: third_party/grpc/tools/jenkins/build_interop_stress_image.sh

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/bin/bash
2 # Copyright 2015-2016, Google Inc.
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
8 #
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
14 # distribution.
15 # * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #
31 # This script is invoked by run_interop_tests.py to build the docker image
32 # for interop testing. You should never need to call this script on your own.
33
34 set -x
35
36 # Params:
37 # INTEROP_IMAGE - name of tag of the final interop image
38 # INTEROP_IMAGE_TAG - Optional. If set, the created image will be tagged using
39 # the command: 'docker tag $INTEROP_IMAGE $INTEROP_IMAGE_REPOSITORY_TAG'
40 # BASE_NAME - base name used to locate the base Dockerfile and build script
41 # TTY_FLAG - optional -t flag to make docker allocate tty
42 # BUILD_INTEROP_DOCKER_EXTRA_ARGS - optional args to be passed to the
43 # docker run command
44
45 cd `dirname $0`/../..
46 GRPC_ROOT=`pwd`
47 MOUNT_ARGS="-v $GRPC_ROOT:/var/local/jenkins/grpc:ro"
48
49 mkdir -p /tmp/ccache
50
51 # Mount service account dir if available.
52 # If service_directory does not contain the service account JSON file,
53 # some of the tests will fail.
54 if [ -e $HOME/service_account ]
55 then
56 MOUNT_ARGS+=" -v $HOME/service_account:/var/local/jenkins/service_account:ro"
57 fi
58
59 # Use image name based on Dockerfile checksum
60 BASE_IMAGE=${BASE_NAME}_base:`sha1sum tools/dockerfile/$BASE_NAME/Dockerfile | c ut -f1 -d\ `
61
62 # Make sure base docker image has been built. Should be instantaneous if so.
63 docker build -t $BASE_IMAGE --force-rm=true tools/dockerfile/$BASE_NAME || exit $?
64
65 # Create a local branch so the child Docker script won't complain
66 git branch -f jenkins-docker
67
68 CONTAINER_NAME="build_${BASE_NAME}_$(uuidgen)"
69
70 # Prepare image for interop tests, commit it on success.
71 (docker run \
72 -e CCACHE_DIR=/tmp/ccache \
73 -e THIS_IS_REALLY_NEEDED='see https://github.com/docker/docker/issues/14203 fo r why docker is awful' \
74 -i $TTY_FLAG \
75 $MOUNT_ARGS \
76 $BUILD_INTEROP_DOCKER_EXTRA_ARGS \
77 -v /tmp/ccache:/tmp/ccache \
78 --name=$CONTAINER_NAME \
79 $BASE_IMAGE \
80 bash -l /var/local/jenkins/grpc/tools/dockerfile/$BASE_NAME/build_interop_stre ss.sh \
81 && docker commit $CONTAINER_NAME $INTEROP_IMAGE \
82 && ( if [ -n "$INTEROP_IMAGE_REPOSITORY_TAG" ]; then docker tag -f $INTEROP_IM AGE $INTEROP_IMAGE_REPOSITORY_TAG ; fi ) \
83 && echo "Successfully built image $INTEROP_IMAGE")
84 EXITCODE=$?
85
86 # remove intermediate container, possibly killing it first
87 docker rm -f $CONTAINER_NAME
88
89 exit $EXITCODE
OLDNEW
« no previous file with comments | « third_party/grpc/tools/jenkins/build_interop_image.sh ('k') | third_party/grpc/tools/jenkins/build_packages.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698