Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote: properly reset state when using remote cache. Fixes #7555 #7562

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ private void checkClientServerCompatibility(

@Override
public void afterCommand() {
buildEventArtifactUploaderFactoryDelegate.reset();
actionContextProvider = null;
if (rpcLogFile != null) {
try {
rpcLogFile.close();
Expand All @@ -340,7 +342,6 @@ public void afterCommand() {
rpcLogFile = null;
}
}
buildEventArtifactUploaderFactoryDelegate.reset();
}

@Override
Expand Down
25 changes: 25 additions & 0 deletions src/test/shell/bazel/remote/remote_execution_http_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,29 @@ function test_directory_artifact_in_runfiles_skylark_rest_cache() {
|| fail "Remote cache hit generated different result"
}


function test_remote_state_cleared() {
# Regression test for https://github.com/bazelbuild/bazel/issues/7555
# Test that the remote cache state is properly reset, so that building without
# a remote cache works after previously building with a remote cache.
mkdir -p a
cat > a/BUILD <<'EOF'
genrule(
name = "gen1",
outs = ["out1"],
cmd = "touch $@",
)
EOF

bazel build \
--remote_http_cache=http://localhost:${http_port} \
//a:gen1 \
|| fail "Failed to build //a:gen1 with remote cache"

bazel clean

bazel build //a:gen1 \
|| fail "Failed to build //a:gen1 without remote cache"
}

run_suite "Remote execution and remote cache tests"