diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java index 6adf70bd56dec4..ae3b6fcbd58374 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java @@ -64,7 +64,6 @@ import com.google.devtools.build.lib.remote.downloader.GrpcRemoteDownloader; import com.google.devtools.build.lib.remote.http.HttpException; import com.google.devtools.build.lib.remote.logging.LoggingInterceptor; -import com.google.devtools.build.lib.remote.options.RemoteBuildEventUploadMode; import com.google.devtools.build.lib.remote.options.RemoteOptions; import com.google.devtools.build.lib.remote.options.RemoteOutputsMode; import com.google.devtools.build.lib.remote.util.DigestUtil; @@ -756,17 +755,7 @@ public void afterAnalysis( // Separating the conditions for readability. private boolean shouldParseNoCacheOutputs() { - if (remoteOptions == null - || remoteOptions.remoteBuildEventUploadMode != RemoteBuildEventUploadMode.ALL - || !remoteOptions.incompatibleRemoteBuildEventUploadRespectNoCache) { - return false; - } - - if (actionContextProvider == null || actionContextProvider.getRemoteCache() == null) { - return false; - } - - return buildEventArtifactUploaderFactoryDelegate.get() != null; + return false; } private void parseNoCacheOutputs(AnalysisResult analysisResult) { diff --git a/src/main/java/com/google/devtools/build/lib/remote/options/RemoteOptions.java b/src/main/java/com/google/devtools/build/lib/remote/options/RemoteOptions.java index 6ae8549fd3aead..c2e770b60aac4e 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/options/RemoteOptions.java +++ b/src/main/java/com/google/devtools/build/lib/remote/options/RemoteOptions.java @@ -266,9 +266,7 @@ public final class RemoteOptions extends CommonRemoteOptions { deprecationWarning = "--incompatible_remote_build_event_upload_respect_no_cache has been deprecated in favor" + " of --remote_build_event_upload=minimal.", - help = - "If set to true, outputs referenced by BEP are not uploaded to remote cache if the" - + " generating action cannot be cached remotely.") + help = "Deprecated. No-op. Use --remote_build_event_upload=minimal instead.") public boolean incompatibleRemoteBuildEventUploadRespectNoCache; @Option( diff --git a/src/test/shell/bazel/remote/remote_execution_test.sh b/src/test/shell/bazel/remote/remote_execution_test.sh index ef98dfaf9059f4..a29a0dbf39fb84 100755 --- a/src/test/shell/bazel/remote/remote_execution_test.sh +++ b/src/test/shell/bazel/remote/remote_execution_test.sh @@ -2495,270 +2495,6 @@ EOF expect_not_log "WARNING: Remote Cache:" } -function test_uploader_respect_no_cache() { - mkdir -p a - cat > a/BUILD < \$@", - tags = ["no-cache"], -) -EOF - - bazel build \ - --remote_cache=grpc://localhost:${worker_port} \ - --incompatible_remote_build_event_upload_respect_no_cache \ - --remote_build_event_upload=all \ - --build_event_json_file=bep.json \ - //a:foo >& $TEST_log || fail "Failed to build" - - cat bep.json > $TEST_log - expect_not_log "a:foo.*bytestream://" || fail "local files are converted" - expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data" -} - -function test_uploader_respect_no_cache_minimal() { - mkdir -p a - cat > a/BUILD < \$@", - tags = ["no-cache"], -) -EOF - - bazel build \ - --remote_cache=grpc://localhost:${worker_port} \ - --remote_download_minimal \ - --incompatible_remote_build_event_upload_respect_no_cache \ - --remote_build_event_upload=all \ - --build_event_json_file=bep.json \ - //a:foo >& $TEST_log || fail "Failed to build" - - cat bep.json > $TEST_log - expect_not_log "a:foo.*bytestream://" || fail "local files are converted" - expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data" -} - -function test_uploader_alias_action_respect_no_cache() { - mkdir -p a - cat > a/BUILD < \$@", - tags = ["no-cache"], -) - -alias( - name = 'foo-alias', - actual = '//a:foo', -) -EOF - - bazel build \ - --remote_cache=grpc://localhost:${worker_port} \ - --incompatible_remote_build_event_upload_respect_no_cache \ - --remote_build_event_upload=all \ - --build_event_json_file=bep.json \ - //a:foo-alias >& $TEST_log || fail "Failed to build" - - cat bep.json > $TEST_log - expect_not_log "a:foo.*bytestream://" - expect_log "command.profile.gz.*bytestream://" -} - -function test_uploader_respect_no_cache_trees() { - mkdir -p a - cat > a/output_dir.bzl <<'EOF' -def _gen_output_dir_impl(ctx): - output_dir = ctx.actions.declare_directory(ctx.attr.outdir) - ctx.actions.run_shell( - outputs = [output_dir], - inputs = [], - command = """ - mkdir -p $1/sub; \ - index=0; while ((index<10)); do echo $index >$1/$index.txt; index=$(($index+1)); done - echo "Shuffle, duffle, muzzle, muff" > $1/sub/bar - """, - arguments = [output_dir.path], - execution_requirements = {"no-cache": ""}, - ) - return [ - DefaultInfo(files = depset(direct = [output_dir])), - ] -gen_output_dir = rule( - implementation = _gen_output_dir_impl, - attrs = { - "outdir": attr.string(mandatory = True), - }, -) -EOF - - cat > a/BUILD <& $TEST_log || fail "Failed to build" - - cat bep.json > $TEST_log - expect_not_log "a:foo.*bytestream://" || fail "local tree files are converted" - expect_not_log "a/dir/.*bytestream://" || fail "local tree files are converted" - expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data" -} - -function test_uploader_respect_no_upload_results() { - mkdir -p a - cat > a/BUILD < \$@", -) -EOF - - bazel build \ - --remote_cache=grpc://localhost:${worker_port} \ - --remote_upload_local_results=false \ - --incompatible_remote_build_event_upload_respect_no_cache \ - --remote_build_event_upload=all \ - --build_event_json_file=bep.json \ - //a:foo >& $TEST_log || fail "Failed to build" - - cat bep.json > $TEST_log - expect_not_log "a:foo.*bytestream://" || fail "local files are converted" - expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data" -} - -function test_uploader_respect_no_upload_results_combined_cache() { - mkdir -p a - cat > a/BUILD < \$@", -) -EOF - - cache_dir=$(mktemp -d) - - bazel build \ - --remote_cache=grpc://localhost:${worker_port} \ - --disk_cache=$cache_dir \ - --remote_upload_local_results=false \ - --incompatible_remote_build_event_upload_respect_no_cache \ - --remote_build_event_upload=all \ - --build_event_json_file=bep.json \ - //a:foo >& $TEST_log || fail "Failed to build" - - cat bep.json > $TEST_log - expect_not_log "a:foo.*bytestream://" || fail "local files are converted" - expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data" - remote_cas_files="$(count_remote_cas_files)" - [[ "$remote_cas_files" == 1 ]] || fail "Expected 1 remote cas entries, not $remote_cas_files" -} - -function test_remote_exec_convert_remote_file() { - mkdir -p a - cat > a/BUILD <<'EOF' -sh_test( - name = "test", - srcs = ["test.sh"], -) -EOF - cat > a/test.sh <<'EOF' -#!/bin/bash -set -e -echo \"foo\" -exit 0 -EOF - chmod 755 a/test.sh - - bazel test \ - --remote_executor=grpc://localhost:${worker_port} \ - --build_event_json_file=bep.json \ - --noremote_upload_local_results \ - --incompatible_remote_build_event_upload_respect_no_cache \ - --remote_build_event_upload=all \ - //a:test >& $TEST_log || fail "Failed to test //a:test" - - cat bep.json > $TEST_log - expect_not_log "test\.log.*file://" || fail "remote files generated in remote execution are not converted" - expect_log "test\.log.*bytestream://" || fail "remote files generated in remote execution are not converted" -} - - -function test_uploader_ignore_disk_cache_of_combined_cache() { - mkdir -p a - cat > a/BUILD < \$@", - tags = ["no-cache"], -) -EOF - - cache_dir=$(mktemp -d) - - bazel build \ - --remote_cache=grpc://localhost:${worker_port} \ - --disk_cache=$cache_dir \ - --incompatible_remote_build_event_upload_respect_no_cache \ - --remote_build_event_upload=all \ - --build_event_json_file=bep.json \ - //a:foo >& $TEST_log || fail "Failed to build" - - cat bep.json > $TEST_log - expect_not_log "a:foo.*bytestream://" || fail "local files are converted" - expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data" - - disk_cas_files="$(count_disk_cas_files $cache_dir)" - [[ "$disk_cas_files" == 0 ]] || fail "Expected 0 disk cas entries, not $disk_cas_files" -} - -function test_uploader_incompatible_remote_results_ignore_disk() { - mkdir -p a - cat > a/BUILD < \$@", - tags = ["no-remote"], -) -EOF - - cache_dir=$(mktemp -d) - - bazel build \ - --remote_cache=grpc://localhost:${worker_port} \ - --disk_cache=$cache_dir \ - --incompatible_remote_build_event_upload_respect_no_cache \ - --remote_build_event_upload=all \ - --incompatible_remote_results_ignore_disk \ - --build_event_json_file=bep.json \ - //a:foo >& $TEST_log || fail "Failed to build" - - cat bep.json > $TEST_log - expect_not_log "a:foo.*bytestream://" || fail "local files are converted" - expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data" - - disk_cas_files="$(count_disk_cas_files $cache_dir)" - # foo.txt, stdout and stderr for action 'foo' - [[ "$disk_cas_files" == 3 ]] || fail "Expected 3 disk cas entries, not $disk_cas_files" -} - function test_missing_outputs_dont_upload_action_result() { # Test that if declared outputs are not created, even the exit code of action # is 0, we treat this as failed and don't upload action result.