| Tim Windelschmidt | 6c851e2 | 2024-01-11 15:23:48 +0100 | [diff] [blame^] | 1 | # We recommend enforcing a policy that keeps your CI from being slowed down |
| 2 | # by individual test targets that should be optimized |
| 3 | # or split up into multiple test targets with sharding or manually. |
| 4 | # Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI. |
| 5 | # Docs: https://bazel.build/docs/user-manual#test-timeout-filters |
| 6 | test --test_timeout_filters=-eternal |
| 7 | |
| 8 | # Set this flag to enable re-tries of failed tests on CI. |
| 9 | # When any test target fails, try one or more times. This applies regardless of whether the "flaky" |
| 10 | # tag appears on the target definition. |
| 11 | # This is a tradeoff: legitimately failing tests will take longer to report, |
| 12 | # but we can paper over flaky tests that pass most of the time. |
| 13 | # The alternative is to mark every flaky test with the `flaky = True` attribute, but this requires |
| 14 | # the buildcop to make frequent code edits. |
| 15 | # Not recommended for local builds so that the flakiness is observed during development and thus |
| 16 | # is more likely to get fixed. |
| 17 | # Note that when passing after the first attempt, Bazel will give a special "FLAKY" status. |
| 18 | # Docs: https://bazel.build/docs/user-manual#flaky-test-attempts |
| 19 | test --flaky_test_attempts=2 |
| 20 | |
| 21 | # Announce all announces command options read from the bazelrc file(s) when starting up at the |
| 22 | # beginning of each Bazel invocation. This is very useful on CI to be able to inspect what Bazel rc |
| 23 | # settings are being applied on each run. |
| 24 | # Docs: https://bazel.build/docs/user-manual#announce-rc |
| 25 | build --announce_rc |
| 26 | |
| 27 | # Add a timestamp to each message generated by Bazel specifying the time at which the message was |
| 28 | # displayed. |
| 29 | # Docs: https://bazel.build/docs/user-manual#show-timestamps |
| 30 | build --show_timestamps |
| 31 | |
| 32 | # Only show progress every 60 seconds on CI. |
| 33 | # We want to find a compromise between printing often enough to show that the build isn't stuck, |
| 34 | # but not so often that we produce a long log file that requires a lot of scrolling. |
| 35 | # https://bazel.build/reference/command-line-reference#flag--show_progress_rate_limit |
| 36 | build --show_progress_rate_limit=60 |
| 37 | |
| 38 | # Use cursor controls in screen output. |
| 39 | # Docs: https://bazel.build/docs/user-manual#curses |
| 40 | build --curses=yes |
| 41 | |
| 42 | # Use colors to highlight output on the screen. Set to `no` if your CI does not display colors. |
| 43 | # Docs: https://bazel.build/docs/user-manual#color |
| 44 | build --color=yes |
| 45 | |
| 46 | # The terminal width in columns. Configure this to override the default value based on what your CI system renders. |
| 47 | # Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/runtime/UiOptions.java#L151 |
| 48 | build --terminal_columns=143 |
| 49 | |
| 50 | ###################################### |
| 51 | # Generic remote cache configuration # |
| 52 | ###################################### |
| 53 | |
| 54 | # Only download remote outputs of top level targets to the local machine. |
| 55 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_download_toplevel |
| 56 | build --remote_download_toplevel |
| 57 | |
| 58 | # The maximum amount of time to wait for remote execution and cache calls. |
| 59 | # https://bazel.build/reference/command-line-reference#flag--remote_timeout |
| 60 | build --remote_timeout=3600 |
| 61 | |
| 62 | # Upload locally executed action results to the remote cache. |
| 63 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results |
| 64 | build --remote_upload_local_results |
| 65 | |
| 66 | # Fall back to standalone local execution strategy if remote execution fails. If the grpc remote |
| 67 | # cache connection fails, it will fail the build, add this so it falls back to the local cache. |
| 68 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_local_fallback |
| 69 | build --remote_local_fallback |
| 70 | |
| 71 | # Fixes builds hanging on CI that get the TCP connection closed without sending RST packets. |
| 72 | # Docs: https://bazel.build/reference/command-line-reference#flag--grpc_keepalive_time |
| 73 | build --grpc_keepalive_time=30s |