diff options
author | Nicolas Noble <nicolasnoble@users.noreply.github.com> | 2015-10-16 14:27:55 -0700 |
---|---|---|
committer | Nicolas Noble <nicolasnoble@users.noreply.github.com> | 2015-10-16 14:27:55 -0700 |
commit | 921149c43ac7b797ef69402411ea6d9064e303b5 (patch) | |
tree | 754ca32ec2970be91ef12a2b19d9f64431013c76 /tools | |
parent | cedc1017715c6f2ddbe15f853bab2dcafef14504 (diff) | |
parent | 3ee9d48f2ab1b640a735d30823412f8756fae772 (diff) |
Merge pull request #3857 from jtattermusch/cleanup_old_interop
cleanup dockerfiles and scripts for old interop infrastructure
Diffstat (limited to 'tools')
48 files changed, 0 insertions, 4756 deletions
diff --git a/tools/README.md b/tools/README.md index be7d84b373..eb6633a866 100644 --- a/tools/README.md +++ b/tools/README.md @@ -8,8 +8,6 @@ dockerfile: Docker files to test gRPC. doxygen: gRPC C/C++ documentation generation via Doxygen. -gce_setup: boilerplate to run the Docker files under GCE. - jenkins: support for running tests on Jenkins. profile_analyzer: pretty printer for gRPC profiling data. diff --git a/tools/dockerfile/grpc_csharp_mono/Dockerfile b/tools/dockerfile/grpc_csharp_mono/Dockerfile deleted file mode 100644 index 703b658a23..0000000000 --- a/tools/dockerfile/grpc_csharp_mono/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# 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. - -# Dockerfile for gRPC C# (on Mono). -FROM grpc/csharp_mono_base - -# Pull the latest sources -RUN cd /var/local/git/grpc \ - && git pull --recurse-submodules \ - && git submodule update --init --recursive - -# Install the gRPC C# extension library -RUN make install_grpc_csharp_ext -j12 -C /var/local/git/grpc - -# Restore the NuGet dependencies -RUN cd /var/local/git/grpc/src/csharp && mono /var/local/NuGet.exe restore Grpc.sln - -# Build gRPC solution -RUN cd /var/local/git/grpc/src/csharp && xbuild Grpc.sln - -# Add a cacerts directory containing the Google root pem file, allowing the -# ruby client to access the production test instance -ADD cacerts cacerts - -# Add a service_account directory containing the auth creds file -ADD service_account service_account - -# Run the C# Interop Server -CMD ["/bin/bash", "-l", "-c", "cd /var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.Server/bin/Debug && mono Grpc.IntegrationTesting.Server.exe --use_tls=true --port=8070"] diff --git a/tools/dockerfile/grpc_csharp_mono/build.sh b/tools/dockerfile/grpc_csharp_mono/build.sh deleted file mode 100755 index a7737d752e..0000000000 --- a/tools/dockerfile/grpc_csharp_mono/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -cp -R /var/local/git-clone/grpc /var/local/git - -make install_grpc_csharp_ext -j12 -C /var/local/git/grpc - -cd /var/local/git/grpc/src/csharp && mono /var/local/NuGet.exe restore Grpc.sln - -cd /var/local/git/grpc/src/csharp && xbuild Grpc.sln - diff --git a/tools/dockerfile/grpc_csharp_mono_base/Dockerfile b/tools/dockerfile/grpc_csharp_mono_base/Dockerfile deleted file mode 100644 index 88766a4545..0000000000 --- a/tools/dockerfile/grpc_csharp_mono_base/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# 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. - -# Base Dockerfile for gRPC C# (on Mono). -# -# Includes gRPC C# installation dependencies, things that are unlikely to vary. -FROM grpc/base - -# Update to a newer version of mono -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list - -# Install dependencies -RUN apt-get update && apt-get install -y \ - mono-devel \ - nunit \ - nunit-console \ - monodevelop - -# Download NuGet -RUN cd /var/local && wget www.nuget.org/NuGet.exe - -# Get the source from GitHub -RUN git clone git@github.com:grpc/grpc.git /var/local/git/grpc -RUN cd /var/local/git/grpc && \ - git pull --recurse-submodules && \ - git submodule update --init --recursive - -# Define the default command. -CMD ["bash","-l"] diff --git a/tools/dockerfile/grpc_cxx/Dockerfile b/tools/dockerfile/grpc_cxx/Dockerfile deleted file mode 100644 index 82887df95c..0000000000 --- a/tools/dockerfile/grpc_cxx/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -# 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. - -# Dockerfile for gRPC C++ -FROM grpc/base - -RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev - -# Get the source from GitHub -RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc -RUN cd /var/local/git/grpc && \ - git pull --recurse-submodules && \ - git submodule update --init --recursive - -# Build the protobuf library; then the C core. -RUN cd /var/local/git/grpc/third_party/protobuf && \ - ./autogen.sh && \ - ./configure --prefix=/usr && \ - make -j12 && make check && make install && make clean - -RUN cd /var/local/git/grpc && ls \ - && make clean \ - && make gens/test/cpp/util/messages.pb.cc \ - && make interop_client \ - && make interop_server - -ADD service_account service_account -ADD cacerts cacerts -ENV GRPC_DEFAULT_SSL_ROOTS_FILE_PATH /cacerts/roots.pem - -CMD ["/var/local/git/grpc/bins/opt/interop_server", "--use_tls", "--port=8010"] diff --git a/tools/dockerfile/grpc_cxx/build.sh b/tools/dockerfile/grpc_cxx/build.sh deleted file mode 100755 index 8df3f15412..0000000000 --- a/tools/dockerfile/grpc_cxx/build.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# 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. -rm -rf /var/local/git -cp -R /var/local/git-clone /var/local/git - -cd /var/local/git/grpc/third_party/protobuf && \ - ./autogen.sh && \ - ./configure --prefix=/usr && \ - make -j12 && make check && make install && make clean - -cd /var/local/git/grpc && ls \ - && make clean \ - && make gens/test/cpp/util/messages.pb.cc \ - && make interop_client \ - && make interop_server diff --git a/tools/dockerfile/grpc_go/Dockerfile b/tools/dockerfile/grpc_go/Dockerfile deleted file mode 100644 index 7f3bd8719c..0000000000 --- a/tools/dockerfile/grpc_go/Dockerfile +++ /dev/null @@ -1,46 +0,0 @@ -# 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. - -# Dockerfile for gRPC Go -FROM golang:1.4 - -# Get the source from GitHub -RUN go get google.golang.org/grpc -RUN go get golang.org/x/oauth2 -RUN go get google.golang.org/cloud - -# Add a service_account directory containing the auth creds file -ADD service_account service_account - -# Build the interop client and server -RUN cd src/google.golang.org/grpc/interop/client && go install -RUN cd src/google.golang.org/grpc/interop/server && go install - -# Specify the default command such that the interop server runs on its known testing port -CMD ["/bin/bash", "-c", "cd src/google.golang.org/grpc/interop/server && go run server.go --use_tls=true --port=8020"] diff --git a/tools/dockerfile/grpc_go/README.md b/tools/dockerfile/grpc_go/README.md deleted file mode 100644 index 0d6ad3e391..0000000000 --- a/tools/dockerfile/grpc_go/README.md +++ /dev/null @@ -1,4 +0,0 @@ -GRPC Go Dockerfile -================== - -Dockerfile for gRPC Go development, testing and deployment. diff --git a/tools/dockerfile/grpc_go/build.sh b/tools/dockerfile/grpc_go/build.sh deleted file mode 100755 index 254942fe01..0000000000 --- a/tools/dockerfile/grpc_go/build.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# 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. - -cp -R /var/local/git-clone/grpc-go/. /go/ -go get golang.org/x/oauth2 -go get google.golang.org/cloud -cd src/google.golang.org/grpc/interop/client && go install diff --git a/tools/dockerfile/grpc_java/Dockerfile b/tools/dockerfile/grpc_java/Dockerfile deleted file mode 100644 index 7b1fe56358..0000000000 --- a/tools/dockerfile/grpc_java/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -# 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. - -# Dockerfile for the gRPC Java dev image -FROM grpc/java_base - -RUN git clone --recursive --depth 1 https://github.com/grpc/grpc-java.git /var/local/git/grpc-java && \ - cd /var/local/git/grpc-java && \ - ./gradlew :grpc-interop-testing:installDist -PskipCodegen=true - -# Add a service_account directory containing the auth creds file -ADD service_account service_account - -# Specify the default command such that the interop server runs on its known testing port -CMD ["/var/local/git/grpc-java/run-test-server.sh", "--use_tls=true", "--port=8030"] diff --git a/tools/dockerfile/grpc_java/README.md b/tools/dockerfile/grpc_java/README.md deleted file mode 100644 index 808f0fc5f3..0000000000 --- a/tools/dockerfile/grpc_java/README.md +++ /dev/null @@ -1,9 +0,0 @@ -GRPC Java Dockerfile -==================== - -Dockerfile for creating the Java development image - -As of 2014/12 this - - is based on the gRPC Java base - - pulls from gRPC Java on GitHub - - installs it and runs the tests
\ No newline at end of file diff --git a/tools/dockerfile/grpc_java/build.sh b/tools/dockerfile/grpc_java/build.sh deleted file mode 100755 index e55f2e0f47..0000000000 --- a/tools/dockerfile/grpc_java/build.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# 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. -rm -rf /var/local/git -cp -R /var/local/git-clone /var/local/git -cd /var/local/git/grpc-java/lib/netty && \ - mvn -pl codec-http2 -am -DskipTests install clean -cd /var/local/git/grpc-java && \ - ./gradlew build installDist - -echo 'build finished' diff --git a/tools/dockerfile/grpc_java_android/Dockerfile b/tools/dockerfile/grpc_java_android/Dockerfile deleted file mode 100644 index 8df0707758..0000000000 --- a/tools/dockerfile/grpc_java_android/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -# 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. - -# Dockerfile for the gRPC Java dev image -FROM grpc/java_base - -# Required by accessing Android's aapt -RUN apt-get install -y lib32stdc++6 lib32z1 && apt-get clean - -# Install Android SDK 24.2 -RUN curl -L http://dl.google.com/android/android-sdk_r24.2-linux.tgz | tar xz -C /usr/local - -# Environment variables -ENV ANDROID_HOME /usr/local/android-sdk-linux -ENV PATH $PATH:$ANDROID_HOME/tools -ENV PATH $PATH:$ANDROID_HOME/platform-tools -# Some old Docker versions consider '/' as HOME -ENV HOME /root - -# Update sdk for android API level 19 (4.4), 21 (5.0), 22 (5.1). -RUN echo y | android update sdk --all --filter platform-tools,build-tools-22.0.1,sys-img-armeabi-v7a-addon-google_apis-google-22,sys-img-armeabi-v7a-addon-google_apis-google-21,sys-img-armeabi-v7a-android-19,android-22,android-21,android-19,addon-google_apis-google-22,addon-google_apis-google-21,addon-google_apis-google-19,extra-android-m2repository,extra-google-m2repository --no-ui --force - - -# Create AVDs with API level 19,21,22 -RUN echo no | android create avd --force -n avd-google-api-22 -t "Google Inc.:Google APIs:22" --abi google_apis/armeabi-v7a && \ - echo no | android create avd --force -n avd-google-api-21 -t "Google Inc.:Google APIs:21" --abi google_apis/armeabi-v7a && \ - echo no | android create avd --force -n avd-google-api-19 -t "Google Inc.:Google APIs:19" --abi default/armeabi-v7a - -# Pull gRPC Java and trigger download of needed Maven and Gradle artifacts. -RUN git clone --depth 1 https://github.com/grpc/grpc-java.git /var/local/git/grpc-java && \ - cd /var/local/git/grpc-java && \ - ./gradlew grpc-core:install grpc-stub:install grpc-okhttp:install grpc-protobuf-nano:install grpc-compiler:install - -# Config android sdk for gradle and build apk to trigger download of needed Maven and Gradle artifacts. -RUN cd /var/local/git/grpc-java/android-interop-testing && echo "sdk.dir=/usr/local/android-sdk-linux" > local.properties && \ - ../gradlew assembleDebug diff --git a/tools/dockerfile/grpc_java_android/README.md b/tools/dockerfile/grpc_java_android/README.md deleted file mode 100644 index 5c897cd779..0000000000 --- a/tools/dockerfile/grpc_java_android/README.md +++ /dev/null @@ -1,42 +0,0 @@ -GRPC Android Dockerfile -==================== - -Dockerfile for creating the gRPC Android integration test image - -As of 2015/05 this - - is based on the gRPC Java base - - installs Android sdk 24.2 - - creates an AVD for API level 22 - - Pulls gRpc Android test App from github - -Usage ------ - -Start the emulator in a detached container, the argument is the name of the AVD you want to start: - -``` -$ sudo docker run --name=grpc_android_test -d grpc/android /var/local/git/grpc-java/android-interop-testing/start-emulator.sh avd-google-api-22 -``` - -You can use the following cammand to wait until the emulator is ready: -``` -$ sudo docker exec grpc_android_test /var/local/git/grpc-java/android-interop-testing/wait-for-emulator.sh -``` - -When you want to update the apk, run: -``` -$ sudo docker exec grpc_android_test bash -c "cd /var/local/git/grpc-java && git pull origin master && ./gradlew grpc-core:install grpc-stub:install grpc-okhttp:install grpc-protobuf-nano:install grpc-compiler:install && cd android-interop-testing && ../gradlew installDebug" -``` -It pulls the fresh code of gRpc Java and our interop test app from github, build and install it to the runing emulator (so you need to make sure there is a runing emulator). - -Trigger the integration test: -``` -$ sudo docker exec grpc_android_test adb -e shell am instrument -w -e server_host <hostname or ip address> -e server_port 8030 -e server_host_override foo.test.google.fr -e use_tls true -e use_test_ca true -e test_case all io.grpc.android.integrationtest/.TesterInstrumentation -``` - -You can also use the android/adb cammands to get more info, such as: -``` -$ sudo docker exec grpc_android_test android list avd -$ sudo docker exec grpc_android_test adb devices -$ sudo docker exec grpc_android_test adb logcat -``` diff --git a/tools/dockerfile/grpc_java_base/Dockerfile b/tools/dockerfile/grpc_java_base/Dockerfile deleted file mode 100644 index 9b80bbf9bc..0000000000 --- a/tools/dockerfile/grpc_java_base/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# 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 debian:latest - -# Install JDK 8 and Git -# -# TODO(temiola): simplify this if/when a simpler process is available. -# -RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \ - echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && \ - echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && \ - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 && \ - apt-get update && \ - apt-get -y install \ - git \ - libapr1 \ - oracle-java8-installer \ - && \ - apt-get clean && rm -r /var/cache/oracle-jdk8-installer/ - -ENV JAVA_HOME /usr/lib/jvm/java-8-oracle -ENV PATH $PATH:$JAVA_HOME/bin - -# Trigger download of as many Gradle artifacts as possible. -RUN git clone --recursive --depth 1 https://github.com/grpc/grpc-java.git && \ - cd grpc-java && \ - ./gradlew build -PskipCodegen=true && \ - rm -r "$(pwd)" diff --git a/tools/dockerfile/grpc_java_base/README.md b/tools/dockerfile/grpc_java_base/README.md deleted file mode 100644 index 446287fc7c..0000000000 --- a/tools/dockerfile/grpc_java_base/README.md +++ /dev/null @@ -1,9 +0,0 @@ -GRPC Java Base Dockerfile -========================= - -Dockerfile for creating the Java gRPC development Docker instance. - -As of 2014/12 this - - installs tools and dependencies needed to build gRPC Java - - does not install gRPC Java itself; a separate Dockerfile that depends on - this one will do that.
\ No newline at end of file diff --git a/tools/dockerfile/grpc_node/Dockerfile b/tools/dockerfile/grpc_node/Dockerfile deleted file mode 100644 index dcd9197845..0000000000 --- a/tools/dockerfile/grpc_node/Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -# 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. - -# Dockerfile for gRPC Node -FROM grpc/node_base - -# Pull the latest sources -RUN cd /var/local/git/grpc \ - && git pull --recurse-submodules \ - && git submodule update --init --recursive - -# Prevent breaking the build if header files are added/removed. -RUN make clean -C /var/local/git/grpc - -# Install the C core. -RUN make install_c -j12 -C /var/local/git/grpc - -RUN cd /var/local/git/grpc/src/node && npm install && node-gyp rebuild - -# Add a cacerts directory containing the Google root pem file, allowing the -# ruby client to access the production test instance -ADD cacerts cacerts - -# Add a service_account directory containing the auth creds file -ADD service_account service_account - -CMD ["/usr/bin/nodejs", "/var/local/git/grpc/src/node/interop/interop_server.js", "--use_tls=true", "--port=8040"] diff --git a/tools/dockerfile/grpc_node/build.sh b/tools/dockerfile/grpc_node/build.sh deleted file mode 100755 index be89cc1fcf..0000000000 --- a/tools/dockerfile/grpc_node/build.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# 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. -cp -R /var/local/git-clone/grpc /var/local/git - -make clean -C /var/local/git/grpc - -make install_c -j12 -C /var/local/git/grpc - -cd /var/local/git/grpc/src/node && npm install && node-gyp rebuild diff --git a/tools/dockerfile/grpc_node_base/Dockerfile b/tools/dockerfile/grpc_node_base/Dockerfile deleted file mode 100644 index 1f3a2362e9..0000000000 --- a/tools/dockerfile/grpc_node_base/Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -# 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. - -# Base Dockerfile for gRPC Node. -# -# Includes Node installation dependencies -FROM grpc/base - -RUN curl -sL https://deb.nodesource.com/setup | bash - - -RUN apt-get update && apt-get install -y nodejs nodejs-legacy - -RUN npm install -g node-gyp - -# Get the source from GitHub, this gets the protobuf library as well -RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc -RUN cd /var/local/git/grpc && \ - git pull --recurse-submodules && \ - git submodule update --init --recursive - -# TODO: pre-building seems unnecessary, because we need to run make clean -# anyway to prevent build from crashing if header files are added/removed. -# Build the C core -RUN make static_c shared_c -j12 -C /var/local/git/grpc - -# Define the default command. -CMD ["bash"] diff --git a/tools/dockerfile/grpc_php/Dockerfile b/tools/dockerfile/grpc_php/Dockerfile deleted file mode 100644 index 1e8e1389d9..0000000000 --- a/tools/dockerfile/grpc_php/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -# 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. - -# Dockerfile for gRPC PHP -FROM grpc/php_base - -RUN cd /var/local/git/grpc \ - && git pull --recurse-submodules \ - && git submodule update --init --recursive - -# Prevent breaking the build if header files are added/removed. -RUN make clean -C /var/local/git/grpc - -RUN make install_c -j12 -C /var/local/git/grpc - -RUN cd /var/local/git/grpc/src/php/ext/grpc && git pull && phpize - -# Build the grpc PHP extension -RUN cd /var/local/git/grpc/src/php/ext/grpc \ - && ./configure \ - && make - -RUN cd /var/local/git/grpc/src/php && composer install - -# Add a cacerts directory containing the Google root pem file, allowing the -# php client to access the production test instance -ADD cacerts cacerts - -# Add a service_account directory containing the auth creds file -ADD service_account service_account - -RUN cd /var/local/git/grpc/src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto - -RUN cd /var/local/git/grpc/src/php && ./bin/run_tests.sh diff --git a/tools/dockerfile/grpc_php/README.md b/tools/dockerfile/grpc_php/README.md deleted file mode 100644 index f3c332b8b3..0000000000 --- a/tools/dockerfile/grpc_php/README.md +++ /dev/null @@ -1,10 +0,0 @@ -GRPC PHP Dockerfile -=================== - -Dockerfile for creating the PHP development instances - -As of 2014/10 this -- is based on the GRPC PHP base -- adds a pull of the HEAD GRPC PHP source from GitHub -- it builds it -- runs the tests, i.e, the image won't be created if the tests don't pass diff --git a/tools/dockerfile/grpc_php/build.sh b/tools/dockerfile/grpc_php/build.sh deleted file mode 100755 index fbbc61d5fa..0000000000 --- a/tools/dockerfile/grpc_php/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -cp -R /var/local/git-clone/grpc /var/local/git - -make clean -C /var/local/git/grpc - -make install_c -j12 -C /var/local/git/grpc - -cd /var/local/git/grpc/src/php/ext/grpc && git pull && phpize - -cd /var/local/git/grpc/src/php/ext/grpc \ - && ./configure \ - && make - -cd /var/local/git/grpc/src/php && composer install - -cd /var/local/git/grpc/src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto - diff --git a/tools/dockerfile/grpc_php_base/Dockerfile b/tools/dockerfile/grpc_php_base/Dockerfile deleted file mode 100644 index aa20d6a374..0000000000 --- a/tools/dockerfile/grpc_php_base/Dockerfile +++ /dev/null @@ -1,122 +0,0 @@ -# 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. - -# Base Dockerfile for gRPC PHP. -# -# Includes PHP installation dependencies, things that are unlikely to vary. -FROM grpc/base - -RUN echo "deb http://packages.dotdeb.org wheezy-php55 all" >> /etc/apt/sources.list.d/dotdeb.list -RUN echo "deb-src http://packages.dotdeb.org wheezy-php55 all" >> /etc/apt/sources.list.d/dotdeb.list -RUN wget http://www.dotdeb.org/dotdeb.gpg -O- |apt-key add - - -# Install RVM dependencies and other packages -RUN apt-get update && apt-get install -y \ - autoconf \ - automake \ - bison \ - curl \ - g++ \ - gawk \ - gcc \ - groff \ - libc6-dev \ - libffi-dev \ - libgdbm-dev \ - libncurses5-dev \ - libreadline6-dev \ - libsqlite3-dev \ - libssl-dev \ - libtool \ - libxml2 \ - libyaml-dev \ - make \ - patch \ - php5-common \ - php5-cli \ - php5-dev \ - php-pear \ - pkg-config \ - procps \ - sqlite3 \ - zlib1g-dev - -ENV DEBIAN_FRONTEND noniteractive - -# Install composer -RUN curl -sS https://getcomposer.org/installer | php -RUN mv composer.phar /usr/local/bin/composer - -# Download the patched PHP protobuf so that PHP gRPC clients can be generated -# from proto3 schemas. -RUN git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php - -# Install ruby (via RVM) as ruby tools are dependencies for building Protobuf -# PHP extensions. -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 # Needed for RVM -RUN \curl -sSL https://get.rvm.io | bash -s stable --ruby -ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -# ronn: a ruby tool used to convert markdown to man pages, used during the -# install of Protobuf extensions -# -# rake: a ruby version of make used to build the PHP Protobuf extension -RUN rvm all do gem install ronn rake - -# Get the source from GitHub, this gets the protobuf library as well -RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc -RUN cd /var/local/git/grpc && \ - git pull --recurse-submodules && \ - git submodule update --init --recursive - -# Build and install the protobuf library -RUN cd /var/local/git/grpc/third_party/protobuf && \ - ./autogen.sh && \ - ./configure --prefix=/usr && \ - make -j12 && make check && make install && make clean - -# Install the patched PHP protobuf so that PHP gRPC clients can be generated -# from proto3 schemas. -RUN cd /var/local/git/protobuf-php \ - && rvm all do rake pear:package version=1.0 \ - && pear install Protobuf-1.0.tgz - -# Install PHPUnit, used to run the PHP unit tests -RUN wget https://phar.phpunit.de/phpunit.phar \ - && chmod +x phpunit.phar \ - && mv phpunit.phar /usr/local/bin/phpunit - - -# TODO: pre-building seems unnecessary, because we need to run make clean -# anyway to prevent build from crashing if header files are added/removed. -# Build the C core -RUN make static_c shared_c -j12 -C /var/local/git/grpc - -# Define the default command. -CMD ["bash"] diff --git a/tools/dockerfile/grpc_php_base/README.md b/tools/dockerfile/grpc_php_base/README.md deleted file mode 100644 index d93778e5ec..0000000000 --- a/tools/dockerfile/grpc_php_base/README.md +++ /dev/null @@ -1,9 +0,0 @@ -GRPC PHP Base Dockerfile -======================== - -Dockerfile for creating the PHP gRPC development Docker instance. - -As of 2014/10 this -- it installs tools and dependencies needed to build gRPC PHP -- it does not install gRPC PHP itself; a separate Dockerfile that depends on - this one will do that diff --git a/tools/dockerfile/grpc_python/Dockerfile b/tools/dockerfile/grpc_python/Dockerfile deleted file mode 100644 index bce35adc8b..0000000000 --- a/tools/dockerfile/grpc_python/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -# 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. - -# Dockerfile for GRPC Python -FROM grpc/python_base - -# Pull the latest sources -RUN cd /var/local/git/grpc \ - && git pull --recurse-submodules \ - && git submodule update --init --recursive - -# Build the C core. -RUN make install_c -j12 -C /var/local/git/grpc - -# Build Python GRPC -RUN cd /var/local/git/grpc \ - && pip install src/python/grpcio \ - && pip install src/python/grpcio_test - -# Run Python GRPC's tests -RUN cd /var/local/git/grpc \ - && python2.7 -B src/python/grpcio_test/setup.py test - -# Add a cacerts directory containing the Google root pem file, allowing the interop client to access the production test instance -ADD cacerts cacerts - -# Add a service_account directory containing the auth creds file -ADD service_account service_account - -# Specify the default command such that the interop server runs on its known testing port -CMD ["/bin/bash", "-l", "-c", "python2.7 -m interop.server --use_tls --port 8050"] diff --git a/tools/dockerfile/grpc_python/README.md b/tools/dockerfile/grpc_python/README.md deleted file mode 100644 index efbdbeff82..0000000000 --- a/tools/dockerfile/grpc_python/README.md +++ /dev/null @@ -1,11 +0,0 @@ -GRPC Python Dockerfile -==================== - -Dockerfile for creating the Python development instances - -As of 2015/02 this -- is based on the GRPC Python base -- adds a pull of the HEAD GRPC Python source from GitHub -- builds it -- runs its tests and aborts image creation if the tests don't pass -- specifies the Python GRPC interop test server as default command diff --git a/tools/dockerfile/grpc_python_base/Dockerfile b/tools/dockerfile/grpc_python_base/Dockerfile deleted file mode 100644 index 6ef7a111df..0000000000 --- a/tools/dockerfile/grpc_python_base/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -# 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. - -# Base Dockerfile for GRPC Python. -# -# Includes Python environment and installation dependencies. -FROM grpc/base - -# Allows 'source' to work -RUN rm /bin/sh && ln -s /bin/bash /bin/sh - -# Install Python development -RUN apt-get update && apt-get install -y \ - python-all-dev \ - python3-all-dev \ - python-pip \ - python-virtualenv - -# Install Python packages from PyPI -RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 cython==0.23 - -# Get the GRPC source from GitHub -RUN git clone --recursive https://github.com/grpc/grpc.git /var/local/git/grpc diff --git a/tools/dockerfile/grpc_python_base/README.md b/tools/dockerfile/grpc_python_base/README.md deleted file mode 100644 index 1d4767ce5c..0000000000 --- a/tools/dockerfile/grpc_python_base/README.md +++ /dev/null @@ -1,7 +0,0 @@ -GRPC Python Base Dockerfile -======================== - -Dockerfile for creating the Python GRPC development Docker instance. - -As of 2015/02 this -- installs tools and dependencies needed to build GRPC Python diff --git a/tools/dockerfile/grpc_ruby/Dockerfile b/tools/dockerfile/grpc_ruby/Dockerfile deleted file mode 100644 index 485c34e1a8..0000000000 --- a/tools/dockerfile/grpc_ruby/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# 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. - -# Dockerfile for gRPC Ruby -FROM grpc/ruby_base - -# Pull the latest sources -RUN cd /var/local/git/grpc \ - && git pull --recurse-submodules \ - && git submodule update --init --recursive - -# Prevent breaking the build if header files are added/removed. -RUN make clean -C /var/local/git/grpc - -# Build the C core -RUN make install_c -j12 -C /var/local/git/grpc - -# Build ruby gRPC and run its tests -RUN /bin/bash -l -c 'cd /var/local/git/grpc/src/ruby && gem update bundler && bundle && rake' - -# Add a cacerts directory containing the Google root pem file, allowing the -# ruby client to access the production test instance -ADD cacerts cacerts - -# Add a service_account directory containing the auth creds file -ADD service_account service_account - -# Specify the default command such that the interop server runs on its known -# testing port -CMD ["/bin/bash", "-l", "-c", "ruby /var/local/git/grpc/src/ruby/bin/interop/interop_server.rb --use_tls --port 8060"] diff --git a/tools/dockerfile/grpc_ruby/README.md b/tools/dockerfile/grpc_ruby/README.md deleted file mode 100644 index eaa8382f1c..0000000000 --- a/tools/dockerfile/grpc_ruby/README.md +++ /dev/null @@ -1,10 +0,0 @@ -GRPC Ruby Dockerfile -==================== - -Dockerfile for creating the Ruby development instances - -As of 2014/10 this -- is based on the GRPC Ruby base -- adds a pull of the HEAD gRPC Ruby source from GitHub -- it builds it -- runs the tests, i.e, the image won't be created if the tests don't pass diff --git a/tools/dockerfile/grpc_ruby/build.sh b/tools/dockerfile/grpc_ruby/build.sh deleted file mode 100755 index 1165561894..0000000000 --- a/tools/dockerfile/grpc_ruby/build.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# 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. -cp -R /var/local/git-clone/grpc /var/local/git - -make clean -C /var/local/git/grpc - -make install_c -j12 -C /var/local/git/grpc - -/bin/bash -l -c 'cd /var/local/git/grpc/src/ruby && gem update bundler && bundle && rake' diff --git a/tools/dockerfile/grpc_ruby_base/Dockerfile b/tools/dockerfile/grpc_ruby_base/Dockerfile deleted file mode 100644 index d58eeaaf70..0000000000 --- a/tools/dockerfile/grpc_ruby_base/Dockerfile +++ /dev/null @@ -1,92 +0,0 @@ -# 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. - -# Base Dockerfile for gRPC Ruby. -# -# Includes Ruby installation dependencies, things that are unlikely to vary. -FROM grpc/base - -# Allows 'source' to work -RUN rm /bin/sh && ln -s /bin/bash /bin/sh - -# Install RVM dependencies -RUN apt-get update && apt-get install -y \ - autoconf \ - automake \ - bison \ - curl \ - g++ \ - gawk \ - gcc \ - libc6-dev \ - libffi-dev \ - libgdbm-dev \ - libncurses5-dev \ - libreadline6-dev \ - libsqlite3-dev \ - libssl-dev \ - libtool \ - libyaml-dev \ - make \ - patch \ - pkg-config \ - procps \ - sqlite3 \ - zlib1g-dev - -# Install RVM, use this to install ruby -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 # Needed for RVM -RUN /bin/bash -l -c "curl -L get.rvm.io | bash -s stable" - -# Install Ruby 2.1 -RUN /bin/bash -l -c "rvm install ruby-2.1" -RUN /bin/bash -l -c "rvm use --default ruby-2.1" -RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" -RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc" -RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc" - -# Get the source from GitHub -RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc -RUN cd /var/local/git/grpc && \ - git pull --recurse-submodules && \ - git submodule update --init --recursive - -# Build and install the protobuf library -RUN cd /var/local/git/grpc/third_party/protobuf && \ - ./autogen.sh && \ - ./configure --prefix=/usr && \ - make -j12 && make check && make install && make clean - -# TODO: pre-building seems unnecessary, because we need to run make clean -# anyway to prevent build from crashing if header files are added/removed. -# Build the C core -RUN make static_c shared_c -j12 -C /var/local/git/grpc - -# Define the default command. -CMD ["bash"] diff --git a/tools/dockerfile/grpc_ruby_base/README.md b/tools/dockerfile/grpc_ruby_base/README.md deleted file mode 100644 index acf1e50dbe..0000000000 --- a/tools/dockerfile/grpc_ruby_base/README.md +++ /dev/null @@ -1,9 +0,0 @@ -GRPC RUBY Base Dockerfile -======================== - -Dockerfile for creating the Ruby gRPC development Docker instance. - -As of 2014/10 this -- it installs tools and dependencies needed to build gRPC Ruby -- it does not install gRPC Ruby itself; a separate Dockerfile that depends on - this one will do that diff --git a/tools/gce_setup/README.md b/tools/gce_setup/README.md deleted file mode 100644 index 253e94daa9..0000000000 --- a/tools/gce_setup/README.md +++ /dev/null @@ -1,48 +0,0 @@ -GCE images for GRPC -=================== - -This directory contains a number of shell files used for setting up GCE images -and instances for developing and testing gRPC. - - - -Goal ----- - -- provides a script to create a GCE image that has everything needed to try -out gRPC on GCE. -- provide another script that creates a new GCE instance from the latest image - -- additional scripts may be added in the future - - -Usage ------- - -# Minimal usage (see the scripts themselves for options) - -$ create_grpc_dev_image.sh # creates a grpc GCE image -$ ... -$ new_grpc_dev_instance.sh # creates an instance using the latest grpc GCE image - - -Requirements ------------- - -Install [Google Cloud SDK](https://developers.google.com/cloud/sdk/) - -Contents --------- - -Library scripts that contain bash functions used in the other scripts: -- shared_setup_funcs.sh # funcs used in create_grpc_dev_image and new_grpc_dev_instance -- gcutil_extras.sh # wrappers for common tasks that us gcutil -- build_grpc_dist.sh # funcs building the GRPC library and tests into a debian dist - -GCE [startup scripts](https://developers.google.com/compute/docs/howtos/startupscript) -- *_on_startup.sh - -Main scripts (as of 2014/09/04) -- create_grpc_dev_instance.sh -- new_grpc_dev_instance.sh - diff --git a/tools/gce_setup/build_images.sh b/tools/gce_setup/build_images.sh deleted file mode 100755 index 0b1c32b7d6..0000000000 --- a/tools/gce_setup/build_images.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# 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. - - -main() { - # rebuild images on all languages on existing builder vm. - source grpc_docker.sh - cd ../../ - - # build images for all languages - languages=(cxx java go ruby node python csharp_mono) - for lan in "${languages[@]}" - do - grpc_update_image $lan - done -} - -set -x -main "$@" diff --git a/tools/gce_setup/builder.sh b/tools/gce_setup/builder.sh deleted file mode 100755 index 8815d082da..0000000000 --- a/tools/gce_setup/builder.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# 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. - - -main() { - # restart builder vm and wait for images to sync to it - source grpc_docker.sh - ./new_grpc_docker_builder.sh -igrpc-docker-builder-alt-2 -anone - cd ../../ - sleep 3600 - - # build images for all languages - languages=(cxx java go ruby node python csharp_mono) - for lan in "${languages[@]}" - do - grpc_update_image $lan - done - - # restart client and server vm and wait for images to sync to them - cd tools/gce_setup - ./new_grpc_docker_builder.sh -igrpc-docker-testclients -anone - ./new_grpc_docker_builder.sh -igrpc-docker-server -anone - sleep 3600 - - # launch images for all languages on server - grpc_launch_servers grpc-docker-server - -} - -set -x -main "$@" diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh deleted file mode 100755 index 7343702883..0000000000 --- a/tools/gce_setup/cloud_prod_runner.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -# 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. - -thisfile=$(readlink -ne "${BASH_SOURCE[0]}") -cur=$(date "+%Y-%m-%d-%H-%M-%S") -log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/prod_result/prod/$cur/logs - -main() { - source grpc_docker.sh - test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming cancel_after_begin cancel_after_first_response empty_stream timeout_on_sleeping_server) - auth_test_cases=(service_account_creds compute_engine_creds jwt_token_creds oauth2_auth_token per_rpc_creds) - clients=(cxx java go ruby node csharp_mono csharp_dotnet python php) - for test_case in "${test_cases[@]}" - do - for client in "${clients[@]}" - do - client_vm="grpc-docker-testclients" - if [ "$client" = "csharp_dotnet" ] - then - client_vm="grpc-windows-interop1" - fi - log_file_name=cloud_{$test_case}_{$client}.txt - if grpc_cloud_prod_test $test_case $client_vm $client > /tmp/$log_file_name 2>&1 - then - echo " ['$test_case', '$client', 'prod', true, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt - else - echo " ['$test_case', '$client', 'prod', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt - fi - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/prod_result/prod/$cur/logs/$log_file_name - rm /tmp/$log_file_name - done - done - for test_case in "${auth_test_cases[@]}" - do - for client in "${clients[@]}" - do - client_vm="grpc-docker-testclients" - if [ "$client" = "csharp_dotnet" ] - then - client_vm="grpc-windows-interop1" - fi - log_file_name=cloud_{$test_case}_{$client}.txt - if grpc_cloud_prod_auth_test $test_case $client_vm $client > /tmp/$log_file_name 2>&1 - then - echo " ['$test_case', '$client', 'prod', true, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt - else - echo " ['$test_case', '$client', 'prod', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt - fi - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/prod_result/prod/$cur/logs/$log_file_name - rm /tmp/$log_file_name - done - done - if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then - cat pre.html /tmp/cloud_prod_result.txt post.html > /tmp/cloud_prod_result.html - gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/prod_result/prod/$cur/cloud_prod_result.html - rm /tmp/cloud_prod_result.txt - rm /tmp/cloud_prod_result.html - fi -} - -set -x -main "$@" diff --git a/tools/gce_setup/cloud_prod_test.sh b/tools/gce_setup/cloud_prod_test.sh deleted file mode 100755 index 94869ee9b6..0000000000 --- a/tools/gce_setup/cloud_prod_test.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# 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. - -thisfile=$(readlink -ne "${BASH_SOURCE[0]}") -test_case=$1 -client_vm=$2 -result=cloud_prod_result.$1 -cur=$(date "+%Y-%m-%d-%H-%M-%S") -log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/prod_result/$test_case/$cur - -main() { - source grpc_docker.sh - clients=(cxx java go ruby node csharp_mono python php) - for client in "${clients[@]}" - do - log_file_name=cloud_{$test_case}_{$client}.txt - if grpc_cloud_prod_test $test_case $client_vm $client > /tmp/$log_file_name 2>&1 - then - echo " ['$test_case', '$client', 'prod', true, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/$result.txt - else - echo " ['$test_case', '$client', 'prod', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/$result.txt - fi - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/prod_result/$test_case/$cur/$log_file_name - rm /tmp/$log_file_name - done - if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then - cat pre.html /tmp/$result.txt post.html > /tmp/$result.html - gsutil cp /tmp/$result.html gs://stoked-keyword-656-output/prod_result/$test_case/$cur/$result.html - rm /tmp/$result.txt - rm /tmp/$result.html - fi -} - -set -x -main "$@" diff --git a/tools/gce_setup/compute_extras.sh b/tools/gce_setup/compute_extras.sh deleted file mode 100755 index a0835a12ed..0000000000 --- a/tools/gce_setup/compute_extras.sh +++ /dev/null @@ -1,284 +0,0 @@ -#!/bin/bash -# 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. - - -# Bash funcs shared that combine common gcutil actions into single commands - -# remove_instance removes a named instance -# -# remove_instance <project> <instance_name> [<zone>="us-central1-b"] -remove_instance() { - local project=$1 - [[ -n $project ]] || { - echo "$FUNCNAME: missing arg: project" 1>&2 - return 1 - } - local an_instance=$2 - [[ -n $an_instance ]] || { - echo "$FUNCNAME: missing arg: an_instance" 1>&2 - return 1 - } - local zone=$3 - [[ -n $zone ]] || zone="us-central1-b" - - gcloud --project $project --quiet \ - compute instances delete $an_instance --zone=$zone -} - -# has_instance checks if a project contains a named instance -# -# has_instance <project> <instance_name> -has_instance() { - local project=$1 - [[ -n $project ]] || { - echo "$FUNCNAME: missing arg: project" 1>&2 - return 1 - } - local checked_instance=$2 - [[ -n $checked_instance ]] || { - echo "$FUNCNAME: missing arg: checked_instance" 1>&2 - return 1 - } - - instances=$(gcloud --project $project compute instances list \ - | sed -e 's/ \+/ /g' | cut -d' ' -f 1) - for i in $instances - do - if [[ $i == $checked_instance ]] - then - return 0 - fi - done - - return 1 -} - -# find_network_ip finds the ip address of a instance if it is present in the project. -# -# find_network_ip <project> <instance_name> -find_network_ip() { - local project=$1 - [[ -n $project ]] || { - echo "$FUNCNAME: missing arg: project" 1>&2 - return 1 - } - local checked_instance=$2 - [[ -n $checked_instance ]] || { - echo "$FUNCNAME: missing arg: checked_instance" 1>&2 - return 1 - } - - has_instance $project $checked_instance || return 1 - gcloud --project $project compute instances list \ - | grep -e "$checked_instance\s" | sed -e 's/ \+/ /g' | cut -d' ' -f 4 -} - -# delete_disks deletes a bunch of disks matching a pattern -# -# delete_disks <project> <disk_pattern> -delete_disks() { - local project=$1 - [[ -n $project ]] || { - echo "$FUNCNAME: missing arg: project" 1>&2 - return 1 - } - local disk_pattern=$2 - [[ -n $disk_pattern ]] || { - echo "$FUNCNAME: missing arg: disk_pattern" 1>&2 - return 1 - } - - trash_disks=$(gcloud --project=$project compute disks list \ - | sed -e 's/ \+/ /g' | cut -d' ' -f 1 | grep $disk_pattern) - [[ -n $trash_disks ]] && gcloud --project $project \ - --quiet compute disks delete $trash_disks -} - -# has_firewall checks if a project contains a named firewall -# -# has_firewall <project> <checked_firewall> -has_firewall() { - local project=$1 - [[ -n $project ]] || { - echo "$FUNCNAME: missing arg: project" 1>&2 - return 1 - } - local checked_firewall=$2 - [[ -n $checked_firewall ]] || { - echo "$FUNCNAME: missing arg: checked_firewall" 1>&2 - return 1 - } - - instances=$(gcloud --project $project compute firewall-rules list \ - | sed -e 's/ \+/ /g' | cut -d' ' -f 1) - for i in $instances - do - if [[ $i == $checked_firewall ]] - then - return 0 - fi - done - - return 1 -} - -# remove_firewall removes a named firewall from a project. -# -# remove_firewall <project> <checked_firewall> -remove_firewall() { - local project=$1 - [[ -n $project ]] || { - echo "$FUNCNAME: missing arg: project" 1>&2 - return 1 - } - local a_firewall=$2 - [[ -n $a_firewall ]] || { - echo "$FUNCNAME: missing arg: a_firewall" 1>&2 - return 1 - } - - gcloud --project $project --quiet compute firewall-rules delete $a_firewall -} - -# has_network checks if a project contains a named network -# -# has_network <project> <checked_network> -has_network() { - local project=$1 - [[ -n $project ]] || { - echo "$FUNCNAME: missing arg: project" 1>&2 - return 1 - } - local checked_network=$2 - [[ -n $checked_network ]] || { - echo "$FUNCNAME: missing arg: checked_network" 1>&2 - return 1 - } - - instances=$(gcloud --project $project compute networks list \ - | sed -e 's/ \+/ /g' | cut -d' ' -f 1) - for i in $instances - do - if [[ $i == $checked_network ]] - then - return 0 - fi - done - - return 1 -} - -# maybe_setup_dev_network adds a network with the given name with firewalls -# useful to development -# -# - All machines can accessed internally and externally over SSH (port 22) -# - All machines can access one another other the internal network -# - All machines can be accessed externally via port 80, 443, 8080 and 8443 -maybe_setup_dev_network() { - local name=$1 - [[ -n $name ]] || { - echo "$FUNCNAME: missing arg: network name" 1>&2 - return 1 - } - - local project=$2 - [[ -n $project ]] || { - echo "$FUNCNAME: missing arg: project" 1>&2 - return 1 - } - - has_network $project $name || { - echo "creating network '$name'" 1>&2 - gcloud compute --project $project networks create $name || return 1 - } - - # allow instances on the network to connect to each other internally - has_firewall $project "$name-ssh" || { - echo "adding firewall '$name-ssh'" 1>&2 - gcloud compute --project $project firewall-rules create "$name-ssh" \ - --network $name \ - --allow tcp:22 || return 1; - } - - # allow instances on the network to connect to each other internally - has_firewall $project "$name-internal" || { - echo "adding firewall '$name-internal'" 1>&2 - gcloud compute --project $project firewall-rules create "$name-internal" \ - --network $name \ - --source-ranges 10.0.0.0/16 --allow tcp udp icmp || return 1; - } - - # allow instances on the network to be connected to from external ips on - # specific ports - has_firewall $project "$name-external" || { - echo "adding firewall '$name-external'" 1>&2 - gcloud compute --project $project firewall-rules create "$name-external" \ - --network $name \ - --allow tcp:80 tcp:8080 tcp:443 tcp:8443 || return 1; - } -} - -# maybe_remove_dev_network removes a network set up by maybe_setup_dev_network -maybe_remove_dev_network() { - local name=$1 - [[ -n $name ]] || { - echo "$FUNCNAME: missing arg: network name" 1>&2 - return 1 - } - - local project=$2 - [[ -n $project ]] || { - echo "$FUNCNAME: missing arg: project" 1>&2 - return 1 - } - - has_network $project $name || { - echo "network $name is not present" - return 0 - } - for i in $(gcloud compute firewall-rules list \ - | grep "$name-" | cut -d' ' -f 1) - do - gcloud compute --quiet firewall-rules delete $i || return 1; - done - gcloud compute --quiet networks delete $name -} - -# find_named_ip finds the external ip address for a given name. -# -# find_named_ip <named-ip-address> -find_named_ip() { - local name=$1 - [[ -n $name ]] || { echo "$FUNCNAME: missing arg: name" 1>&2; return 1; } - [[ $name == 'none' ]] && return 0; - - gcloud compute addresses list | sed -e 's/ \+/ /g' \ - | grep $name | cut -d' ' -f 3 -} diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh deleted file mode 100755 index e50706ec74..0000000000 --- a/tools/gce_setup/grpc_docker.sh +++ /dev/null @@ -1,1739 +0,0 @@ -#!/bin/bash -# 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. - -# -# Contains funcs that help maintain GRPC's Docker images. -# -# Most funcs rely on the special-purpose GCE instance to build the docker -# instances and store them in a GCS-backed docker repository. -# -# The GCE instance -# - should be based on the container-optimized GCE instance -# [https://cloud.google.com/compute/docs/containers]. -# - should be running google/docker-registry image -# [https://registry.hub.docker.com/u/google/docker-registry/], so that images -# can be saved to GCS -# - should have the GCE support scripts from this directory install on it. -# -# The expected workflow is -# - start a grpc docker GCE instance -# * on startup, some of the docker images will be regenerated automatically -# - used grpc_update_image to update images via that instance - - -# Creates the ssh key file expect by 'gcloud compute ssh' if it does not exist. -# -# Allows gcloud ssh commands to run on freshly started docker instances. -_grpc_ensure_gcloud_ssh() { - local default_key_file="$HOME/.ssh/google_compute_engine" - if [ "$HOME" == "/" ] - then - default_key_file="/root/.ssh/google_compute_engine" - fi - [ -f $default_key_file ] || { - ssh-keygen -f $default_key_file -N '' > /dev/null || { - echo "could not precreate $default_key_file" 1>&2 - return 1 - } - } -} - -# Pushes a dockerfile dir to cloud storage. -# -# dockerfile is expected to the parent directory to a nunber of directoies each -# of which specifies a Dockerfiles. -# -# grpc_push_dockerfiles path/to/docker_parent_dir gs://bucket/path/to/gcs/parent -grpc_push_dockerfiles() { - local docker_dir=$1 - [[ -n $docker_dir ]] || { - echo "$FUNCNAME: missing arg: docker_dir" 1>&2 - return 1 - } - - local gs_root_uri=$2 - [[ -n $gs_root_uri ]] || { - echo "$FUNCNAME: missing arg: gs_root_uri" 1>&2 - return 1 - } - - find $docker_dir -name '*~' -o -name '#*#' -exec rm -fv {} \; || { - echo "$FUNCNAME: failed: cleanup of tmp files in $docker_dir" 1>&2 - return 1 - } - gsutil cp -R $docker_dir $gs_root_uri || { - echo "$FUNCNAME: failed: cp $docker_dir -> $gs_root_uri" 1>&2 - return 1 - } -} - -# Adds the user to docker group on a GCE instance, and restarts the docker -# daemon -grpc_add_docker_user() { - _grpc_ensure_gcloud_ssh || return 1; - local host=$1 - [[ -n $host ]] || { - echo "$FUNCNAME: missing arg: host" 1>&2 - return 1 - } - - local project=$2 - local project_opt='' - [[ -n $project ]] && project_opt=" --project $project" - - local zone=$3 - local zone_opt='' - [[ -n $zone ]] && zone_opt=" --zone $zone" - - - local func_lib="/var/local/startup_scripts/shared_startup_funcs.sh" - local ssh_cmd="source $func_lib && grpc_docker_add_docker_group" - gcloud compute $project_opt ssh $zone_opt $host --command "$ssh_cmd" -} - -_grpc_update_image_args() { - echo "image_args $@" - # default the host, root storage uri and docker file root - grpc_gs_root='gs://tmp-grpc-dev/admin/' - grpc_dockerfile_root='tools/dockerfile' - grpc_gce_script_root='tools/gce_setup' - host='grpc-docker-builder' - - # see if -p or -z is used to override the the project or zone - local OPTIND - local OPTARG - while getopts :r:d:h: name - do - case $name in - d) grpc_dockerfile_root=$OPTARG ;; - r) grpc_gs_root=$OPTARG ;; - s) grpc_gce_script_root=$OPTARG ;; - h) host=$OPTARG ;; - :) continue ;; # ignore -r or -d without args, just use the defaults - \?) echo "-$OPTARG: unknown flag; it's ignored" 1>&2; continue ;; - esac - done - shift $((OPTIND-1)) - - [[ -d $grpc_dockerfile_root ]] || { - echo "Could not locate dockerfile root dir: $grpc_dockerfile_root" 1>&2 - return 1 - } - - [[ -d $grpc_gce_script_root ]] || { - echo "Could not locate gce script dir: $grpc_gce_script_root" 1>&2 - return 1 - } - - # the suffix is required and can't be defaulted - # the suffix has two roles: - # - images are labelled grpc/<label_suffix> - # - the dockerfile is for an image is dockerfile_root/grpc_<label_suffix> - [[ -n $1 ]] && { - label_suffix=$1 - shift - } || { - echo "$FUNCNAME: missing arg: label_suffix (e.g cxx,base,ruby,java_base)" 1>&2 - return 1 - } -} - -# Updates a docker image specified in a local dockerfile via the docker -# container GCE instance. -# -# the docker container GCE instance -# - should have been setup using ./new_grpc_docker_instance -# -# There are options for -# -# call-seq: -# grpc_update_image php_base -# grpc_update_image cxx # rebuilds the cxx image -# -grpc_update_image() { - _grpc_ensure_gcloud_ssh || return 1; - - # set up by _grpc_update_args - local host grpc_gs_root grpc_gce_script_root grpc_dockerfile_root label_suffix - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - _grpc_set_project_and_zone -f _grpc_update_image_args "$@" || return 1 - local project_opt="--project $grpc_project" - local zone_opt="--zone $grpc_zone" - local image_label="grpc/$label_suffix" - local docker_dir_basename="grpc_$label_suffix" - local gce_docker_dir="/var/local/dockerfile/${docker_dir_basename}" - - # Set up and run the SSH command that builds the image - local func_lib="shared_startup_funcs.sh" - local gce_func_lib="/var/local/startup_scripts/$func_lib" - local ssh_cmd="source $gce_func_lib" - local ssh_cmd+=" && grpc_dockerfile_refresh $image_label $gce_docker_dir" - echo "will run:" - echo " $ssh_cmd" - echo "on $host" - [[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run - - # Update the remote copy of the GCE func library. - local src_func_lib="$grpc_gce_script_root/$func_lib" - local rmt_func_lib="$host:$gce_func_lib" - gcloud compute copy-files $src_func_lib $rmt_func_lib $project_opt $zone_opt || return 1 - - # Update the remote version of the docker func. - local src_docker_dir="$grpc_dockerfile_root/$docker_dir_basename" - local rmt_docker_root="$host:/var/local/dockerfile" - gcloud compute copy-files $src_docker_dir $rmt_docker_root $project_opt $zone_opt || return 1 - - gcloud compute $project_opt ssh $zone_opt $host --command "$ssh_cmd" -} - -# gce_has_instance checks if a project contains a named instance -# -# call-seq: -# gce_has_instance <project> <instance_name> -gce_has_instance() { - local project=$1 - [[ -n $project ]] || { echo "$FUNCNAME: missing arg: project" 1>&2; return 1; } - local checked_instance=$2 - [[ -n $checked_instance ]] || { - echo "$FUNCNAME: missing arg: checked_instance" 1>&2 - return 1 - } - - instances=$(gcloud --project $project compute instances list \ - | sed -e 's/ \+/ /g' | cut -d' ' -f 1) - for i in $instances - do - if [[ $i == $checked_instance ]] - then - return 0 - fi - done - - echo "instance '$checked_instance' not found in compute project $project" 1>&2 - return 1 -} - -# gce_find_internal_ip finds the ip address of a instance if it is present in -# the project. -# -# gce_find_internal_ip <project> <instance_name> -gce_find_internal_ip() { - local project=$1 - [[ -n $project ]] || { echo "$FUNCNAME: missing arg: project" 1>&2; return 1; } - local checked_instance=$2 - [[ -n $checked_instance ]] || { - echo "$FUNCNAME: missing arg: checked_instance" 1>&2 - return 1 - } - - gce_has_instance $project $checked_instance || return 1 - gcloud --project $project compute instances list \ - | grep -e "$checked_instance\s" \ - | sed -e 's/ \+/ /g' | cut -d' ' -f 4 -} - -# sets the vars grpc_zone and grpc_project -# -# to be used in funcs that want to set the zone and project and potential -# override them with -# -# grpc_zone -# - is set to the value gcloud config value for compute/zone if that's present -# - it defaults to asia-east1-a -# - it can be overridden by passing -z <other value> -# -# grpc_project -# - is set to the value gcloud config value for project if that's present -# - it defaults to stoked-keyword-656 (the grpc cloud testing project) -# - it can be overridden by passing -p <other value> -_grpc_set_project_and_zone() { - # can be set to 1 by passing -n in the args - dry_run=0 - - # by default; grpc_zone == gcloud config value || asia-east1-a - # - can be assigned via -p<project> in the args - grpc_zone=$(gcloud config list compute/zone --format text \ - | sed -e 's/ \+/ /g' | cut -d' ' -f 2) - # pick a known zone as a default - [[ $grpc_zone == 'None' ]] && grpc_zone='asia-east1-a' - - # grpc_project == gcloud config value || stoked-keyword-656 - # - can be assigned via -z<zone> in the args - grpc_project=$(gcloud config list project --format text \ - | sed -e 's/ \+/ /g' | cut -d' ' -f 2) - # pick an known zone as a default - [[ $grpc_project == 'None' ]] && grpc_project='stoked-keyword-656' - - # see if -p or -z is used to override the the project or zone - local OPTIND - local OPTARG - local arg_func - while getopts :np:z:f: name - do - case $name in - f) declare -F $OPTARG >> /dev/null && { - arg_func=$OPTARG; - } || { - echo "-f: arg_func value: $OPTARG is not defined" - return 2 - } - ;; - n) dry_run=1 ;; - p) grpc_project=$OPTARG ;; - z) grpc_zone=$OPTARG ;; - :) [[ $OPT_ARG == 'f' ]] && { - echo "-f: arg_func provided" 1>&2 - return 2 - } || { - # ignore -p or -z without args, just use the defaults - continue - } - ;; - \?) echo "-$OPTARG: unknown flag; it's ignored" 1>&2; continue ;; - esac - done - shift $((OPTIND-1)) - [[ -n $arg_func ]] && $arg_func "$@" -} - -# construct the flags to be passed to the binary running the test client -# -# call-seq: -# flags=$(grpc_interop_test_flags <server_ip> <server_port> <test_case>) -# [[ -n flags ]] || return 1 -grpc_interop_test_flags() { - [[ -n $1 ]] && { # server_ip - local server_ip=$1 - shift - } || { - echo "$FUNCNAME: missing arg: server_ip" 1>&2 - return 1 - } - [[ -n $1 ]] && { # port - local port=$1 - shift - } || { - echo "$FUNCNAME: missing arg: port" 1>&2 - return 1 - } - [[ -n $1 ]] && { # test_case - local test_case=$1 - shift - } || { - echo "$FUNCNAME: missing arg: test_case" 1>&2 - return 1 - } - echo "--server_host_override=foo.test.google.fr --server_host=$server_ip --server_port=$port --test_case=$test_case" -} - -# checks the positional args and assigns them to variables visible in the caller -# -# these are the positional args passed to grpc_interop_test after option flags -# are removed -# -# five args are expected, in order -# - test_case -# - host <the gce docker instance on which to run the test> -# - client to run -# - server_host <the gce docker instance on which the test server is running> -# - server type -grpc_interop_test_args() { - [[ -n $1 ]] && { # test_case - test_case=$1 - shift - } || { - echo "$FUNCNAME: missing arg: test_case" 1>&2 - return 1 - } - - [[ -n $1 ]] && { # host - host=$1 - shift - } || { - echo "$FUNCNAME: missing arg: host" 1>&2 - return 1 - } - - [[ -n $1 ]] && { # client_type - case $1 in - cxx|go|java|node|php|python|ruby|csharp_mono) - grpc_client_platform='Docker' - grpc_gen_test_cmd="grpc_interop_gen_$1_cmd" - declare -F $grpc_gen_test_cmd >> /dev/null || { - echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 - return 2 - } - shift - ;; - csharp_dotnet) - grpc_client_platform='Windows' - grpc_gen_test_cmd="grpc_interop_gen_$1_cmd" - declare -F $grpc_gen_test_cmd >> /dev/null || { - echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 - return 2 - } - shift - ;; - *) - echo "bad client_type: $1" 1>&2 - return 1 - ;; - esac - } || { - echo "$FUNCNAME: missing arg: client_type" 1>&2 - return 1 - } - - [[ -n $1 ]] && { # grpc_server - grpc_server=$1 - shift - } || { - echo "$FUNCNAME: missing arg: grpc_server" 1>&2 - return 1 - } - - [[ -n $1 ]] && { # server_type - case $1 in - cxx) grpc_port=8010 ;; - go) grpc_port=8020 ;; - java) grpc_port=8030 ;; - node) grpc_port=8040 ;; - python) grpc_port=8050 ;; - ruby) grpc_port=8060 ;; - csharp_mono) grpc_port=8070 ;; - csharp_dotnet) grpc_port=8070 ;; - *) echo "bad server_type: $1" 1>&2; return 1 ;; - esac - shift - } || { - echo "$FUNCNAME: missing arg: server_type" 1>&2 - return 1 - } -} - -# checks the positional args and assigns them to variables visible in the caller -# -# these are the positional args passed to grpc_cloud_prod_test after option flags -# are removed -# -# three args are expected, in order -# - test_case -# - host <the gce docker instance on which to run the test> -# - client to run -grpc_cloud_prod_test_args() { - [[ -n $1 ]] && { # test_case - test_case=$1 - shift - } || { - echo "$FUNCNAME: missing arg: test_case" 1>&2 - return 1 - } - - [[ -n $1 ]] && { # host - host=$1 - shift - } || { - echo "$FUNCNAME: missing arg: host" 1>&2 - return 1 - } - - [[ -n $1 ]] && { # client_type - case $1 in - cxx|go|java|node|php|python|ruby|csharp_mono) - grpc_client_platform='Docker' - grpc_gen_test_cmd="grpc_cloud_prod_gen_$1_cmd" - declare -F $grpc_gen_test_cmd >> /dev/null || { - echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 - return 2 - } - shift - ;; - csharp_dotnet) - grpc_client_platform='Windows' - grpc_gen_test_cmd="grpc_cloud_prod_gen_$1_cmd" - declare -F $grpc_gen_test_cmd >> /dev/null || { - echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 - return 2 - } - shift - ;; - *) - echo "bad client_type: $1" 1>&2 - return 1 - ;; - esac - } || { - echo "$FUNCNAME: missing arg: client_type" 1>&2 - return 1 - } -} - -# checks the positional args and assigns them to variables visible in the caller -# -# these are the positional args passed to grpc_cloud_prod_auth_test after option flags -# are removed -# -# three args are expected, in order -# - test_case -# - host <the gce docker instance on which to run the test> -# - client to run -grpc_cloud_prod_auth_test_args() { - grpc_gen_test_cmd="grpc_cloud_prod_auth_" - [[ -n $1 ]] && { # test_case - test_case=$1 - test_command="service_account_creds" - if [ "$test_case" == "compute_engine_creds" ] - then - test_command="compute_engine_creds" - fi - grpc_gen_test_cmd+=$test_command - shift - } || { - echo "$FUNCNAME: missing arg: test_case" 1>&2 - return 1 - } - - [[ -n $1 ]] && { # host - host=$1 - shift - } || { - echo "$FUNCNAME: missing arg: host" 1>&2 - return 1 - } - - [[ -n $1 ]] && { # client_type - case $1 in - go|java|node|php|python|ruby|csharp_mono) - grpc_client_platform='Docker' - grpc_gen_test_cmd+="_gen_$1_cmd" - declare -F $grpc_gen_test_cmd >> /dev/null || { - echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 - return 2 - } - shift - ;; - cxx) - if [ "$test_case" == "oauth2_auth_token" ] - then - grpc_gen_test_cmd="grpc_cloud_prod_auth_compute_engine_creds" - fi - grpc_client_platform='Docker' - grpc_gen_test_cmd+="_gen_$1_cmd" - declare -F $grpc_gen_test_cmd >> /dev/null || { - echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 - return 2 - } - shift - ;; - csharp_dotnet) - grpc_client_platform='Windows' - grpc_gen_test_cmd+="_gen_$1_cmd" - declare -F $grpc_gen_test_cmd >> /dev/null || { - echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 - return 2 - } - shift - ;; - *) - echo "bad client_type: $1" 1>&2 - return 1 - ;; - esac - } || { - echo "$FUNCNAME: missing arg: client_type" 1>&2 - return 1 - } -} - -_grpc_sync_scripts_args() { - grpc_gce_script_root='tools/gce_setup' - - local OPTIND - local OPTARG - while getopts :s: name - do - case $name in - s) grpc_gce_script_root=$OPTARG ;; - :) continue ;; # ignore -s without args, just use the defaults - \?) echo "-$OPTARG: unknown flag; it's ignored" 1>&2; continue ;; - esac - done - shift $((OPTIND-1)) - - [[ -d $grpc_gce_script_root ]] || { - echo "Could not locate gce script dir: $grpc_gce_script_root" 1>&2 - return 1 - } - - [[ $# -lt 1 ]] && { - echo "$FUNCNAME: missing arg: host1 [host2 ... hostN]" 1>&2 - return 1 - } - grpc_hosts="$@" -} - -# Updates the latest version of the support scripts on some hosts. -# -# call-seq; -# grpc_sync_scripts <server_name1>, <server_name2> .. <server_name3> -# -# Updates the GCE docker instance <server_name> -grpc_sync_scripts() { - _grpc_ensure_gcloud_ssh || return 1; - - # declare vars local so that they don't pollute the shell environment - # where this func is used. - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - local grpc_hosts grpc_gce_script_root - - # set the project zone and check that all necessary args are provided - _grpc_set_project_and_zone -f _grpc_sync_scripts_args "$@" || return 1 - - local func_lib="shared_startup_funcs.sh" - local gce_func_lib="/var/local/startup_scripts/$func_lib" - local project_opt="--project $grpc_project" - local zone_opt="--zone $grpc_zone" - local host - for host in $grpc_hosts - do - gce_has_instance $grpc_project $host || return 1; - # Update the remote copy of the GCE func library. - local src_func_lib="$grpc_gce_script_root/$func_lib" - local rmt_func_lib="$host:$gce_func_lib" - gcloud compute copy-files $src_func_lib $rmt_func_lib $project_opt $zone_opt || return 1 - done -} - -grpc_sync_images_args() { - [[ $# -lt 1 ]] && { - echo "$FUNCNAME: missing arg: host1 [host2 ... hostN]" 1>&2 - return 1 - } - grpc_hosts="$@" -} - -# Updates all the known docker images on a host.. -# -# call-seq; -# grpc_sync_images <server_name1>, <server_name2> .. <server_name3> -# -# Updates the GCE docker instance <server_name> -grpc_sync_images() { - _grpc_ensure_gcloud_ssh || return 1; - - # declare vars local so that they don't pollute the shell environment - # where this func is used. - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - local grpc_hosts - - # set the project zone and check that all necessary args are provided - _grpc_set_project_and_zone -f grpc_sync_images_args "$@" || return 1 - - local func_lib="/var/local/startup_scripts/shared_startup_funcs.sh" - local cmd="source $func_lib && grpc_docker_pull_known" - local project_opt="--project $grpc_project" - local zone_opt="--zone $grpc_zone" - local host - for host in $grpc_hosts - do - gce_has_instance $grpc_project $host || return 1; - local ssh_cmd="bash -l -c \"$cmd\"" - echo "will run:" - echo " $ssh_cmd" - echo "on $host" - [[ $dry_run == 1 ]] && continue # don't run the command on a dry run - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" - done -} - -_grpc_show_servers_args() { - [[ -n $1 ]] && { # host - host=$1 - shift - } || { - echo "$FUNCNAME: missing arg: host" 1>&2 - return 1 - } -} - - -# Shows servers on a docker instance. -# -# call-seq; -# grpc_show_servers <server_name> -# E.g -# grpc_show_server grpc-docker-server -# -# Shows the grpc servers on the GCE instance <server_name> -grpc_show_servers() { - # declare vars local so that they don't pollute the shell environment - # where this func is used. - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - # set by _grpc_show_servers - local host - - # set the project zone and check that all necessary args are provided - _grpc_set_project_and_zone -f _grpc_show_servers_args "$@" || return 1 - gce_has_instance $grpc_project $host || return 1; - - local cmd="sudo docker ps | grep grpc_" - local ssh_cmd="bash -l -c \"$cmd\"" - echo "will run:" - echo " $ssh_cmd" - echo "on $host" - [[ $dry_run == 1 ]] && continue # don't run the command on a dry run - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" -} - -_grpc_build_proto_bins_args() { - [[ -n $1 ]] && { # host - host=$1 - shift - } || { - host='grpc-docker-builder' - } -} - -# grpc_build_proto_bins -# -# - rebuilds the dist_proto docker image -# * doing this builds the protoc and the ruby, python and cpp bins statically -# -# - runs a docker command that copies the built protos to the GCE host -# - copies the built protos to the local machine -grpc_build_proto_bins() { - _grpc_ensure_gcloud_ssh || return 1; - - # declare vars local so that they don't pollute the shell environment - # where this func is used. - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - # set by _grpc_build_proto_bins_args - local host - - # set the project zone and check that all necessary args are provided - _grpc_set_project_and_zone -f _grpc_build_proto_bins_args "$@" || return 1 - gce_has_instance $grpc_project $host || return 1; - local project_opt="--project $grpc_project" - local zone_opt="--zone $grpc_zone" - - # rebuild the dist_proto image - local label='dist_proto' - grpc_update_image -- -h $host $label || return 1 - - # run a command to copy the generated archive to the docker host - local docker_prefix='sudo docker run -v /tmp:/tmp/proto_bins_out' - local tar_name='proto-bins*.tar.gz' - local cp_cmd="/bin/bash -c 'cp -v /tmp/$tar_name /tmp/proto_bins_out'" - local cmd="$docker_prefix grpc/$label $cp_cmd" - local ssh_cmd="bash -l -c \"$cmd\"" - echo "will run:" - echo " $ssh_cmd" - echo "on $host" - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" || return 1 - - # copy the tar.gz locally - local rmt_tar="$host:/tmp/$tar_name" - local local_copy="$(pwd)" - gcloud compute copy-files $rmt_tar $local_copy $project_opt $zone_opt || return 1 -} - -_grpc_build_debs_args() { - [[ -n $1 ]] && { # host - host=$1 - shift - } || { - host='grpc-docker-builder' - } -} - -# grpc_build_debs -# -# - rebuilds the build_debs -# * doing this builds a deb package for release debs -# -# - runs a docker command that copies the debs from the docker instance to its -# host -# - copies the debs from the host to the local machine -grpc_build_debs() { - _grpc_ensure_gcloud_ssh || return 1; - - # declare vars local so that they don't pollute the shell environment - # where this func is used. - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - # set by _grpc_build_debs_args - local host - - # set the project zone and check that all necessary args are provided - _grpc_set_project_and_zone -f _grpc_build_debs_args "$@" || return 1 - gce_has_instance $grpc_project $host || return 1; - local project_opt="--project $grpc_project" - local zone_opt="--zone $grpc_zone" - - # Update the remote distpackages_dir - local src_dist_dir='tools/distpackages' - local rmt_dist_dir="$host:~" - gcloud compute copy-files $src_dist_dir $rmt_dist_dir $project_opt $zone_opt || return 1 - - # rebuild the build_deb image - local label='build_deb' - grpc_update_image -- -h $host $label || return 1 - - # run a command to copy the debs from the docker instance to the host. - local docker_prefix='sudo docker run -v /tmp:/tmp/host_deb_out' - local cp_cmd="/bin/bash -c 'cp -v /tmp/deb_out/*.deb /tmp/host_deb_out'" - local cmd="$docker_prefix grpc/$label $cp_cmd" - local ssh_cmd="bash -l -c \"$cmd\"" - echo "will run:" - echo " $ssh_cmd" - echo "on $host" - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" || return 1 - - # copy the debs from host machine to the local one. - local rmt_debs="$host:/tmp/*.deb" - local local_copy="$(pwd)" - gcloud compute copy-files $rmt_debs $local_copy $project_opt $zone_opt || return 1 -} - -_grpc_launch_servers_args() { - [[ -n $1 ]] && { # host - host=$1 - shift - } || { - echo "$FUNCNAME: missing arg: host" 1>&2 - return 1 - } - [[ -n $1 ]] && { - servers="$@" - } || { - servers="cxx java go node ruby python csharp_mono" - echo "$FUNCNAME: no servers specified, will launch defaults '$servers'" - } -} - -# Launches servers on a docker instance. -# -# call-seq; -# grpc_launch_servers <server_name> [server1 server2 ...] -# E.g -# grpc_launch_server grpc-docker-server ruby node -# -# Restarts all the specified servers on the GCE instance <server_name> -# If no servers are specified, it launches all known servers -grpc_launch_servers() { - # declare vars local so that they don't pollute the shell environment - # where this func is used. - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - # set by _grpc_launch_servers_args - local host servers - - # set the project zone and check that all necessary args are provided - _grpc_set_project_and_zone -f _grpc_launch_servers_args "$@" || return 1 - gce_has_instance $grpc_project $host || return 1; - - # launch each of the servers in turn - for server in $servers - do - local grpc_port - case $server in - cxx) grpc_port=8010 ;; - go) grpc_port=8020 ;; - java) grpc_port=8030 ;; - node) grpc_port=8040 ;; - python) grpc_port=8050 ;; - ruby) grpc_port=8060 ;; - csharp_mono) grpc_port=8070 ;; - *) echo "bad server_type: $1" 1>&2; return 1 ;; - esac - local docker_label="grpc/$server" - local docker_name="grpc_interop_$server" - - cmd="sudo docker kill $docker_name > /dev/null 2>&1; " - cmd+="sudo docker rm $docker_name > /dev/null 2>&1; " - cmd+="sudo docker run -d --name $docker_name" - cmd+=" -p $grpc_port:$grpc_port $docker_label" - local project_opt="--project $grpc_project" - local zone_opt="--zone $grpc_zone" - local ssh_cmd="bash -l -c \"$cmd\"" - echo "will run:" - echo " $ssh_cmd" - echo "on $host" - [[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" - done -} - -# Launch servers on windows. -grpc_launch_windows_servers() { - local host='grpc-windows-interop1' - local killcmd="ps -e | grep Grpc.IntegrationTesting | awk '{print \\\$1}' | xargs kill -9" - echo "killing all servers and clients on $host with command $killcmd" - gcloud compute $project_opt ssh $zone_opt stoked-keyword-656@grpc-windows-proxy --command "ssh $host \"$killcmd\"" - - local cmd='cd /cygdrive/c/github/grpc/src/csharp/Grpc.IntegrationTesting.Server/bin/Debug && ./Grpc.IntegrationTesting.Server.exe --use_tls=true --port=8070' - # gcloud's auto-uploading of RSA keys doesn't work for Windows VMs. - # So we have a linux machine that is authorized to access the Windows - # machine through ssh and we use gcloud auth support to logon to the proxy. - echo "will run:" - echo " $cmd" - echo "on $host (through grpc-windows-proxy)" - gcloud compute $project_opt ssh $zone_opt stoked-keyword-656@grpc-windows-proxy --command "ssh $host '$cmd'" -} - -# Runs a test command on a docker instance -# -# The test command is issued via gcloud compute -# -# There are 3 possible results: -# 1. successful return code and finished within 60 seconds -# 2. failure return code and finished within 60 seconds -# 3. command does not return within 60 seconds, in which case it will be killed. -test_runner() { - local project_opt="--project $grpc_project" - local zone_opt="--zone $grpc_zone" - [[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run - if [ "$grpc_client_platform" != "Windows" ] - then - echo "will run:" - echo " $cmd" - echo "on $host" - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" & - else - # gcloud's auto-uploading of RSA keys doesn't work for Windows VMs. - # So we have a linux machine that is authorized to access the Windows - # machine through ssh and we use gcloud auth support to logon to the proxy. - echo "will run:" - echo " $cmd" - echo "on $host (through grpc-windows-proxy)" - gcloud compute $project_opt ssh $zone_opt stoked-keyword-656@grpc-windows-proxy --command "ssh $host '$cmd'" & - fi - # - PID=$! - echo "pid is $PID" - for x in {0..5} - do - if ps -p $PID - then - # test command has not returned and 60 seconds timeout has not reached - sleep 10 - else - # test command has returned, return the return code from the test command - wait $PID - local ret=$? - echo " test runner return $ret before timeout" - return $ret - fi - done - kill $PID - echo "test got killed by timeout return as failure" - return 1 -} - -# Runs a test command on a docker instance. -# -# call-seq: -# grpc_interop_test <test_name> <host> <client_type> \ -# <server_host> <server_type> -# -# N.B: server_name defaults to 'grpc-docker-server' -# -# requirements: -# host is a GCE instance running docker with access to the gRPC docker images -# server_name is a GCE docker instance running the gRPC server in docker -# test_name is one of the named gRPC tests [http://go/grpc_interop_tests] -# client_type is one of [cxx,go,java,php,python,ruby] -# server_type is one of [cxx,go,java,python,ruby] -# -# it assumes: -# that each grpc-imp has a docker image named grpc/<imp>, e.g, grpc/java -# a test is run using $ docker run 'path/to/interop_test_bin --flags' -# the required images are available on <host> -# -# server_name [default:grpc-docker-server] is an instance that runs the -# <server_type> server on the standard test port for the <server_type> -# -# each server_type runs it tests on a standard test port as follows: -# cxx: 8010 -# go: 8020 -# java: 8030 -# node: 8040 -# python: 8050 -# ruby: 8060 -# csharp: 8070 -# -# each client_type should have an associated bash func: -# grpc_interop_gen_<client_type>_cmd -# the func provides the dockerized commmand for running client_type's test. -# If no such func is available, tests for that client type cannot be run. -# -# the flags for running a test are the same: -# -# --server_host=<svr_addr> --server_port=<svr_port> --test_case=<...> -grpc_interop_test() { - _grpc_ensure_gcloud_ssh || return 1; - # declare vars local so that they don't pollute the shell environment - # where this func is used. - - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - # grpc_interop_test_args - local test_case host grpc_gen_test_cmd grpc_server grpc_port grpc_client_platform - - # set the project zone and check that all necessary args are provided - _grpc_set_project_and_zone -f grpc_interop_test_args "$@" || return 1 - gce_has_instance $grpc_project $host || return 1; - - local addr=$(gce_find_internal_ip $grpc_project $grpc_server) - [[ -n $addr ]] || return 1 - local flags=$(grpc_interop_test_flags $addr $grpc_port $test_case) - [[ -n $flags ]] || return 1 - cmd=$($grpc_gen_test_cmd $flags) - [[ -n $cmd ]] || return 1 - - test_runner -} - -# Runs a test command on a docker instance. -# -# call-seq: -# grpc_cloud_prod_test <test_name> <host> <client_type> -# -# requirements: -# host is a GCE instance running docker with access to the gRPC docker images -# test_name is one of the named gRPC tests [http://go/grpc_interop_tests] -# client_type is one of [cxx,go,java,php,python,ruby] -# -# it assumes: -# that each grpc-imp has a docker image named grpc/<imp>, e.g, grpc/java -# a test is run using $ docker run 'path/to/interop_test_bin --flags' -# the required images are available on <host> -# -# each client_type should have an associated bash func: -# grpc_cloud_prod_gen_<client_type>_cmd -# the func provides the dockerized commmand for running client_type's test. -# If no such func is available, tests for that client type cannot be run. -grpc_cloud_prod_test() { - _grpc_ensure_gcloud_ssh || return 1; - # declare vars local so that they don't pollute the shell environment - # where this func is used. - - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - # grpc_cloud_prod_test_args - local test_case host grpc_gen_test_cmd grpc_client_platform - - # set the project zone and check that all necessary args are provided - _grpc_set_project_and_zone -f grpc_cloud_prod_test_args "$@" || return 1 - gce_has_instance $grpc_project $host || return 1; - - local test_case_flag=" --test_case=$test_case" - cmd=$($grpc_gen_test_cmd $test_case_flag) - [[ -n $cmd ]] || return 1 - - test_runner -} - -# Runs a test command on a docker instance. -# -# call-seq: -# grpc_cloud_prod_auth_test <test_name> <host> <client_type> -# -# requirements: -# host is a GCE instance running docker with access to the gRPC docker images -# test_name is one of the named gRPC tests [http://go/grpc_interop_tests] -# client_type is one of [cxx,go,java,php,python,ruby] -# -# it assumes: -# that each grpc-imp has a docker image named grpc/<imp>, e.g, grpc/java -# a test is run using $ docker run 'path/to/interop_test_bin --flags' -# the required images are available on <host> -# -# each client_type should have an associated bash func: -# grpc_cloud_prod_auth_<test_case>_gen_<client_type>_cmd -# the func provides the dockerized commmand for running client_type's test. -# If no such func is available, tests for that client type cannot be run. -grpc_cloud_prod_auth_test() { - _grpc_ensure_gcloud_ssh || return 1; - # declare vars local so that they don't pollute the shell environment - # where this func is used. - - local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone - # grpc_cloud_prod_test_args - local test_case host grpc_gen_test_cmd - - # set the project zone and check that all necessary args are provided - _grpc_set_project_and_zone -f grpc_cloud_prod_auth_test_args "$@" || return 1 - gce_has_instance $grpc_project $host || return 1; - - local test_case_flag=" --test_case=$test_case" - cmd=$($grpc_gen_test_cmd $test_case_flag) - [[ -n $cmd ]] || return 1 - - test_runner -} - -# constructs the full dockerized ruby interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_ruby_cmd() { - local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c" - local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" - local the_cmd="$cmd_prefix 'ruby $test_script --use_test_ca --use_tls $@'" - echo $the_cmd -} - -# constructs the full dockerized python interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_python_cmd() { - local cmd_prefix="sudo docker run grpc/python bin/bash -l -c" - local the_cmd="$cmd_prefix 'python -B -m interop.client --use_test_ca --use_tls $@'" - echo $the_cmd -} - -# constructs the full dockerized python interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_gen_python_cmd() { - local cmd_prefix="sudo docker run grpc/python bin/bash -l -c" - local gfe_flags=$(_grpc_prod_gfe_flags) - local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" - local the_cmd="$cmd_prefix '$env_prefix python -B -m interop.client --use_tls $gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized python service_account auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_service_account_creds_gen_python_cmd() { - local cmd_prefix="sudo docker run grpc/python bin/bash -l -c"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_default_creds_test_flags) - local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" - env_prefix+=" GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json" - local the_cmd="$cmd_prefix '$env_prefix python -B -m interop.client --use_tls $gfe_flags $added_gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized python gce auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_compute_engine_creds_gen_python_cmd() { - local cmd_prefix="sudo docker run grpc/python bin/bash -l -c"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_gce_test_flags) - local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" - local the_cmd="$cmd_prefix '$env_prefix python -B -m interop.client --use_tls $gfe_flags $added_gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized ruby interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_gen_ruby_cmd() { - local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c" - local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" - local test_script+=" --use_tls" - local gfe_flags=$(_grpc_prod_gfe_flags) - local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" - local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized Go interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_service_account_creds_gen_go_cmd() { - local cmd_prefix="sudo docker run grpc/go /bin/bash -c" - local test_script="cd src/google.golang.org/grpc/interop/client" - local test_script+=" && go run client.go --use_tls=true" - local gfe_flags=$(_grpc_prod_gfe_flags) - local gfe_flags+=" --tls_ca_file=\"\"" - local added_gfe_flags=$(_grpc_svc_acc_test_flags) - local the_cmd="$cmd_prefix '$test_script $gfe_flags $added_gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized Go interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_compute_engine_creds_gen_go_cmd() { - local cmd_prefix="sudo docker run grpc/go /bin/bash -c" - local test_script="cd src/google.golang.org/grpc/interop/client" - local test_script+=" && go run client.go --use_tls=true" - local gfe_flags=$(_grpc_prod_gfe_flags) - local gfe_flags+=" --tls_ca_file=\"\"" - local added_gfe_flags=$(_grpc_gce_test_flags) - local the_cmd="$cmd_prefix '$test_script $gfe_flags $added_gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized ruby service_account auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_service_account_creds_gen_ruby_cmd() { - local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; - local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" - local test_script+=" --use_tls" - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_default_creds_test_flags) - local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" - env_prefix+=" GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json" - local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $added_gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized ruby gce auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_compute_engine_creds_gen_ruby_cmd() { - local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; - local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" - local test_script+=" --use_tls" - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_gce_test_flags) - local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" - local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $added_gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized ruby jwt_tokens auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_jwt_token_creds_gen_ruby_cmd() { - local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; - local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb" - local test_script+=" --use_tls" - local gfe_flags=$(_grpc_prod_gfe_flags) - local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" - env_prefix+=" GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json" - local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $added_gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized Go interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_go_cmd() { - local cmd_prefix="sudo docker run grpc/go /bin/bash -c" - local test_script="cd src/google.golang.org/grpc/interop/client" - local test_script+=" && go run client.go --use_tls=true" - local the_cmd="$cmd_prefix '$test_script $@'" - echo $the_cmd -} - -# constructs the full dockerized Go interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_gen_go_cmd() { - local cmd_prefix="sudo docker run grpc/go /bin/bash -c" - local test_script="cd src/google.golang.org/grpc/interop/client" - local test_script+=" && go run client.go --use_tls=true" - local gfe_flags=$(_grpc_prod_gfe_flags) - local gfe_flags+=" --tls_ca_file=\"\"" - local the_cmd="$cmd_prefix '$test_script $gfe_flags $@'" - echo $the_cmd -} - -# constructs the full dockerized java interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_java_cmd() { - local cmd_prefix="sudo docker run grpc/java"; - local test_script="/var/local/git/grpc-java/run-test-client.sh --use_test_ca=true --use_tls=true"; - local the_cmd="$cmd_prefix $test_script $@"; - echo $the_cmd -} - -# constructs the full dockerized java interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_gen_java_cmd() { - local cmd_prefix="sudo docker run grpc/java"; - local test_script="/var/local/git/grpc-java/run-test-client.sh --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized java service_account auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_service_account_creds_gen_java_cmd() { - local cmd_prefix="sudo docker run grpc/java"; - local test_script="/var/local/git/grpc-java/run-test-client.sh --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_svc_acc_test_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized java gce auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_compute_engine_creds_gen_java_cmd() { - local cmd_prefix="sudo docker run grpc/java"; - local test_script="/var/local/git/grpc-java/run-test-client.sh --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_gce_test_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized php interop test cmd. -# -# TODO(mlumish): update this to use the script once that's on git -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_php_cmd() { - local cmd_prefix="sudo docker run grpc/php bin/bash -l -c"; - local test_script="cd /var/local/git/grpc/src/php/tests/interop"; - local test_script+=" && php -d extension_dir=../../ext/grpc/modules/"; - local test_script+=" -d extension=grpc.so interop_client.php"; - local the_cmd="$cmd_prefix '$test_script $@ 1>&2'"; - echo $the_cmd -} - -# constructs the full dockerized php gce=>prod interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_gen_php_cmd() { - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - local cmd_prefix="sudo docker run $env_flag grpc/php"; - local test_script="/var/local/git/grpc/src/php/bin/interop_client.sh"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized php service_account auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_service_account_creds_gen_php_cmd() { - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - env_flag+="-e GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json " - local cmd_prefix="sudo docker run $env_flag grpc/php"; - local test_script="/var/local/git/grpc/src/php/bin/interop_client.sh"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local added_gfe_flags=$(_grpc_default_creds_test_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized php compute_engine auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_compute_engine_creds_gen_php_cmd() { - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - local cmd_prefix="sudo docker run $env_flag grpc/php"; - local test_script="/var/local/git/grpc/src/php/bin/interop_client.sh"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local added_gfe_flags=$(_grpc_gce_test_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized php jwt_token_creds auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_jwt_token_creds_gen_php_cmd() { - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - env_flag+="-e GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json " - local cmd_prefix="sudo docker run $env_flag grpc/php"; - local test_script="/var/local/git/grpc/src/php/bin/interop_client.sh"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized node interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_node_cmd() { - local cmd_prefix="sudo docker run grpc/node"; - local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true --use_test_ca=true"; - local the_cmd="$cmd_prefix $test_script $@"; - echo $the_cmd -} - -# constructs the full dockerized node gce=>prod interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_gen_node_cmd() { - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - local cmd_prefix="sudo docker run $env_flag grpc/node"; - local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized node service_account auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_service_account_creds_gen_node_cmd() { - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - env_flag+="-e GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json " - local cmd_prefix="sudo docker run $env_flag grpc/node"; - local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized node gce auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_compute_engine_creds_gen_node_cmd() { - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - local cmd_prefix="sudo docker run $env_flag grpc/node"; - local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_gce_test_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized cpp interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_cxx_cmd() { - local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls --use_test_ca"; - local the_cmd="$cmd_prefix $test_script $@"; - echo $the_cmd -} - -# constructs the full dockerized cpp gce=>prod interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_gen_cxx_cmd() { - local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized cpp service_account auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_service_account_creds_gen_cxx_cmd() { - local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_svc_acc_test_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized cpp gce auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_compute_engine_creds_gen_cxx_cmd() { - local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_gce_test_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized cpp jwt_token auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_jwt_token_creds_gen_cxx_cmd() { - local cmd_prefix="sudo docker run grpc/cxx"; - local test_script="/var/local/git/grpc/bins/opt/interop_client --use_tls"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local added_gfe_flags=$(_grpc_jwt_token_test_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $added_gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized csharp-mono interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_csharp_mono_cmd() { - local workdir_flag="-w /var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug" - local cmd_prefix="sudo docker run $workdir_flag grpc/csharp_mono"; - local test_script="mono Grpc.IntegrationTesting.Client.exe --use_tls=true --use_test_ca=true"; - local the_cmd="$cmd_prefix $test_script $@"; - echo $the_cmd -} - -# constructs the csharp-dotnet interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_interop_gen_csharp_dotnet_cmd() { - local set_workdir="cd /cygdrive/c/github/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug &&" - local test_script="./Grpc.IntegrationTesting.Client.exe --use_tls=true --use_test_ca=true"; - local the_cmd="$set_workdir $test_script $@"; - echo $the_cmd -} - -# constructs the full dockerized csharp-mono gce=>prod interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_gen_csharp_mono_cmd() { - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - local workdir_flag="-w /var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug" - local cmd_prefix="sudo docker run $env_flag $workdir_flag grpc/csharp_mono"; - local test_script="mono Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the csharp-dotnet gce=>prod interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_gen_csharp_dotnet_cmd() { - local set_workdir="cd /cygdrive/c/github/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug &&" - local test_script="./Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local set_certfile="SSL_CERT_FILE=/cacerts/roots.pem " - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$set_workdir $set_certfile $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized csharp-mono service_account auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_service_account_creds_gen_csharp_mono_cmd() { - local workdir_flag="-w /var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug" - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - env_flag+="-e GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json " - local cmd_prefix="sudo docker run $workdir_flag $env_flag grpc/csharp_mono"; - local test_script="mono Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the csharp-dotnet service_account auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_service_account_creds_gen_csharp_dotnet_cmd() { - local set_workdir="cd /cygdrive/c/github/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug &&" - local test_script="./Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local set_certfile="SSL_CERT_FILE=/cacerts/roots.pem " - local set_creds="GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json " - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$set_workdir $set_certfile $set_creds $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized csharp-mono gce auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_compute_engine_creds_gen_csharp_mono_cmd() { - local workdir_flag="-w /var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug" - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - local cmd_prefix="sudo docker run $workdir_flag $env_flag grpc/csharp_mono"; - local test_script="mono Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags) - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the csharp-dotnet gce auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_compute_engine_creds_gen_csharp_dotnet_cmd() { - local set_workdir="cd /cygdrive/c/github/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug &&" - local test_script="./Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local set_certfile="SSL_CERT_FILE=/cacerts/roots.pem " - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$set_workdir $set_certfile $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized csharp-mono oauth2_auth_token auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_oauth2_auth_token_gen_csharp_mono_cmd() { - local workdir_flag="-w /var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug" - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - env_flag+="-e GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json " - local cmd_prefix="sudo docker run $workdir_flag $env_flag grpc/csharp_mono"; - local test_script="mono Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the csharp-dotnet oauth2_auth_token auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_oauth2_auth_token_gen_csharp_dotnet_cmd() { - local set_workdir="cd /cygdrive/c/github/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug &&" - local test_script="./Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local set_certfile="SSL_CERT_FILE=/cacerts/roots.pem " - local set_creds="GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json " - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$set_workdir $set_certfile $set_creds $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the full dockerized csharp-mono per_rpc_creds auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_per_rpc_creds_gen_csharp_mono_cmd() { - local workdir_flag="-w /var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug" - local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " - env_flag+="-e GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json " - local cmd_prefix="sudo docker run $workdir_flag $env_flag grpc/csharp_mono"; - local test_script="mono Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; - echo $the_cmd -} - -# constructs the csharp-dotnet per_rpc_creds auth interop test cmd. -# -# call-seq: -# flags= .... # generic flags to include the command -# cmd=$($grpc_gen_test_cmd $flags) -grpc_cloud_prod_auth_per_rpc_creds_gen_csharp_dotnet_cmd() { - local set_workdir="cd /cygdrive/c/github/grpc/src/csharp/Grpc.IntegrationTesting.Client/bin/Debug &&" - local test_script="./Grpc.IntegrationTesting.Client.exe --use_tls=true"; - local set_certfile="SSL_CERT_FILE=/cacerts/roots.pem " - local set_creds="GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json " - local gfe_flags=$(_grpc_prod_gfe_flags); - local the_cmd="$set_workdir $set_certfile $set_creds $test_script $gfe_flags $@"; - echo $the_cmd -} - -# outputs the flags passed to gfe tests -_grpc_prod_gfe_flags() { - echo " --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com" -} - -# outputs the flags passed to the service account auth tests -_grpc_svc_acc_test_flags() { - echo " --service_account_key_file=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" -} - -# outputs the flags passed to the service account auth tests -_grpc_jwt_token_test_flags() { - echo " --service_account_key_file=/service_account/stubbyCloudTestingTest-ee3fce360ac5.json" -} - -# default credentials test flag -_grpc_default_creds_test_flags() { - echo " --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" -} - -# outputs the flags passed to the gcloud auth tests -_grpc_gce_test_flags() { - echo " --default_service_account=155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel@developer.gserviceaccount.com --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" -} diff --git a/tools/gce_setup/interop_test.sh b/tools/gce_setup/interop_test.sh deleted file mode 100755 index 0b5be6ab8a..0000000000 --- a/tools/gce_setup/interop_test.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# 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. - -thisfile=$(readlink -ne "${BASH_SOURCE[0]}") -test_case=$1 -client_vm=$2 -server_vm=$3 -result=interop_result.$1 -cur=$(date "+%Y-%m-%d-%H-%M-%S") -log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/interop_result/$test_case/$cur/logs - -main() { - source grpc_docker.sh - clients=(cxx java go ruby node csharp_mono csharp_dotnet python php) - servers=(cxx java go ruby node csharp_mono csharp_dotnet python csharp_mono) - for client in "${clients[@]}" - do - client_vm_test=$client_vm - if [ "$client" = "csharp_dotnet" ] - then - client_vm_test="grpc-windows-interop1" - fi - for server in "${servers[@]}" - do - log_file_name=cloud_{$test_case}_{$client}_{$server}.txt - server_vm_test=$server_vm - if [ "$server" = "csharp_dotnet" ] - then - server_vm_test="grpc-windows-interop1" - fi - if grpc_interop_test $test_case $client_vm_test $client $server_vm_test $server> /tmp/$log_file_name 2>&1 - then - echo " ['$test_case', '$client', '$server', true, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/$result.txt - else - echo " ['$test_case', '$client', '$server', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/$result.txt - fi - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/interop_result/$test_case/$cur/logs/$log_file_name - rm /tmp/$log_file_name - done - done - if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then - cat pre.html /tmp/$result.txt post.html > /tmp/$result.html - gsutil cp /tmp/$result.html gs://stoked-keyword-656-output/interop_result/$test_case/$cur/$result.html - rm /tmp/$result.txt - rm /tmp/$result.html - fi -} - -set -x -main "$@" diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh deleted file mode 100755 index 506471411b..0000000000 --- a/tools/gce_setup/interop_test_runner.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# 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. - -thisfile=$(readlink -ne "${BASH_SOURCE[0]}") -current_time=$(date "+%Y-%m-%d-%H-%M-%S") -result_file_name=interop_result.$current_time.html -echo $result_file_name -pass_log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/interop_pass_log_history -fail_log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/interop_fail_log_history - -main() { - source grpc_docker.sh - test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming cancel_after_begin cancel_after_first_response empty_stream timeout_on_sleeping_server) - clients=(cxx java go ruby node python csharp_mono php) - servers=(cxx java go ruby node python csharp_mono) - for test_case in "${test_cases[@]}" - do - for client in "${clients[@]}" - do - for server in "${servers[@]}" - do - log_file_name=interop_{$test_case}_{$client}_{$server}.txt - if grpc_interop_test $test_case grpc-docker-testclients $client grpc-docker-server $server > /tmp/$log_file_name 2>&1 - then - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/interop_pass_log_history/$log_file_name - echo " ['$test_case', '$client', '$server', true, '<a href="$pass_log_link/$log_file_name">log</a>']," >> /tmp/interop_result.txt - else - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/interop_fail_log_history/$log_file_name - echo " ['$test_case', '$client', '$server', false, '<a href="$fail_log_link/$log_file_name">log</a>']," >> /tmp/interop_result.txt - fi - done - done - done - if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then - cat pre.html /tmp/interop_result.txt post.html > /tmp/interop_result.html - gsutil cp /tmp/interop_result.txt gs://stoked-keyword-656-output/interop_result.txt - gsutil cp -R gs://stoked-keyword-656-output/interop_pass_log_history gs://stoked-keyword-656-output/log - gsutil cp -R gs://stoked-keyword-656-output/interop_fail_log_history gs://stoked-keyword-656-output/log - gsutil cp /tmp/interop_result.html gs://stoked-keyword-656-output/interop_result.html - gsutil cp /tmp/interop_result.html gs://stoked-keyword-656-output/result_history/$result_file_name - rm /tmp/interop_result.txt - rm /tmp/interop_result.html - rm /tmp/interop*.txt - fi -} - -set -x -main "$@" diff --git a/tools/gce_setup/new_grpc_docker_builder.sh b/tools/gce_setup/new_grpc_docker_builder.sh deleted file mode 100755 index 8a9ece3317..0000000000 --- a/tools/gce_setup/new_grpc_docker_builder.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/bin/bash -# 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. - - -# Triggers the build of a GCE 'grpc-docker' instance. -# -# Usage: -# /path/to/new_grpc_docker_builder.sh \ -# [--project <cloud-project-id> | -p<cloud-project-id>] \ -# [--instance <instance-to-create> | -i<instance-to-create>] \ -# [--address <named_cloud_static_ip> | -a<named_cloud_static_ip>] -# -# To run a new docker builder instance. -# $ /path/to/new_grpc_docker_builder.sh -pmy-project -imy-instance -amy-ip -# -# See main() for the full list of flags - -function this_dir() { - SCRIPT_PATH="${BASH_SOURCE[0]}"; - if ([ -h "${SCRIPT_PATH}" ]) then - while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done - fi - pushd . > /dev/null - cd `dirname ${SCRIPT_PATH}` > /dev/null - SCRIPT_PATH=`pwd`; - popd > /dev/null - echo $SCRIPT_PATH -} - -source $(this_dir)/compute_extras.sh -source $(this_dir)/grpc_docker.sh - -cp_startup_script() { - local script_dir=$1 - [[ -n $script_dir ]] || { echo "missing arg: script_dir" 1>&2; return 1; } - - local gs_script_root=$2 - [[ -n $gs_script_root ]] || { echo "missing arg: gs_script_root" 1>&2; return 1; } - - local script_path=$3 - [[ -n $script_path ]] || { echo "missing arg: script_name" 1>&2; return 1; } - - local startup_script=$script_dir/$script_path - local gs_startup_uri=$gs_script_root/$script_path - gsutil cp $startup_script $gs_startup_uri -} - -# add_instance adds a generic instance that runs -# new_grpc_docker_builder_on_startup.sh on startup -add_instance() { - local project=$1 - [[ -n $project ]] || { echo "missing arg: project" 1>&2; return 1; } - local gs_admin_root=$2 - [[ -n $gs_admin_root ]] || { echo "missing arg: gs_admin_root" 1>&2; return 1; } - local instance=$3 - [[ -n $instance ]] || { echo "missing arg: instance" 1>&2; return 1; } - local zone=$4 - [[ -n $zone ]] || { echo "missing arg: zone" 1>&2; return 1; } - local address=$5 - [[ -n $address ]] || { echo "missing arg: address" 1>&2; return 1; } - - local script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - local gs_script_root="$gs_admin_root/startup" - - local on_startup=new_grpc_docker_builder_on_startup.sh - local gs_on_startup=$gs_script_root/$on_startup - cp_startup_script $script_dir $gs_script_root $on_startup || { - echo "Could not save script to $gs_on_startup" 1>&2 - return 1 - } - startup_md="startup-script-url=$gs_on_startup" - - local shared_startup=shared_startup_funcs.sh - local gs_shared_startup=$gs_script_root/$shared_startup - cp_startup_script $script_dir $gs_script_root $shared_startup || { - echo "Could not save script to $gs_shared_startup" 1>&2 - return 1 - } - startup_md+=" shared_startup_script_url=$gs_shared_startup" - - local docker_dir=$(this_dir)/../dockerfile - grpc_push_dockerfiles $docker_dir $gs_admin_root || return 1; - startup_md+=" gs_dockerfile_root=$gs_admin_root/dockerfile" - startup_md+=" gs_docker_reg=$gs_admin_root/docker_images" - - local address_flag="" - local the_address=$(find_named_ip $address) - [[ -n $the_address ]] && address_flag="--address $the_address" - local the_image='container-vm-v20140925' - local scopes='compute-rw storage-full' - scopes+=' https://www.googleapis.com/auth/xapi.zoo' - gcloud --project $project compute instances create $instance \ - $address_flag \ - --image $the_image \ - --image-project google-containers \ - --metadata $startup_md \ - --machine-type='n1-standard-1' \ - --scopes $scopes \ - --tags grpc testing \ - --zone $zone \ - --boot-disk-size 500GB -} - -main() { - local INSTANCE_NAME="grpc-docker-builder" - local PROJECT="stoked-keyword-656" - local GS_ADMIN_ROOT="gs://tmp-grpc-dev/admin" - local ZONE='asia-east1-a' - local ADDRESS_NAME='grpc-php-dev-static-1' # use 'none' if no static ip is needed - - # Parse the options - opts=`getopt -o a::p::g::i::z:: --long address_name::,project::,gs_admin_root::,instance_name::,zone:: -n $0 -- "$@"` - eval set -- "$opts" - while true ; do - case "$1" in - -p|--project) - case "$2" in - "") shift 2 ;; - *) PROJECT=$2; shift 2 ;; - esac ;; - -a|--address_name) - case $2 in - "") shift 2 ;; - *) ADDRESS_NAME=$2; shift 2 ;; - esac ;; - -g|--gs_admin_root) - case "$2" in - "") shift 2 ;; - *) GS_ADMIN_ROOT=$2; shift 2 ;; - esac ;; - -i|--instance_name) - case "$2" in - "") shift 2 ;; - *) INSTANCE_NAME=$2; shift 2 ;; - esac ;; - -z|--zone) - case "$2" in - "") shift 2 ;; - *) ZONE=$2; shift 2 ;; - esac ;; - --) shift ; break ;; - *) echo "Internal error!" ; exit 1 ;; - esac - done - - # verify that the instance does not currently exist - has_instance $PROJECT $INSTANCE_NAME && remove_instance $PROJECT $INSTANCE_NAME $ZONE - has_instance $PROJECT $INSTANCE_NAME && { echo "$INSTANCE_NAME already exists" 1>&2; return 1; } - - # N.B the quotes around are necessary to allow cmds with spaces - add_instance $PROJECT $GS_ADMIN_ROOT $INSTANCE_NAME $ZONE $ADDRESS_NAME -} - -set -x -main "$@" diff --git a/tools/gce_setup/new_grpc_docker_builder_on_startup.sh b/tools/gce_setup/new_grpc_docker_builder_on_startup.sh deleted file mode 100755 index 30eb0377c2..0000000000 --- a/tools/gce_setup/new_grpc_docker_builder_on_startup.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/bash - -# 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. - -# Startup script that initializes a grpc-dev GCE machine. -# -# A grpc-docker GCE machine is based on docker container image. -# -# On startup, it copies the grpc dockerfiles to a local directory, and update its address. - -# _load_metadata curls a metadata url -_load_metadata() { - local metadata_root=http://metadata/computeMetadata/v1 - local uri=$1 - [[ -n $uri ]] || { echo "missing arg: uri" >&2; return 1; } - - if [[ $uri =~ ^'attributes/' ]] - then - for a in $(curl -H "X-Google-Metadata-Request: True" $metadata_root/instance/attributes/) - do - [[ $uri =~ "/$a"$ ]] && { curl $metadata_root/instance/$uri -H "X-Google-Metadata-Request: True"; return; } - done - fi - - # if the uri is a full request uri - [[ $uri =~ ^$metadata_root ]] && { curl $uri -H "X-Google-Metadata-Request: True"; return; } -} - -_source_gs_script() { - local script_attr=$1 - [[ -n $script_attr ]] || { echo "missing arg: script_attr" >&2; return 1; } - - local gs_uri=$(_load_metadata "attributes/$script_attr") - [[ -n $gs_uri ]] || { echo "missing metadata: $script_attr" >&2; return 1; } - - local out_dir='/var/local/startup_scripts' - local script_path=$out_dir/$(basename $gs_uri) - mkdir -p $out_dir - gsutil cp $gs_uri $script_path || { - echo "could not cp $gs_uri -> $script_path" - return 1 - } - chmod a+rwx $out_dir $script_path - source $script_path -} - -# Args: -# $1: numerator -# $2: denominator -# $3: threshold (optional; defaults to $THRESHOLD) -# -# Returns: -# 1 if (numerator / denominator > threshold) -# 0 otherwise -_gce_disk_cmp_ratio() { - local DEFAULT_THRESHOLD="1.1" - local numer="${1}" - local denom="${2}" - local threshold="${3:-${DEFAULT_THRESHOLD}}" - - if `which python > /dev/null 2>&1`; then - python -c "print(1 if (1. * ${numer} / ${denom} > ${threshold}) else 0)" - else - echo "Can't find python; calculation not done." 1>&2 - return 1 - fi -} - -# Repartitions the disk or resizes the file system, depending on the current -# state of the partition table. -# -# Automates the process described in -# - https://cloud.google.com/compute/docs/disks/persistent-disks#repartitionrootpd -_gce_disk_maybe_resize_then_reboot() { - # Determine the size in blocks, of the whole disk and the first partition. - local dev_sda="$(fdisk -s /dev/sda)" - local dev_sda1="$(fdisk -s /dev/sda1)" - local dev_sda1_start="$(sudo fdisk -l /dev/sda | grep /dev/sda1 | sed -e 's/ \+/ /g' | cut -d' ' -f 3)" - - # Use fdisk to - # - first see if the partion 1 is using as much of the disk as it should - # - then to resize the partition if it's not - # - # fdisk(1) flags: - # -c: disable DOS compatibility mode - # -u: change display mode to sectors (from cylinders) - # - # fdisk(1) commands: - # d: delete partition (automatically selects the first one) - # n: new partition - # p: primary - # 1: partition number - # $dev_sda1_start: specify the value for the start sector, the default may be incorrect - # <1 blank lines>: accept the defaults for end sectors - # w: write partition table - if [ $(_gce_disk_cmp_ratio "${dev_sda}" "${dev_sda1}") -eq 1 ]; then - echo "$FUNCNAME: Updating the partition table to use full ${dev_sda} instead ${dev_sda1}" - cat <<EOF | fdisk -c -u /dev/sda -d -n -p -1 -$dev_sda1_start - -w -EOF - echo "$FUNCNAME: ... updated the partition table" - shutdown -r now - return 0 - fi - - # After repartitioning, use resize2fs to expand sda1. - local df_size="$(df -B 1K / | grep ' /$' | sed -e 's/ \+/ /g' | cut -d' ' -f 2)" - if [ $(_gce_disk_cmp_ratio "${dev_sda}" "${df_size}") -eq 1 ]; then - echo "$FUNCNAME: resizing the partition to make full use of it" - resize2fs /dev/sda1 - echo "$FUNCNAME: ... resize completed" - fi -} - -main() { - _gce_disk_maybe_resize_then_reboot - local script_attr='shared_startup_script_url' - _source_gs_script $script_attr || { - echo "halting, script 'attributes/$script_attr' could not be sourced" - return 1 - } - grpc_dockerfile_pull - chmod -R a+rw /var/local/dockerfile - - # Install git and emacs - apt-get update && apt-get install -y git emacs || return 1 - - # Startup the docker registry - grpc_docker_launch_registry && grpc_docker_pull_known - - # Add a sentinel file to indicate that startup has completed. - local sentinel_file=/var/log/GRPC_DOCKER_IS_UP - touch $sentinel_file -} - -set -x -main "$@" diff --git a/tools/gce_setup/post.html b/tools/gce_setup/post.html deleted file mode 100644 index 2cea050c08..0000000000 --- a/tools/gce_setup/post.html +++ /dev/null @@ -1,11 +0,0 @@ - ]); - - var table = new google.visualization.Table(document.getElementById('table_div')); - table.draw(data, {showRowNumber: true, allowHtml: true}); - } - </script> - </head> - <body> - <div id="table_div"></div> - </body> -</html> diff --git a/tools/gce_setup/pre.html b/tools/gce_setup/pre.html deleted file mode 100644 index 79aa8fa394..0000000000 --- a/tools/gce_setup/pre.html +++ /dev/null @@ -1,15 +0,0 @@ -<html> - <head> - <script type="text/javascript" src="https://www.google.com/jsapi"></script> - <script type="text/javascript"> - google.load("visualization", "1", {packages:["table"]}); - google.setOnLoadCallback(drawTable); - - function drawTable() { - var data = new google.visualization.DataTable(); - data.addColumn('string', 'TestCase'); - data.addColumn('string', 'Client'); - data.addColumn('string', 'Server'); - data.addColumn('boolean', 'Pass'); - data.addColumn('string', 'LogLink'); - data.addRows([ diff --git a/tools/gce_setup/private_build_and_test.sh b/tools/gce_setup/private_build_and_test.sh deleted file mode 100755 index 7d5d25eb01..0000000000 --- a/tools/gce_setup/private_build_and_test.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -# 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. - -# This script has to be run from the same directory as grpc_docker.sh and after grpc_docker.sh is sourced -# -# Sample Usage: -# =============================== -# ./private_build_and_test.sh [language] [environment: interop|cloud] [test case] -# [git base directory] [server name in interop environment] -# sh private_build_and_test.sh java interop large_unary /usr/local/google/home/donnadionne/grpc-git grpc-docker-server1 -# sh private_build_and_test.sh java cloud large_unary /usr/local/google/home/donnadionne/grpc-git -# =============================== - -# Arguments -LANGUAGE=$1 -ENV=$2 -TEST=$3 -GIT=$4 -PROJECT=${5:-"stoked-keyword-656"} -ZONE=${6:-"asia-east1-a"} -CLIENT=${7:-"grpc-docker-testclients1"} -SERVER=${8:-"grpc-docker-server"} - -current_time=$(date "+%Y-%m-%d-%H-%M-%S") -result_file_name=private_result.$current_time.txt - -sudo docker run --name="private_images" -v $GIT:/var/local/git-clone grpc/$LANGUAGE /var/local/git-clone/grpc/tools/dockerfile/grpc_$LANGUAGE/build.sh - -sudo docker commit -m "private image" -a $USER private_images grpc/private_images - -sudo docker tag -f grpc/private_images 0.0.0.0:5000/grpc/private_images - -sudo docker push 0.0.0.0:5000/grpc/private_images - -sudo docker rmi -f grpc/private_images - -sudo docker rm private_images - -gcloud compute --project $PROJECT ssh --zone $ZONE $CLIENT --command "sudo docker pull 0.0.0.0:5000/grpc/private_images" - -gcloud compute --project $PROJECT ssh --zone $ZONE $CLIENT --command "sudo docker tag 0.0.0.0:5000/grpc/private_images grpc/$LANGUAGE" - -source grpc_docker.sh - -if [ $ENV == 'interop' ] -then - grpc_interop_test $TEST $CLIENT $LANGUAGE $SERVER cxx - grpc_interop_test $TEST $CLIENT $LANGUAGE $SERVER java - grpc_interop_test $TEST $CLIENT $LANGUAGE $SERVER go - grpc_interop_test $TEST $CLIENT $LANGUAGE $SERVER ruby - grpc_interop_test $TEST $CLIENT $LANGUAGE $SERVER node - grpc_interop_test $TEST $CLIENT $LANGUAGE $SERVER python -else - if [ $ENV == 'cloud' ] - then - grpc_cloud_prod_test $TEST $CLIENT $LANGUAGE > /tmp/$result_file_name 2>&1 - gsutil cp /tmp/$result_file_name gs://$PROJECT-output/private_result/$result_file_name - else - grpc_cloud_prod_auth_test $TEST $CLIENT $LANGUAGE - fi -fi - diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh deleted file mode 100755 index a0b45e9458..0000000000 --- a/tools/gce_setup/shared_startup_funcs.sh +++ /dev/null @@ -1,562 +0,0 @@ -#!/bin/bash -# 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. -# Contains common funcs shared by instance startup scripts. -# -# The funcs assume that the code is being run on a GCE instance during instance -# startup. - -function die() { - local msg="$0 failed" - if [[ -n $1 ]] - then - msg=$1 - fi - echo $msg - exit 1 -} - -# umount_by_disk_id umounts a disk given its disk_id. -umount_by_disk_id() { - local disk_id=$1 - [[ -n $disk_id ]] || { echo "missing arg: disk_id" >&2; return 1; } - - # Unmount the disk first - sudo umount /dev/disk/by-id/google-$disk_id || { echo "Could not unmount /mnt/disk-by-id/google-$disk_id" >&2; return 1; } -} - -# check_metadata confirms that the result of curling a metadata url does not -# contain 'Error 404' -check_metadata() { - local curl_output=$1 - [[ -n $curl_output ]] || { echo "missing arg: curl_output" >&2; return 1; } - - if [[ $curl_output =~ "Error 404" ]] - then - return 1 - fi - - return 0 -} - -# name_this_instance determines the current instance name. -name_this_instance() { - local the_full_host_name - the_full_host_name=$(load_metadata "http://metadata/computeMetadata/v1/instance/hostname") - check_metadata $the_full_host_name || return 1 - local the_instance - the_instance=$(echo $the_full_host_name | cut -d . -f 1 -) || { - echo "could not get the instance name from $the_full_host_name" >&2 - return 1 - } - - echo $the_instance -} - -# delete_this_instance deletes this GCE instance. (it will shutdown as a result -# of running this cmd) -delete_this_instance() { - local the_full_zone - the_full_zone=$(load_metadata "http://metadata/computeMetadata/v1/instance/zone") - check_metadata $the_full_zone || return 1 - local the_zone - the_zone=$(echo $the_full_zone | cut -d / -f 4 -) || { echo "could not get zone from $the_full_zone" >&2; return 1; } - - local the_full_host_name - the_full_host_name=$(load_metadata "http://metadata/computeMetadata/v1/instance/hostname") - check_metadata $the_full_host_name || return 1 - local the_instance - the_instance=$(echo $the_full_host_name | cut -d . -f 1 -) || { echo "could not get zone from $the_full_host_name" >&2; return 1; } - - echo "using gcloud compute instances delete to remove: ${the_instance}" - gcloud compute --quiet instances delete --delete-disks boot --zone $the_zone $the_instance -} - -# save_image_info updates the 'images' release info file on GCS. -save_image_info() { - local image_id=$1 - [[ -n $image_id ]] || { echo "missing arg: image_id" >&2; return 1; } - - local repo_gs_uri=$2 - [[ -n $repo_gs_uri ]] || { echo "missing arg: repo_gs_uri" >&2; return 1; } - - local sentinel="/tmp/$image_id.txt" - echo $image_id > $sentinel || { echo "could not create /tmp/$image_id.txt" >&2; return 1; } - - local gs_sentinel="$repo_gs_uri/images/info/LATEST" - gsutil cp $sentinel $gs_sentinel || { echo "failed to update $gs_sentinel" >&2; return 1; } -} - -# creates an image, getting the name and cloud storage uri from the supplied -# instance metadata. -create_image() { - local image_id - image_id=$(load_metadata "attributes/image_id") - [[ -n $image_id ]] || { echo "missing metadata: image_id" >&2; return 1; } - - local repo_gs_uri - repo_gs_uri=$(load_metadata "attributes/repo_gs_uri") - [[ -n $repo_gs_uri ]] || { echo "missing metadata: repo_gs_uri" >&2; return 1; } - - local the_project - the_project=$(load_metadata "http://metadata/computeMetadata/v1/project/project-id") - check_metadata $the_project || return 1 - - sudo gcimagebundle -d /dev/sda -o /tmp/ --log_file=/tmp/$image_id.log || { echo "image creation failed" >&2; return 1; } - image_path=$(ls /tmp/*.tar.gz) - image_gs_uri="$repo_gs_uri/images/$image_id.tar.gz" - - # copy the image to cloud storage - gsutil cp $image_path $image_gs_uri || { echo "failed to save image to $repo_gs_uri/$image_path " >&2; return 1; } - gcloud compute --project=$the_project images create \ - $image_id --source-uri $image_gs_uri || { echo "failed to register $image_gs_uri as $image_id" >&2; return 1; } - - save_image_info $image_id $repo_gs_uri -} - -# load_metadata curls a metadata url -load_metadata() { - local metadata_root=http://metadata/computeMetadata/v1 - local uri=$1 - [[ -n $uri ]] || { echo "missing arg: uri" >&2; return 1; } - - if [[ $uri =~ ^'attributes/' ]] - then - for a in $(curl -H "X-Google-Metadata-Request: True" $metadata_root/instance/attributes/) - do - [[ $uri =~ "/$a"$ ]] && { curl $metadata_root/instance/$uri -H "X-Google-Metadata-Request: True"; return; } - done - fi - - # if the uri is a full request uri - [[ $uri =~ ^$metadata_root ]] && { curl $uri -H "X-Google-Metadata-Request: True"; return; } -} - -install_python_module() { - local mod=$1 - [[ -z $mod ]] && { echo "missing arg: mod" >&2; return 1; } - - echo '------------------------------------' - echo 'Installing: $mod' - echo '------------------------------------' - echo - install_with_apt_get gcc python-dev python-setuptools - sudo apt-get install -y gcc python-dev python-setuptools - sudo easy_install -U pip - sudo pip uninstall -y $mod - sudo pip install -U $mod -} - -install_with_apt_get() { - local pkgs=$@ - echo '---------------------------' - echo 'Installing: $pkgs' - echo '---------------------------' - echo - sudo apt-get install -y $pkgs -} - -# pulls code from a git repo @HEAD to a local directory, removing the current version if present. -setup_git_dir() { - local git_http_repo=$1 - [[ -n $git_http_repo ]] || { echo "missing arg: git_http_repo" >&2; return 1; } - - local git_dir=$2 - [[ -n $git_dir ]] || { echo "missing arg: git_dir" >&2; return 1; } - - if [[ -e $git_dir ]] - then - rm -fR $git_dir || { echo "could not remove existing repo at $git_dir" >&2; return 1; } - fi - - local git_user - git_user=$(load_metadata "http://metadata/computeMetadata/v1/instance/service-accounts/default/email") - check_metadata $git_user || return 1 - urlsafe_git_user=$(echo $git_user | sed -e s/@/%40/g) || return 1 - - local access_token=$(load_metadata "http://metadata/computeMetadata/v1/instance/service-accounts/default/token?alt=text") - check_metadata $access_token || return 1 - local git_pwd=$(echo $access_token | cut -d' ' -f 2) || return 1 - - git clone https://$urlsafe_git_user:$git_pwd@$git_http_repo $git_dir -} - -# network_copy copies a file to another gce instance. -network_copy() { - local the_node=$1 - [[ -n $the_node ]] || { echo "missing arg: the_node" >&2; return 1; } - - local src=$2 - [[ -n $src ]] || { echo "missing arg: src" >&2; return 1; } - - local dst=$3 - [[ -n $dst ]] || { echo "missing arg: dst" >&2; return 1; } - - gcloud compute copy-files --zone=us-central1-b $src $node:$dst -} - -# gcs_copy copies a file to a location beneath a root gcs object path. -gcs_copy() { - local gce_root=$1 - [[ -n $gce_root ]] || { echo "missing arg: gce_root" >&2; return 1; } - - local src=$2 - [[ -n $src ]] || { echo "missing arg: src" >&2; return 1; } - - local dst=$3 - [[ -n $dst ]] || { echo "missing arg: dst" >&2; return 1; } - - gsutil cp $src $gce_root/$dst -} - -# find_named_ip finds the external ip address for a given name. -find_named_ip() { - local name=$1 - [[ -n $name ]] || { echo "missing arg: name" >&2; return 1; } - - gcloud compute addresses list | sed -e 's/ \+/ /g' | grep $name | cut -d' ' -f 3 -} - -# update_address_to updates this instances ip address to the reserved ip address with a given name -update_address_to() { - local name=$1 - [[ -n $name ]] || { echo "missing arg: name" >&2; return 1; } - - named_ip=$(find_named_ip $name) - [[ -n $named_ip ]] || { echo "did not find an address corresponding to $name" >&2; return 1; } - - local the_full_zone - the_full_zone=$(load_metadata "http://metadata/computeMetadata/v1/instance/zone") - check_metadata $the_full_zone || return 1 - local the_zone - the_zone=$(echo $the_full_zone | cut -d / -f 4 -) || { - echo "could not get zone from $the_full_zone" >&2 - return 1 - } - - local the_full_host_name - the_full_host_name=$(load_metadata "http://metadata/computeMetadata/v1/instance/hostname") - check_metadata $the_full_host_name || return 1 - local the_instance - the_instance=$(echo $the_full_host_name | cut -d . -f 1 -) || { - echo "could not determine the instance from $the_full_host_name" >&2 - return 1 - } - - gcloud compute instances delete-access-config --zone $the_zone $the_instance || { - echo "could not delete the access config for $the_instance" >&2 - return 1 - } - gcloud compute instances add-access-config --zone $the_zone $the_instance --address $named_ip || { - echo "could not update the access config for $the_instance to $named_ip" >&2 - return 1 - } -} - -# grpc_docker_add_docker_group -# -# Adds a docker group, restarts docker, relaunches the docker registry -grpc_docker_add_docker_group() { - [[ -f /var/log/GRPC_DOCKER_IS_UP ]] || { - echo "missing file /var/log/GRPC_DOCKER_IS_UP; either wrong machine or still starting up" >&2; - return 1 - } - sudo groupadd docker - - local user=$(id -un) - [[ -n ${user} ]] || { echo 'could not determine the user' >&2; return 1; } - sudo gpasswd -a ${user} docker - sudo service docker restart || return 1; - grpc_docker_launch_registry -} - -# grpc_dockerfile_pull <local_docker_parent_dir> -# -# requires: attributes/gs_dockerfile_root is set to cloud storage directory -# containing the dockerfile directory -grpc_dockerfile_pull() { - local dockerfile_parent=$1 - [[ -n $dockerfile_parent ]] || dockerfile_parent='/var/local' - - local gs_dockerfile_root=$(load_metadata "attributes/gs_dockerfile_root") - [[ -n $gs_dockerfile_root ]] || { echo "missing metadata: gs_dockerfile_root" >&2; return 1; } - - mkdir -p $dockerfile_parent - gsutil cp -R $gs_dockerfile_root $dockerfile_parent || { - echo "Did not copy docker files from $gs_dockerfile_root -> $dockerfile_parent" - return 1 - } - } - -# grpc_docker_launch_registry -# -# requires: attributes/gs_docker_reg is set to the cloud storage directory to -# use to store docker images -grpc_docker_launch_registry() { - local gs_docker_reg=$(load_metadata "attributes/gs_docker_reg") - [[ -n $gs_docker_reg ]] || { echo "missing metadata: gs_docker_reg" >&2; return 1; } - - local gs_bucket=$(echo $gs_docker_reg | sed -r 's|gs://([^/]*?).*|\1|g') - [[ -n $gs_bucket ]] || { - echo "could not determine cloud storage bucket from $gs_bucket" >&2; - return 1 - } - - local storage_path_env='' - local image_path=$(echo $gs_docker_reg | sed -r 's|gs://[^/]*(.*)|\1|g' | sed -e 's:/$::g') - [[ -n $image_path ]] && { - storage_path_env="-e STORAGE_PATH=$image_path" - } - - sudo docker run -d -e GCS_BUCKET=$gs_bucket $storage_path_env -p 5000:5000 google/docker-registry - # wait a couple of minutes max, for the registry to come up - local is_up=0 - for i in {1..24} - do - local secs=`expr $i \* 5` - echo "is docker registry up? waited for $secs secs ..." - wget -q localhost:5000 && { - echo 'docker registry is up!' - is_up=1 - break - } - sleep 5 - done - - [[ $is_up == 0 ]] && { - echo "docker registry not available after 120 seconds"; return 1; - } || return 0 -} - -# grpc_docker_pull_known -# -# This pulls a set of known docker images from a private docker registry to -# the local image cache. It re-labels the images so that FROM in dockerfiles -# used in dockerfiles running on the docker instance can find the images OK. -# -# optional: address of a grpc docker registry, the default is 0.0.0.0:5000 -grpc_docker_pull_known() { - local addr=$1 - [[ -n $addr ]] || addr="0.0.0.0:5000" - local known="base cxx php_base php ruby_base ruby java_base java go node_base node python_base python csharp_mono_base csharp_mono" - echo "... pulling docker images for '$known'" - for i in $known - do - echo "<--- grpc/$i" - sudo docker pull ${addr}/grpc/$i > /dev/null 2>&1 \ - && sudo docker tag ${addr}/grpc/$i grpc/$i || { - # log and continue - echo "docker op error: could not pull ${addr}/grpc/$i" - } - done -} - -# grpc_dockerfile_build_install -# -# requires: $1 is the label to apply to the docker image -# requires: $2 is a local directory containing a Dockerfile -# requires: there is a docker registry running on 5000, e.g, grpc_docker_launch_registry was run -# -# grpc_dockerfile_install "grpc/image" /var/local/dockerfile/grpc_image -grpc_dockerfile_install() { - local image_label=$1 - [[ -n $image_label ]] || { echo "$FUNCNAME: missing arg: image_label" >&2; return 1; } - local docker_img_url=0.0.0.0:5000/$image_label - - local dockerfile_dir=$2 - [[ -n $dockerfile_dir ]] || { echo "missing arg: dockerfile_dir" >&2; return 1; } - - local cache_opt='--no-cache' - local cache=$3 - [[ $cache == "cache=yes" ]] && { cache_opt=''; } - [[ $cache == "cache=1" ]] && { cache_opt=''; } - [[ $cache == "cache=true" ]] && { cache_opt=''; } - - [[ -d $dockerfile_dir ]] || { echo "$FUNCNAME: not a valid dir: $dockerfile_dir"; return 1; } - - # For specific base images, sync private files. - # - # - the ssh key, ssh certs and/or service account info. - [[ $image_label == "grpc/base" ]] && { - grpc_docker_sync_github_key $dockerfile_dir/.ssh 'base_ssh_key' || return 1; - } - [[ $image_label == "grpc/go" ]] && { - grpc_docker_sync_github_key $dockerfile_dir/.ssh 'go_ssh_key' || return 1; - grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; - } - [[ $image_label == "grpc/java_base" ]] && { - grpc_docker_sync_github_key $dockerfile_dir/.ssh 'java_base_ssh_key' || return 1; - } - [[ $image_label == "grpc/java" ]] && { - grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; - } - [[ $image_label == "grpc/ruby" ]] && { - grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; - grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; - } - [[ $image_label == "grpc/node" ]] && { - grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; - grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; - } - [[ $image_label == "grpc/php" ]] && { - grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; - grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; - } - [[ $image_label == "grpc/cxx" ]] && { - grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; - grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; - } - [[ $image_label == "grpc/python" ]] && { - grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; - grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; - } - [[ $image_label == "grpc/csharp_mono" ]] && { - grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; - grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; - } - - # For deb builds, copy the distpackages folder into the docker directory so - # that it can be installed using ADD distpackages distpackages. - [[ $image_label == "grpc/build_deb" ]] && { - cp -vR ~/distpackages $dockerfile_dir - } - - # TODO(temiola): maybe make cache/no-cache a func option? - sudo docker build --force-rm=true $cache_opt -t $image_label $dockerfile_dir || { - echo "$FUNCNAME:: build of $image_label <- $dockerfile_dir" - return 1 - } - sudo docker tag $image_label $docker_img_url || { - echo "$FUNCNAME: failed to tag $docker_img_url as $image_label" - return 1 - } - sudo docker push $docker_img_url || { - echo "$FUNCNAME: failed to push $docker_img_url" - return 1 - } -} - -# grpc_dockerfile_refresh -# -# requires: $1 is the label to apply to the docker image -# requires: $2 is a local directory containing a Dockerfile -# requires: there is a docker registry running on 5000, e.g, grpc_docker_launch_registry was run -# -# call-seq: -# grpc_dockerfile_refresh "grpc/mylabel" /var/local/dockerfile/dir_containing_my_dockerfile -grpc_dockerfile_refresh() { - grpc_dockerfile_install "$@" -} - -# grpc_docker_sync_github_key. -# -# Copies the docker github key from GCS to the target dir -# -# call-seq: -# grpc_docker_sync_github_key <target_dir> -grpc_docker_sync_github_key() { - local target_dir=$1 - [[ -n $target_dir ]] || { echo "$FUNCNAME: missing arg: target_dir" >&2; return 1; } - - local key_file=$2 - [[ -n $key_file ]] || { echo "$FUNCNAME: missing arg: key_file" >&2; return 1; } - - # determine the admin root; the parent of the dockerfile root, - local gs_dockerfile_root=$(load_metadata "attributes/gs_dockerfile_root") - [[ -n $gs_dockerfile_root ]] || { - echo "$FUNCNAME: missing metadata: gs_dockerfile_root" >&2 - return 1 - } - local gcs_admin_root=$(dirname $gs_dockerfile_root) - - # cp the file from gsutil to a known local area - local gcs_key_path=$gcs_admin_root/github/$key_file - local local_key_path=$target_dir/github.rsa - mkdir -p $target_dir || { - echo "$FUNCNAME: could not create dir: $target_dir" 1>&2 - return 1 - } - gsutil cp $src $gcs_key_path $local_key_path -} - -# grpc_docker_sync_roots_pem. -# -# Copies the root pems from GCS to the target dir -# -# call-seq: -# grpc_docker_sync_roots_pem <target_dir> -grpc_docker_sync_roots_pem() { - local target_dir=$1 - [[ -n $target_dir ]] || { echo "$FUNCNAME: missing arg: target_dir" >&2; return 1; } - - # determine the admin root; the parent of the dockerfile root, - local gs_dockerfile_root=$(load_metadata "attributes/gs_dockerfile_root") - [[ -n $gs_dockerfile_root ]] || { - echo "$FUNCNAME: missing metadata: gs_dockerfile_root" >&2 - return 1 - } - local gcs_admin_root=$(dirname $gs_dockerfile_root) - - # cp the file from gsutil to a known local area - local gcs_certs_path=$gcs_admin_root/cacerts/roots.pem - local local_certs_path=$target_dir/roots.pem - mkdir -p $target_dir || { - echo "$FUNCNAME: could not create dir: $target_dir" 1>&2 - return 1 - } - gsutil cp $src $gcs_certs_path $local_certs_path -} - -# grpc_docker_sync_service_account. -# -# Copies the service account from GCS to the target dir -# -# call-seq: -# grpc_docker_sync_service_account <target_dir> -grpc_docker_sync_service_account() { - local target_dir=$1 - [[ -n $target_dir ]] || { echo "$FUNCNAME: missing arg: target_dir" >&2; return 1; } - - # determine the admin root; the parent of the dockerfile root, - local gs_dockerfile_root=$(load_metadata "attributes/gs_dockerfile_root") - [[ -n $gs_dockerfile_root ]] || { - echo "$FUNCNAME: missing metadata: gs_dockerfile_root" >&2 - return 1 - } - local gcs_admin_root=$(dirname $gs_dockerfile_root) - - # cp the file from gsutil to a known local area - local gcs_acct_path=$gcs_admin_root/service_account/stubbyCloudTestingTest-ee3fce360ac5.json - local local_acct_path=$target_dir/stubbyCloudTestingTest-ee3fce360ac5.json - mkdir -p $target_dir || { - echo "$FUNCNAME: could not create dir: $target_dir" 1>&2 - return 1 - } - gsutil cp $src $gcs_acct_path $local_acct_path -} |