From 6cb87bd157876b68b41703158380298b9a03c597 Mon Sep 17 00:00:00 2001 From: Hao Nguyen Date: Thu, 13 Dec 2018 15:20:25 -0800 Subject: [PATCH] Use docker for csharp, java_compatibility, and python_compatibility. Remove prepare_build_linux_rc that is no longer needed. --- java/compatibility_tests/v2.5.0/test.sh | 17 ++++++++++------- kokoro/linux/csharp/build.sh | 16 +++++++++++----- kokoro/linux/java_compatibility/build.sh | 16 +++++++++++----- kokoro/linux/prepare_build_linux_rc | 13 ------------- kokoro/linux/python_compatibility/build.sh | 16 +++++++++++----- 5 files changed, 43 insertions(+), 35 deletions(-) delete mode 100644 kokoro/linux/prepare_build_linux_rc diff --git a/java/compatibility_tests/v2.5.0/test.sh b/java/compatibility_tests/v2.5.0/test.sh index 2ea5b9302c..eea8328504 100755 --- a/java/compatibility_tests/v2.5.0/test.sh +++ b/java/compatibility_tests/v2.5.0/test.sh @@ -5,6 +5,9 @@ set -ex # Change to the script's directory. cd $(dirname $0) +MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository +MVN="mvn --batch-mode -e -X -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY" + # Version of the tests (i.e., the version of protobuf from where we extracted # these tests). TEST_VERSION=`grep "^ .*" pom.xml | sed "s| \(.*\)|\1|"` @@ -59,7 +62,7 @@ echo "Running compatibility tests between $VERSION_NUMBER and $OLD_VERSION" # Build and install protobuf-java-$VERSION_NUMBER.jar [ -f ../../core/target/protobuf-java-$VERSION_NUMBER.jar ] || { pushd ../.. - mvn install -Dmaven.test.skip=true + $MVN install -Dmaven.test.skip=true popd } @@ -81,7 +84,7 @@ chmod +x protoc # Test A.1: # protos: use new version # more_protos: use old version -mvn clean test \ +$MVN clean test \ -Dprotobuf.test.source.path=$(pwd)/protobuf \ -Dprotoc.path=$(pwd)/protoc \ -Dprotos.protoc.path=$(pwd)/../../../src/protoc \ @@ -90,7 +93,7 @@ mvn clean test \ # Test A.2: # protos: use old version # more_protos: use new version -mvn clean test \ +$MVN clean test \ -Dprotobuf.test.source.path=$(pwd)/protobuf \ -Dprotoc.path=$(pwd)/protoc \ -Dmore_protos.protoc.path=$(pwd)/../../../src/protoc \ @@ -103,12 +106,12 @@ mvn clean test \ # make it easier to run binary compatibility test (where we will need to run # the jar files directly). cd deps -mvn assembly:single +$MVN assembly:single cd .. cp -f deps/target/compatibility-test-deps-${TEST_VERSION}-jar-with-dependencies.jar deps.jar # Build the old version of all 3 artifacts. -mvn clean install -Dmaven.test.skip=true -Dprotoc.path=$(pwd)/protoc -Dprotobuf.version=$OLD_VERSION +$MVN clean install -Dmaven.test.skip=true -Dprotoc.path=$(pwd)/protoc -Dprotobuf.version=$OLD_VERSION cp -f protos/target/compatibility-protos-${TEST_VERSION}.jar protos.jar cp -f more_protos/target/compatibility-more-protos-${TEST_VERSION}.jar more_protos.jar cp -f tests/target/compatibility-tests-${TEST_VERSION}.jar tests.jar @@ -125,7 +128,7 @@ cd .. # Test B.2: update protos.jar only. cd protos -mvn clean package -Dmaven.test.skip=true -Dprotoc.path=$(pwd)/../../../../src/protoc -Dprotobuf.version=$VERSION_NUMBER +$MVN clean package -Dmaven.test.skip=true -Dprotoc.path=$(pwd)/../../../../src/protoc -Dprotobuf.version=$VERSION_NUMBER cd .. cd protobuf java -cp ../../../core/target/protobuf-java-$VERSION_NUMBER.jar:../protos/target/compatibility-protos-${TEST_VERSION}.jar:../more_protos.jar:../tests.jar:../deps.jar org.junit.runner.JUnitCore $TESTS @@ -133,7 +136,7 @@ cd .. # Test B.3: update more_protos.jar only. cd more_protos -mvn clean package -Dmaven.test.skip=true -Dprotoc.path=$(pwd)/../../../../src/protoc -Dprotobuf.version=$VERSION_NUMBER +$MVN clean package -Dmaven.test.skip=true -Dprotoc.path=$(pwd)/../../../../src/protoc -Dprotobuf.version=$VERSION_NUMBER cd .. cd protobuf java -cp ../../../core/target/protobuf-java-$VERSION_NUMBER.jar:../protos.jar:../more_protos/target/compatibility-more-protos-${TEST_VERSION}.jar:../tests.jar:../deps.jar org.junit.runner.JUnitCore $TESTS diff --git a/kokoro/linux/csharp/build.sh b/kokoro/linux/csharp/build.sh index de178b844d..27cb549dac 100755 --- a/kokoro/linux/csharp/build.sh +++ b/kokoro/linux/csharp/build.sh @@ -1,11 +1,17 @@ #!/bin/bash # -# Build file to set up and run tests +# This is the top-level script we give to Kokoro as the entry point for +# running the "pull request" project: +# +# This script selects a specific Dockerfile (for building a Docker image) and +# a script to run inside that image. Then we delegate to the general +# build_and_run_docker.sh script. # Change to repo root cd $(dirname $0)/../../.. -# Prepare worker environment to run tests -source kokoro/linux/prepare_build_linux_rc - -./tests.sh csharp +export DOCKERFILE_DIR=kokoro/linux/64-bit +export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh +export OUTPUT_DIR=testoutput +export TEST_SET="csharp" +./kokoro/linux/build_and_run_docker.sh diff --git a/kokoro/linux/java_compatibility/build.sh b/kokoro/linux/java_compatibility/build.sh index b1ef27963f..de88454fc7 100755 --- a/kokoro/linux/java_compatibility/build.sh +++ b/kokoro/linux/java_compatibility/build.sh @@ -1,11 +1,17 @@ #!/bin/bash # -# Build file to set up and run tests +# This is the top-level script we give to Kokoro as the entry point for +# running the "pull request" project: +# +# This script selects a specific Dockerfile (for building a Docker image) and +# a script to run inside that image. Then we delegate to the general +# build_and_run_docker.sh script. # Change to repo root cd $(dirname $0)/../../.. -# Prepare worker environment to run tests -source kokoro/linux/prepare_build_linux_rc - -./tests.sh java_compatibility +export DOCKERFILE_DIR=kokoro/linux/64-bit +export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh +export OUTPUT_DIR=testoutput +export TEST_SET="java_compatibility" +./kokoro/linux/build_and_run_docker.sh diff --git a/kokoro/linux/prepare_build_linux_rc b/kokoro/linux/prepare_build_linux_rc deleted file mode 100644 index d9b3bec3aa..0000000000 --- a/kokoro/linux/prepare_build_linux_rc +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# Source this rc script to prepare the environment for Linux builds - -# Set up dotnet -sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" > /etc/apt/sources.list.d/dotnetdev.list' -sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF -sudo apt-get update -# We use the .NET Core SDK 2.x to build... -sudo apt-get install -y dotnet-sdk-2.1.3 -# But we also need the 1.x framework to test against, as we -# target netstandard1.x -sudo apt-get install -y dotnet-sharedframework-microsoft.netcore.app-1.0.5 diff --git a/kokoro/linux/python_compatibility/build.sh b/kokoro/linux/python_compatibility/build.sh index 041e65ffb6..1ba35394d1 100755 --- a/kokoro/linux/python_compatibility/build.sh +++ b/kokoro/linux/python_compatibility/build.sh @@ -1,11 +1,17 @@ #!/bin/bash # -# Build file to set up and run tests +# This is the top-level script we give to Kokoro as the entry point for +# running the "pull request" project: +# +# This script selects a specific Dockerfile (for building a Docker image) and +# a script to run inside that image. Then we delegate to the general +# build_and_run_docker.sh script. # Change to repo root cd $(dirname $0)/../../.. -# Prepare worker environment to run tests -source kokoro/linux/prepare_build_linux_rc - -./tests.sh python_compatibility +export DOCKERFILE_DIR=kokoro/linux/64-bit +export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh +export OUTPUT_DIR=testoutput +export TEST_SET="python_compatibility" +./kokoro/linux/build_and_run_docker.sh