Skip to content

Commit

Permalink
Set keywords on appropriate lifecycle events.
Browse files Browse the repository at this point in the history
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 #14857.

PiperOrigin-RevId: 442902471
  • Loading branch information
benjaminp authored and Copybara-Service committed Apr 19, 2022
1 parent 7222cab commit 0a2a43f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ public PublishLifecycleEventRequest.Builder lifecycleEvent(@Nullable String proj
if (projectId != null) {
builder.setProjectId(projectId);
}
switch (lifecycleEvent.getEventCase()) {
case BUILD_ENQUEUED:
case INVOCATION_ATTEMPT_STARTED:
builder.addAllNotificationKeywords(getKeywords());
break;
default:
break;
}
return builder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public void testBuildEnqueued() {
PublishLifecycleEventRequest.newBuilder()
.setServiceLevel(ServiceLevel.INTERACTIVE)
.setProjectId(PROJECT_ID)
.addAllNotificationKeywords(EXPECTED_KEYWORDS)
.setBuildEvent(
OrderedBuildEvent.newBuilder()
.setStreamId(
Expand All @@ -92,6 +93,7 @@ public void testInvocationAttemptStarted() {
PublishLifecycleEventRequest.newBuilder()
.setServiceLevel(ServiceLevel.INTERACTIVE)
.setProjectId(PROJECT_ID)
.addAllNotificationKeywords(EXPECTED_KEYWORDS)
.setBuildEvent(
OrderedBuildEvent.newBuilder()
.setStreamId(
Expand Down

0 comments on commit 0a2a43f

Please sign in to comment.