diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2018-12-21 15:41:48 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-21 15:42:59 -0800 |
commit | 7a3b4b7bdd7d1410190ab6e61a6c2e66105fa975 (patch) | |
tree | 03e71f5e312a7c943f4dca6c1fdbb91c3bea8910 /kokoro | |
parent | 89b18f7108e2c3a04169e0b79b615429fbb08a99 (diff) |
Configure Kokoro build with RBE.
PiperOrigin-RevId: 226552586
Change-Id: I078502d46e2e4a8252ef0477309af8d3ffbbf88d
Diffstat (limited to 'kokoro')
-rw-r--r-- | kokoro/common.cfg | 29 | ||||
-rwxr-xr-x | kokoro/run_tests.sh | 44 |
2 files changed, 68 insertions, 5 deletions
diff --git a/kokoro/common.cfg b/kokoro/common.cfg new file mode 100644 index 000000000..f6776ae84 --- /dev/null +++ b/kokoro/common.cfg @@ -0,0 +1,29 @@ +# Give Kokoro access to Remote Build Executor (RBE) service account key. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73898 + keyname: "kokoro-rbe-service-account" + } + } +} + +# Configure bazel to access RBE. +bazel_setting { + # Our GCP project name + project_id: "copybara-shentu" + + # Use RBE for execution as well as caching. + local_execution: false + + # This must match the values in the job config. + auth_credential: { + keystore_config_id: 73898 + keyname: "kokoro-rbe-service-account" + } + + # Do not change unless you know what you are doing. + bes_backend_address: "buildeventservice.googleapis.com" + foundry_backend_address: "remotebuildexecution.googleapis.com" + upsalite_frontend_address: "https://source.cloud.google.com" +} diff --git a/kokoro/run_tests.sh b/kokoro/run_tests.sh index 0acb92d7a..3f9c48865 100755 --- a/kokoro/run_tests.sh +++ b/kokoro/run_tests.sh @@ -24,9 +24,16 @@ set -eux readonly WORKSPACE_DIR="${PWD}/git/repo" +# Used to configure RBE. +readonly CLOUD_PROJECT_ID="copybara-shentu" +readonly RBE_PROJECT_ID="projects/${CLOUD_PROJECT_ID}/instances/default_instance" + # Random runtime name to avoid collisions. readonly RUNTIME="runsc_test_$((RANDOM))" +# Packages that will be built and tested. +# TODO: Include syscall tests in "test" directory. +readonly TEST_PACKAGES=("//pkg/..." "//runsc/..." "//tools/...") ####################### # BAZEL CONFIGURATION # @@ -37,6 +44,27 @@ use_bazel.sh latest which bazel bazel version +# Bazel start-up flags for RBE. +BAZEL_RBE_FLAGS=( + "--bazelrc=${WORKSPACE_DIR}/.bazelrc_rbe" +) + +# General Bazel build/test flags. +BAZEL_BUILD_FLAGS=( + "--show_timestamps" + "--test_output=errors" + "--keep_going" + "--verbose_failures=true" +) + +# Bazel build/test for RBE, a super-set of BAZEL_BUILD_FLAGS. +BAZEL_BUILD_RBE_FLAGS=( + "${BAZEL_BUILD_FLAGS[@]}" + "--config=remote" + "--project_id=${CLOUD_PROJECT_ID}" + "--remote_instance_name=${RBE_PROJECT_ID}" + "--auth_credentials=${KOKORO_BAZEL_AUTH_CREDENTIAL}" +) #################### # Helper Functions # @@ -44,16 +72,20 @@ bazel version build_everything() { cd ${WORKSPACE_DIR} - # TODO: Include "test" directory. - bazel build //pkg/... //runsc/... //tools/... + bazel \ + "${BAZEL_RBE_FLAGS[@]}" \ + build \ + "${BAZEL_BUILD_RBE_FLAGS[@]}" \ + "${TEST_PACKAGES[@]}" } # Run simple tests runs the tests that require no special setup or # configuration. run_simple_tests() { cd ${WORKSPACE_DIR} - # TODO: Include "test" directory. - bazel test --test_output=errors //pkg/... //runsc/... //tools/... + bazel test \ + "${BAZEL_BUILD_FLAGS[@]}" \ + "${TEST_PACKAGES[@]}" } install_runtime() { @@ -121,7 +153,9 @@ run_docker_tests() { declare -a variations=("" "-kvm" "-hostnet" "-overlay") for v in "${variations[@]}"; do # Run runsc tests with docker that are tagged manual. - bazel test --test_output=errors --test_env=RUNSC_RUNTIME="${RUNTIME}${v}" \ + bazel test \ + "${BAZEL_BUILD_FLAGS[@]}" \ + --test_env=RUNSC_RUNTIME="${RUNTIME}${v}" \ //runsc/test/image:image_test \ //runsc/test/integration:integration_test done |