Skip to content

Commit

Permalink
Set keywords on appropriate lifecycle events. (bazelbuild#15440)
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 bazelbuild#14857.

PiperOrigin-RevId: 442902471

Co-authored-by: Benjamin Peterson <benjamin@engflow.com>
  • Loading branch information
2 people authored and meteorcloudy committed May 10, 2022
1 parent eed462a commit 6b293f4
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 6b293f4

Please sign in to comment.