Skip to content

Commit

Permalink
DEVPROD-981 Support notifications when SUCCESSFUL task exceeds some d…
Browse files Browse the repository at this point in the history
…uration (evergreen-ci#2155)
  • Loading branch information
malikchaya2 authored Nov 21, 2023
1 parent 313f086 commit e0a30c7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/Notifications/form/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,10 @@ export const getEventSchema = (
{
properties: {
eventSelect: {
enum: [ProjectTriggers.TASK_EXCEEDS_DURATION],
enum: [
ProjectTriggers.TASK_EXCEEDS_DURATION,
ProjectTriggers.SUCCESSFUL_TASK_EXCEEDS_DURATION,
],
},
extraFields: {
type: "object" as "object",
Expand Down
18 changes: 17 additions & 1 deletion src/constants/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,25 @@ export const projectTriggers: Trigger = {
failureTypeSubscriberConfig,
],
},
[ProjectTriggers.SUCCESSFUL_TASK_EXCEEDS_DURATION]: {
trigger: TriggerType.SUCCESSFUL_EXCEEDS_DURATION,
resourceType: ResourceType.Task,
label: "The Runtime For a Successful Task Exceeds Some Duration",
regexSelectors: taskRegexSelectors,
extraFields: [
{
text: "Task Duration (Seconds)",
fieldType: "input",
key: ExtraFieldKey.TASK_DURATION_SECS,
format: "number",
default: "10",
},
],
},
[ProjectTriggers.TASK_EXCEEDS_DURATION]: {
trigger: TriggerType.EXCEEDS_DURATION,
resourceType: ResourceType.Task,
label: "The Runtime For a Task Exceeds Some Duration",
label: "The Runtime For Any Task Exceeds Some Duration",
regexSelectors: taskRegexSelectors,
extraFields: [
{
Expand Down Expand Up @@ -408,6 +423,7 @@ export const triggerToCopy = {
[TriggerType.FAMILY_SUCCESS]: "Success",
[TriggerType.RUNTIME_CHANGE]: "Runtime changes by %",
[TriggerType.EXCEEDS_DURATION]: "Runtime exceeds duration",
[TriggerType.SUCCESSFUL_EXCEEDS_DURATION]: "Runtime exceeds duration",
[TriggerType.TASK_STARTED]: "Task started",
[TriggerType.TASK_FAILED_OR_BLOCKED]: "Task failed or blocked",
[TriggerType.REGRESSION]: "Regression",
Expand Down
2 changes: 2 additions & 0 deletions src/types/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export enum TriggerType {
FAMILY_SUCCESS = "family-success",
RUNTIME_CHANGE = "runtime-change",
EXCEEDS_DURATION = "exceeds-duration",
SUCCESSFUL_EXCEEDS_DURATION = "successful-exceeds-duration",
TASK_STARTED = "task-started",
TASK_FAILED_OR_BLOCKED = "task-failed-or-blocked",
REGRESSION = "regression",
Expand Down Expand Up @@ -67,6 +68,7 @@ export enum ProjectTriggers {
PREVIOUS_PASSING_TASK_FAILS = "previous-passing-task-fails",
PREVIOUS_PASSING_TEST_FAILS = "previous-passing-test-fails",
TASK_EXCEEDS_DURATION = "project-task-exceeds-duration",
SUCCESSFUL_TASK_EXCEEDS_DURATION = "successful-project-task-exceeds-duration",
SUCCESSFUL_TASK_RUNTIME_CHANGES = "successful-task-runtime-change",
}

Expand Down

0 comments on commit e0a30c7

Please sign in to comment.