@@ -150,13 +150,32 @@ struct
150150 Abb.Future. return
151151 (Ok
152152 (fun branch_ref checks ->
153+ (* When updating commit checks, mark the existing key as dirty. *)
154+ Builder.State. mark_dirty s Keys. commit_checks;
153155 S.Api. create_commit_checks
154156 ~request_id: (Builder. log_id s)
155157 client
156158 repo
157159 branch_ref
158160 checks)))
159161
162+ let commit_checks =
163+ run ~name: " commit_checks" (fun s { Bs.Fetcher. fetch } ->
164+ let open Irm in
165+ fetch Keys. client
166+ >> = fun client ->
167+ fetch Keys. repo
168+ >> = fun repo ->
169+ fetch Keys. branch_ref
170+ >> = fun branch_ref ->
171+ Logs. info (fun m ->
172+ m
173+ " %s : FETCH_COMMIT_CHECKS : repo = %s : branch = %s"
174+ (Builder. log_id s)
175+ (S.Api.Repo. to_string repo)
176+ (S.Api.Ref. to_string branch_ref));
177+ S.Api. fetch_commit_checks ~request_id: (Builder. log_id s) client repo branch_ref)
178+
160179 let branch_name =
161180 run ~name: " branch_name" (fun s { Bs.Fetcher. fetch } ->
162181 let open Irm in
@@ -555,24 +574,10 @@ struct
555574 match S.Api.Pull_request. state pull_request with
556575 | Pr.State. Closed ->
557576 Logs. info (fun m -> m " %s : NOOP : PR_CLOSED" (Builder. log_id s));
558- fetch Keys. client
559- >> = fun client ->
560- fetch Keys. repo
561- >> = fun repo ->
577+ fetch Keys. commit_checks
578+ >> = fun commit_checks ->
562579 fetch Keys. branch_ref
563580 >> = fun branch_ref ->
564- time_it
565- s
566- (fun m log_id time ->
567- m
568- " %s : FETCH_COMMIT_CHECKS : repo = %s : branch = %s : time=%f"
569- log_id
570- (S.Api.Repo. to_string repo)
571- (S.Api.Ref. to_string branch_ref)
572- time)
573- (fun () ->
574- S.Api. fetch_commit_checks ~request_id: (Builder. log_id s) client repo branch_ref)
575- >> = fun commit_checks ->
576581 let module Ch = Terrat_commit_check in
577582 let unfinished_checks =
578583 CCList. filter_map
@@ -1206,8 +1211,10 @@ struct
12061211 >> = fun _ ->
12071212 fetch Keys. store_stacks
12081213 >> = fun () ->
1209- Abbs_future_combinators.Infix_result_app. (
1210- (fun () () () () () () () () () () -> () )
1214+ fetch Keys. check_dirspaces_to_plan
1215+ >> = fun () ->
1216+ Fc.Infix_result_app. (
1217+ (fun () () () () () () () () () -> () )
12111218 < $> fetch Keys. check_access_control_ci_change
12121219 < *> fetch Keys. check_access_control_files
12131220 < *> fetch Keys. check_access_control_repo_config
@@ -1216,8 +1223,7 @@ struct
12161223 < *> fetch Keys. check_account_status_expired
12171224 < *> fetch Keys. check_account_tier
12181225 < *> fetch Keys. check_merge_conflict
1219- < *> fetch Keys. check_conflicting_plan_work_manifests
1220- < *> fetch Keys. check_dirspaces_to_plan)
1226+ < *> fetch Keys. check_conflicting_plan_work_manifests)
12211227 in
12221228 let open Abb.Future.Infix_monad in
12231229 run
@@ -1255,8 +1261,15 @@ struct
12551261 let open Irm in
12561262 fetch Keys. check_pull_request_state
12571263 >> = fun () ->
1258- Abbs_future_combinators.Infix_result_app. (
1259- (fun () () () () () () () () () () () () _ _ _ -> () )
1264+ (* Building these two happens to build all sorts of useful
1265+ dependencies for us, so build those first so the rest can
1266+ efficiently be done concurrently. *)
1267+ Fc.Result. all2 (fetch Keys. branch_dirspaces) (fetch Keys. dest_branch_dirspaces)
1268+ >> = fun _ ->
1269+ fetch Keys. check_dirspaces_to_apply
1270+ >> = fun () ->
1271+ Fc.Infix_result_app. (
1272+ (fun () () () () () () () () () () () _ -> () )
12601273 < $> fetch Keys. check_access_control_ci_change
12611274 < *> fetch Keys. check_access_control_apply
12621275 < *> fetch Keys. check_access_control_files
@@ -1266,13 +1279,9 @@ struct
12661279 < *> fetch Keys. check_conflicting_apply_work_manifests
12671280 < *> fetch Keys. check_dirspaces_missing_plans
12681281 < *> fetch Keys. check_dirspaces_owned_by_other_pull_requests
1269- < *> fetch Keys. check_dirspaces_to_apply
12701282 < *> fetch Keys. check_gates
12711283 < *> fetch Keys. check_merge_conflict
1272- < *> fetch Keys. check_apply_requirements
1273- (* Ensure that various information is built before trying to run the plan *)
1274- < *> fetch Keys. branch_dirspaces
1275- < *> fetch Keys. dest_branch_dirspaces)
1284+ < *> fetch Keys. check_apply_requirements)
12761285 in
12771286 let open Abb.Future.Infix_monad in
12781287 run
@@ -1364,7 +1373,8 @@ struct
13641373 let log_id = Builder. mk_log_id ~request_id: (Builder. log_id s) job.Tjc.Job. id in
13651374 Logs. info (fun m ->
13661375 m
1367- " %s : target=%s : context_id=%a : log_id= %s : job_type=%a"
1376+ " %s : EVENT : PULL_REQUEST : target=%s : context_id=%a : log_id= %s : \
1377+ job_type=%a"
13681378 (Builder. log_id s)
13691379 (Hmap.Key. info Keys. iter_job)
13701380 Uuidm. pp
@@ -1442,6 +1452,7 @@ struct
14421452 |> Hmap. add (coerce Keys. check_merge_conflict) Tasks. check_merge_conflict
14431453 |> Hmap. add (coerce Keys. check_pull_request_state) Tasks. check_pull_request_state
14441454 |> Hmap. add (coerce Keys. comment_id) Tasks. comment_id
1455+ |> Hmap. add (coerce Keys. commit_checks) Tasks. commit_checks
14451456 |> Hmap. add (coerce Keys. create_commit_checks) Tasks. create_commit_checks
14461457 |> Hmap. add (coerce Keys. dest_branch_name) Tasks. dest_branch_name
14471458 |> Hmap. add (coerce Keys. dest_branch_ref) Tasks. dest_branch_ref
0 commit comments