Skip to content

Commit 0a2a43f

Browse files
benjaminpcopybara-github
authored andcommitted
Set keywords on appropriate lifecycle events.
The docs for the PublishLifecycleEventRequest say that the notification_keywords field should be set if the build event is InvocationAttemptStarted or BuildEnqueued. However, Bazel did not conform to this spec. Closes bazelbuild#14857. PiperOrigin-RevId: 442902471
1 parent 7222cab commit 0a2a43f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceProtoUtil.java

+8
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ public PublishLifecycleEventRequest.Builder lifecycleEvent(@Nullable String proj
161161
if (projectId != null) {
162162
builder.setProjectId(projectId);
163163
}
164+
switch (lifecycleEvent.getEventCase()) {
165+
case BUILD_ENQUEUED:
166+
case INVOCATION_ATTEMPT_STARTED:
167+
builder.addAllNotificationKeywords(getKeywords());
168+
break;
169+
default:
170+
break;
171+
}
164172
return builder;
165173
}
166174

src/test/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceProtoUtilTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public void testBuildEnqueued() {
7070
PublishLifecycleEventRequest.newBuilder()
7171
.setServiceLevel(ServiceLevel.INTERACTIVE)
7272
.setProjectId(PROJECT_ID)
73+
.addAllNotificationKeywords(EXPECTED_KEYWORDS)
7374
.setBuildEvent(
7475
OrderedBuildEvent.newBuilder()
7576
.setStreamId(
@@ -92,6 +93,7 @@ public void testInvocationAttemptStarted() {
9293
PublishLifecycleEventRequest.newBuilder()
9394
.setServiceLevel(ServiceLevel.INTERACTIVE)
9495
.setProjectId(PROJECT_ID)
96+
.addAllNotificationKeywords(EXPECTED_KEYWORDS)
9597
.setBuildEvent(
9698
OrderedBuildEvent.newBuilder()
9799
.setStreamId(

0 commit comments

Comments
 (0)