Skip to content

Commit

Permalink
Upload all logs in BEP even with minimal upload
Browse files Browse the repository at this point in the history
When using --experimental_remote_build_event_upload=minimal, build
action logs won't get uploaded. These logs are still very useful as when
a build action fails, one would need to inspect them to figure out what
has gone wrong. Forcing uploading stdout and stderr with this change.
  • Loading branch information
exoson committed Jan 2, 2023
1 parent 763f966 commit bc1a360
Showing 1 changed file with 5 additions and 3 deletions.
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

0 comments on commit bc1a360

Please sign in to comment.