@@ -55,8 +55,11 @@ def execute_via_group_type_registry(job: WorkflowJob, action: Action, detector:
55
55
56
56
57
57
def execute_via_metric_alert_handler (job : WorkflowJob , action : Action , detector : Detector ) -> None :
58
- # TODO(iamrajjoshi): Implement this, it should be used for the ticketing actions
59
- pass
58
+ """
59
+ This exists so that all ticketing actions can use the same handler as issue alerts since thats the only way we can
60
+ ensure that the same thread is used for the notification action.
61
+ """
62
+ IssueAlertRegistryInvoker .handle_workflow_action (job , action , detector )
60
63
61
64
62
65
class NotificationActionHandler (ActionHandler , ABC ):
@@ -89,6 +92,36 @@ def execute(
89
92
execute_via_group_type_registry (job , action , detector )
90
93
91
94
95
+ class TicketingActionHandler (ActionHandler , ABC ):
96
+ config_schema = {
97
+ "$schema" : "https://json-schema.org/draft/2020-12/schema" ,
98
+ "description" : "The configuration schema for a Ticketing Action" ,
99
+ "type" : "object" ,
100
+ "properties" : {
101
+ "target_identifier" : {
102
+ "type" : ["null" ],
103
+ },
104
+ "target_display" : {
105
+ "type" : ["null" ],
106
+ },
107
+ "target_type" : {
108
+ "type" : ["integer" ],
109
+ "enum" : [* ActionTarget ],
110
+ },
111
+ },
112
+ }
113
+
114
+ data_schema = {}
115
+
116
+ @staticmethod
117
+ def execute (
118
+ job : WorkflowJob ,
119
+ action : Action ,
120
+ detector : Detector ,
121
+ ) -> None :
122
+ execute_via_metric_alert_handler (job , action , detector )
123
+
124
+
92
125
@action_handler_registry .register (Action .Type .DISCORD )
93
126
class DiscordActionHandler (NotificationActionHandler ):
94
127
group = NotificationActionHandler .ActionGroup .NOTIFICATION
@@ -130,27 +163,27 @@ class PluginActionHandler(NotificationActionHandler):
130
163
131
164
132
165
@action_handler_registry .register (Action .Type .GITHUB )
133
- class GithubActionHandler (NotificationActionHandler ):
166
+ class GithubActionHandler (TicketingActionHandler ):
134
167
group = NotificationActionHandler .ActionGroup .TICKET_CREATION
135
168
136
169
137
170
@action_handler_registry .register (Action .Type .GITHUB_ENTERPRISE )
138
- class GithubEnterpriseActionHandler (NotificationActionHandler ):
171
+ class GithubEnterpriseActionHandler (TicketingActionHandler ):
139
172
group = NotificationActionHandler .ActionGroup .TICKET_CREATION
140
173
141
174
142
175
@action_handler_registry .register (Action .Type .JIRA )
143
- class JiraActionHandler (NotificationActionHandler ):
176
+ class JiraActionHandler (TicketingActionHandler ):
144
177
group = NotificationActionHandler .ActionGroup .TICKET_CREATION
145
178
146
179
147
180
@action_handler_registry .register (Action .Type .JIRA_SERVER )
148
- class JiraServerActionHandler (NotificationActionHandler ):
181
+ class JiraServerActionHandler (TicketingActionHandler ):
149
182
group = NotificationActionHandler .ActionGroup .TICKET_CREATION
150
183
151
184
152
185
@action_handler_registry .register (Action .Type .AZURE_DEVOPS )
153
- class AzureDevopsActionHandler (NotificationActionHandler ):
186
+ class AzureDevopsActionHandler (TicketingActionHandler ):
154
187
group = NotificationActionHandler .ActionGroup .TICKET_CREATION
155
188
156
189
0 commit comments