File tree Expand file tree Collapse file tree 5 files changed +15
-25
lines changed Expand file tree Collapse file tree 5 files changed +15
-25
lines changed Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) (Buildkite_api :
322
322
| Error e -> Lwt. return_error e
323
323
| Ok build ->
324
324
let failed_jobs = Util.Build. filter_failed_jobs build.jobs in
325
- let % lwt logs_or_errors = Lwt_list. map_p (get_job_log_name_and_content ~ctx n) failed_jobs in
325
+ let % lwt logs_or_errors = Lwt_list. map_s (get_job_log_name_and_content ~ctx n) failed_jobs in
326
326
Lwt. return_ok
327
327
@@ List. filter_map
328
328
(function
@@ -387,7 +387,6 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) (Buildkite_api :
387
387
let % lwt failed_steps = new_failed_steps ~get_build: (Buildkite_api. get_build ~ctx ) n repo_state in
388
388
Lwt. return_some failed_steps
389
389
in
390
-
391
390
let % lwt job_log =
392
391
match cfg.include_logs_in_notifs with
393
392
| false -> Lwt. return []
@@ -447,11 +446,10 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) (Buildkite_api :
447
446
(match handler with
448
447
| None -> Lwt. return_unit
449
448
| Some handler ->
450
- (try % lwt
451
- match % lwt handler res with
452
- | Result. Error e -> handler_error e
453
- | Ok () -> Lwt. return_unit
454
- with exn -> handler_error (Printexc. to_string exn )))
449
+ (match % lwt handler res with
450
+ | Result. Error e -> handler_error e
451
+ | Ok () -> Lwt. return_unit
452
+ | exception exn -> handler_error (Printexc. to_string exn )))
455
453
| Ok None -> Lwt. return_unit
456
454
| Error e -> action_error e
457
455
in
Original file line number Diff line number Diff line change @@ -256,7 +256,7 @@ module Slack : Api.Slack = struct
256
256
| Ok { Slack_t. upload_url; file_id } ->
257
257
(match % lwt post_file_content ~upload_url ~filename: name ~content with
258
258
| Error e -> Lwt. return_error e
259
- | Ok () -> Lwt. return_ok ({ id = file_id; title } : Slack_t.file_v2 ))
259
+ | Ok () -> Lwt. return_ok ({ id = file_id; title } : Slack_t.file ))
260
260
261
261
let complete_upload_external ~(ctx : Context.t ) ?channel_id ?thread_ts ?initial_comment files =
262
262
let name = " complete_upload_external" in
Original file line number Diff line number Diff line change @@ -171,29 +171,22 @@ type upload_url_res = {
171
171
file_id: string;
172
172
}
173
173
174
- type file_v2 = {
174
+ type file = {
175
175
id: string;
176
176
?title: string nullable;
177
177
}
178
178
179
- type files_v2 = file_v2 list
179
+ type files = file list
180
180
181
181
type complete_upload_external_req = {
182
- files: files_v2 ;
182
+ files: files ;
183
183
?channel_id: channel_id nullable;
184
184
?thread_ts: timestamp nullable;
185
185
?initial_comment: string nullable;
186
186
}
187
187
188
- type complete_upload_external_file_res = {
189
- url_private: string;
190
- url_private_download: string;
191
- permalink: string;
192
- permalink_public: string;
193
- }
194
-
195
188
type complete_upload_external_res = {
196
- files: files_v2 ;
189
+ files: files ;
197
190
}
198
191
199
192
type join_channel_req = {
Original file line number Diff line number Diff line change @@ -438,17 +438,17 @@ let generate_status_notification ?slack_user_id ?failed_steps ~(job_log : (strin
438
438
let handler =
439
439
match job_log with
440
440
| [] -> None
441
- | _ :: _ when is_failed_build_notification ->
441
+ | _ :: _ when Status_notification .is_user channel ->
442
442
let files =
443
443
job_log
444
444
|> List .map (fun (job_name , job_log ) ->
445
445
{ name = job_name; title = None ; alt_txt = None ; content = reply_of_log job_log })
446
446
in
447
447
Some
448
- (fun (upload_file : file :file_req -> (unit , string ) result Lwt .t ) (res : Slack_t .post_message_res ) ->
448
+ (fun (send_file : file :file_req -> (unit , string ) result Lwt .t ) (res : Slack_t .post_message_res ) ->
449
449
let ({ ts; channel; _ } : post_message_res ) = res in
450
450
let file = { files; channel_id = Some channel; initial_comment = None ; thread_ts = Some ts } in
451
- upload_file ~file )
451
+ send_file ~file )
452
452
| _ -> None
453
453
in
454
454
make_message ~text: summary ~attachments: [ attachment ] ?handler
Original file line number Diff line number Diff line change @@ -342,9 +342,8 @@ module Build = struct
342
342
343
343
let filter_failed_jobs jobs =
344
344
List. filter_map
345
- (fun (job : Buildkite_t.job_type ) ->
346
- match job with
347
- | Script ({ state = Failed ; _ } as job ) | Trigger ({ state = Failed ; _ } as job ) -> Some job
345
+ (function
346
+ | Buildkite_t. Script ({ state = Failed ; _ } as job ) | Trigger ({ state = Failed ; _ } as job ) -> Some job
348
347
| _ -> None )
349
348
jobs
350
349
end
You can’t perform that action at this time.
0 commit comments