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: Add remoteCacheable key to execution log #13551

Closed
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 @@ -138,6 +138,7 @@ public void logSpawn(
builder.setTimeoutMillis(timeout.toMillis());
}
builder.setCacheable(Spawns.mayBeCached(spawn));
builder.setRemoteCacheable(Spawns.mayBeCachedRemotely(spawn));
builder.setExitCode(result.exitCode());
builder.setRemoteCacheHit(result.isCacheHit());
builder.setRunner(result.getRunnerName());
Expand Down
3 changes: 3 additions & 0 deletions src/main/protobuf/spawn.proto
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,7 @@ message SpawnExec {
// Its semantics varies greatly depending on the status field.
// Dependable: if status is empty, exit_code is guaranteed to be zero.
int32 exit_code = 15;

// Was the Spawn result allowed to be cached remotely.
bool remote_cacheable = 16;
}
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ public void testLogSpawn() throws Exception {
.setExitCode(23)
.setRemotable(true)
.setCacheable(true)
.setRemoteCacheable(true)
.setProgressMessage("my progress message")
.setMnemonic("MyMnemonic")
.setRunner("runner")
Expand Down Expand Up @@ -489,6 +490,7 @@ private static SpawnExec.Builder defaultSpawnExecBuilder(String cmd) {
.setMnemonic("Mnemonic")
.setRunner("runner")
.setStatus("NON_ZERO_EXIT")
.setExitCode(23);
.setExitCode(23)
.setRemoteCacheable(true);
}
}
13 changes: 13 additions & 0 deletions src/test/shell/bazel/bazel_execlog_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,17 @@ EOF
grep "listedOutputs" output.json || fail "log does not contain listed outputs"
}

function test_no_remote_cache() {
cat > BUILD <<'EOF'
genrule(
name = "action",
outs = ["out.txt"],
cmd = "echo hello > $(location out.txt)",
tags = ["no-remote-cache"],
)
EOF
bazel build //:action --execution_log_json_file=output.json 2>&1 >> $TEST_log || fail "could not build"
grep "\"remoteCacheable\": false" output.json || fail "log does not contain valid remoteCacheable entry"
}

run_suite "execlog_tests"