-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rayci] add buildkite notification (#237)
Add buildkite notification upon build failures. Notification is sent to the owner of the build (buildkite syntax: https://buildkite.com/docs/pipelines/notifications). Enable notification for microcheck for now. This will allow folks to know build issues faster. Test: - CI - I added a failure into rayci CI in a previous commit and check that I get notified Signed-off-by: can <[email protected]>
- Loading branch information
1 parent
fc14165
commit 84c8bc5
Showing
7 changed files
with
89 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,10 +58,11 @@ func TestExecWithInput(t *testing.T) { | |
func TestMakeBuildInfo(t *testing.T) { | ||
flags := &Flags{} | ||
envs := newEnvsMap(map[string]string{ | ||
"RAYCI_BUILD_ID": "fake-build-id", | ||
"BUILDKITE_COMMIT": "abc123", | ||
"RAYCI_BRANCH": "foobar", | ||
"RAYCI_SELECT": "foo,bar,taz", | ||
"RAYCI_BUILD_ID": "fake-build-id", | ||
"BUILDKITE_COMMIT": "abc123", | ||
"BUILDKITE_BUILD_CREATOR_EMAIL": "[email protected]", | ||
"RAYCI_BRANCH": "foobar", | ||
"RAYCI_SELECT": "foo,bar,taz", | ||
}) | ||
|
||
info, err := makeBuildInfo(flags, envs) | ||
|
@@ -70,10 +71,11 @@ func TestMakeBuildInfo(t *testing.T) { | |
} | ||
|
||
want := &buildInfo{ | ||
buildID: "fake-build-id", | ||
launcherBranch: "foobar", | ||
gitCommit: "abc123", | ||
selects: []string{"foo", "bar", "taz"}, | ||
buildID: "fake-build-id", | ||
buildAuthorEmail: "[email protected]", | ||
launcherBranch: "foobar", | ||
gitCommit: "abc123", | ||
selects: []string{"foo", "bar", "taz"}, | ||
} | ||
if !reflect.DeepEqual(info, want) { | ||
t.Errorf("got %+v, want %+v", info, want) | ||
|
@@ -85,10 +87,11 @@ func TestMakeBuildInfo(t *testing.T) { | |
t.Fatal("make build info with selects overwrite: ", err) | ||
} | ||
want = &buildInfo{ | ||
buildID: "fake-build-id", | ||
launcherBranch: "foobar", | ||
gitCommit: "abc123", | ||
selects: []string{"gee", "goo"}, | ||
buildID: "fake-build-id", | ||
buildAuthorEmail: "[email protected]", | ||
launcherBranch: "foobar", | ||
gitCommit: "abc123", | ||
selects: []string{"gee", "goo"}, | ||
} | ||
if !reflect.DeepEqual(info, want) { | ||
t.Errorf("got %+v, want %+v", info, want) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,6 +293,38 @@ func TestMakePipeline(t *testing.T) { | |
t.Errorf("got step keys %v, want %v", keys, want) | ||
} | ||
}) | ||
|
||
t.Run("notify", func(t *testing.T) { | ||
buildID := "fakebuild" | ||
info := &buildInfo{ | ||
buildID: buildID, | ||
} | ||
|
||
config := *commonConfig | ||
config.NotifyOwnerOnFailure = false | ||
|
||
got, err := makePipeline(tmp, &config, info) | ||
if err != nil { | ||
t.Fatalf("makePipeline: %v", err) | ||
} | ||
if len(got.Notify) != 0 { | ||
t.Errorf("got %d notify, want 0", len(got.Notify)) | ||
} | ||
|
||
const email = "[email protected]" | ||
infoWithEmail := &buildInfo{ | ||
buildID: buildID, | ||
buildAuthorEmail: email, | ||
} | ||
config.NotifyOwnerOnFailure = true | ||
got, err = makePipeline(tmp, &config, infoWithEmail) | ||
if err != nil { | ||
t.Fatalf("makePipeline: %v", err) | ||
} | ||
if len(got.Notify) == 0 || got.Notify[0].Email != email || got.Notify[0].If != `build.state == "failing"` { | ||
t.Errorf(`got %v, want email %v, want if build.state == "failing"`, got.Notify, email) | ||
} | ||
}) | ||
} | ||
|
||
func TestSortPipelineGroups(t *testing.T) { | ||
|