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

Upload all logs in BEP even with minimal upload #17110

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 @@ -63,6 +63,7 @@
class ByteStreamBuildEventArtifactUploader extends AbstractReferenceCounted
implements BuildEventArtifactUploader {
private static final Pattern TEST_LOG_PATTERN = Pattern.compile(".*/bazel-out/[^/]*/testlogs/.*");
private static final Pattern BUILD_LOG_PATTERN = Pattern.compile(".*/bazel-out/_tmp/actions/std(err|out)-.*");

private final Executor executor;
private final ExtendedEventHandler reporter;
Expand Down Expand Up @@ -216,14 +217,15 @@ private boolean shouldUpload(PathMetadata path) {
path.getDigest() != null && !path.isRemote() && !path.isDirectory() && !path.isOmitted();

if (remoteBuildEventUploadMode == RemoteBuildEventUploadMode.MINIMAL) {
result = result && (isTestLog(path) || isProfile(path));
result = result && (isLog(path) || isProfile(path));
}

return result;
}

private boolean isTestLog(PathMetadata path) {
return TEST_LOG_PATTERN.matcher(path.getPath().getPathString()).matches();
private boolean isLog(PathMetadata path) {
return TEST_LOG_PATTERN.matcher(path.getPath().getPathString()).matches() ||
BUILD_LOG_PATTERN.matcher(path.getPath().getPathString()).matches();
}

private boolean isProfile(PathMetadata path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,29 @@ EOF
expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data"
}

function test_upload_minimal_upload_buildlogs() {
mkdir -p a
cat > a/BUILD <<EOF
genrule(
name = 'foo',
outs = ['foo.txt'],
cmd = 'echo "stdout" && echo "stderr" >&2 && exit 1',
tags = ['no-remote'],
)
EOF

bazel build \
--remote_executor=grpc://localhost:${worker_port} \
--experimental_remote_build_event_upload=minimal \
--build_event_json_file=bep.json \
//a:foo >& $TEST_log || true

cat bep.json > $TEST_log
expect_log "stdout.*bytestream://" || fail "should upload stdout"
expect_log "stderr.*bytestream://" || fail "should upload stderr"
expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data"
}

function test_upload_minimal_upload_profile() {
mkdir -p a
cat > a/BUILD <<EOF
Expand All @@ -290,4 +313,4 @@ EOF
expect_log "mycommand.profile.gz.*bytestream://" || fail "should upload profile data"
}

run_suite "Remote build event uploader tests"
run_suite "Remote build event uploader tests"