Skip to content

Commit

Permalink
Rollout the "override external repositories" and the "shared install …
Browse files Browse the repository at this point in the history
…base" feature on Bazel CI.

This removes basically all I/O and network traffic caused by integration tests, which means we are now... CPU bound! Great. But now that this constant and massive overhead is gone, we can harvest the ripe, low hanging, extremely tasty performance fruit in our tests and do things like a423ac2, where just two lines of change can make a test 2x faster.

This also sets the "--sandbox_default_allow_network=false" flag for all post- and presubmit jobs, which means that our tests (except the ones tagged with "requires-network") now run without networking access - a great win for hermeticity.

RELNOTES: None.
PiperOrigin-RevId: 292221142
  • Loading branch information
philwo authored and copybara-github committed Jan 29, 2020
1 parent 88e8c46 commit 9ae6368
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 12 deletions.
40 changes: 34 additions & 6 deletions .bazelci/postsubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
test_targets:
- "//scripts/..."
- "//src/java_tools/..."
Expand All @@ -36,11 +41,16 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
test_targets:
- "//scripts/..."
- "//src/java_tools/..."
Expand All @@ -63,11 +73,16 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
# Configure and enable tests that require access to the network.
- "--test_env=REMOTE_NETWORK_ADDRESS=bazel.build:80"
test_targets:
Expand Down Expand Up @@ -96,11 +111,16 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
test_targets:
- "//src/test/shell/bazel:cc_integration_test"
include_json_profile:
Expand All @@ -111,13 +131,18 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_flags:
- "--apple_platform_type=macos"
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
# Configure and enable tests that require access to the network.
- "--test_env=REMOTE_NETWORK_ADDRESS=bazel.build:80"
test_targets:
Expand All @@ -141,17 +166,20 @@ tasks:
windows:
batch_commands:
- powershell -Command "(Get-Content WORKSPACE) -Replace '# android_', 'android_' | Set-Content WORKSPACE"
- mkdir D:\\bazeltest
build_flags:
- "--copt=-w"
- "--host_copt=-w"
build_targets:
- "//src:bazel.exe"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--copt=-w"
- "--host_copt=-w"
- "--test_env=JAVA_HOME"
- "--test_timeout=1200"
- "--test_env=TEST_INSTALL_BASE=D:/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
test_targets:
- "//src:all_windows_tests"
include_json_profile:
Expand Down
40 changes: 34 additions & 6 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
test_targets:
- "//scripts/..."
- "//src/java_tools/..."
Expand All @@ -35,11 +40,16 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
test_targets:
- "//scripts/..."
- "//src/java_tools/..."
Expand All @@ -60,11 +70,16 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
# Configure and enable tests that require access to the network.
- "--test_env=REMOTE_NETWORK_ADDRESS=bazel.build:80"
test_targets:
Expand All @@ -90,11 +105,16 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
test_targets:
- "//src/test/shell/bazel:cc_integration_test"
macos:
Expand All @@ -103,13 +123,18 @@ tasks:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
- mkdir $HOME/bazeltest
build_flags:
- "--apple_platform_type=macos"
build_targets:
- "//src:bazel"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--test_timeout=1200"
- "--sandbox_default_allow_network=false"
- "--sandbox_writable_path=$HOME/bazeltest"
- "--test_env=TEST_INSTALL_BASE=$HOME/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
# Configure and enable tests that require access to the network.
- "--test_env=REMOTE_NETWORK_ADDRESS=bazel.build:80"
test_targets:
Expand All @@ -134,17 +159,20 @@ tasks:
shards: 4
batch_commands:
- powershell -Command "(Get-Content WORKSPACE) -Replace '# android_', 'android_' | Set-Content WORKSPACE"
- mkdir D:\\bazeltest
build_flags:
- "--copt=-w"
- "--host_copt=-w"
build_targets:
- "//src:bazel.exe"
- "//src:bazel_jdk_minimal"
- "//src:test_repos"
test_flags:
- "--copt=-w"
- "--host_copt=-w"
- "--test_env=JAVA_HOME"
- "--test_timeout=1200"
- "--test_env=TEST_INSTALL_BASE=D:/bazeltest/install_base"
- "--test_env=TEST_REPOSITORY_HOME=$OUTPUT_BASE/external"
test_targets:
- "//src:all_windows_tests"
rbe_ubuntu1604:
Expand Down

0 comments on commit 9ae6368

Please sign in to comment.