Skip to content

Commit 6c59769

Browse files
committed
Fix auto minimizer to download all dependencies
Fix #332
1 parent 7c6436c commit 6c59769

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

src/actions.ml

+23-27
Original file line numberDiff line numberDiff line change
@@ -917,15 +917,16 @@ let ci_minimization_extract_job_specific_info ~head_pipeline_summary
917917
if
918918
string_match
919919
~regexp:
920-
"This job ran on the Docker image `\\([^`]+\\)`, depended on the \
921-
build job `\\([^`]+\\)` with OCaml `\\([^`]+\\)`.\n\n"
920+
"This job ran on the Docker image `\\([^`]+\\)` with OCaml `\\([^`]+\\)` and depended on jobs \
921+
\\(\\(`[^`]+` ?\\)+\\) .\n\n"
922922
summary
923923
then
924-
let docker_image, build_job, opam_switch =
924+
let docker_image, opam_switch, dependencies =
925925
( Str.matched_group 1 summary
926926
, Str.matched_group 2 summary
927927
, Str.matched_group 3 summary )
928928
in
929+
let dependencies = Str.split (Str.regexp "[ `]+") dependencies in
929930
let missing_error, non_v_file =
930931
if
931932
string_match
@@ -941,16 +942,19 @@ let ci_minimization_extract_job_specific_info ~head_pipeline_summary
941942
else Some filename )
942943
else (true, None)
943944
in
945+
let extract_artifacts url =
946+
List.partition_map ~f:(fun name ->
947+
match extract_artifact_url name url with
948+
| Some v -> First v
949+
| None -> Second name)
950+
(name::dependencies)
951+
in
944952
match
945-
( extract_artifact_url build_job base_pipeline_summary
946-
, extract_artifact_url build_job head_pipeline_summary
947-
, extract_artifact_url name base_pipeline_summary
948-
, extract_artifact_url name head_pipeline_summary )
953+
( extract_artifacts base_pipeline_summary
954+
, extract_artifacts head_pipeline_summary )
949955
with
950-
| ( Some base_build_url
951-
, Some head_build_url
952-
, Some base_job_url
953-
, Some head_job_url ) ->
956+
| ( (base_urls, [])
957+
, (head_urls, []) ) ->
954958
Ok
955959
( { base_job_failed
956960
; base_job_errored
@@ -963,26 +967,18 @@ let ci_minimization_extract_job_specific_info ~head_pipeline_summary
963967
; full_target= name
964968
; docker_image
965969
; opam_switch
966-
; failing_urls= head_build_url ^ " " ^ head_job_url
967-
; passing_urls= base_build_url ^ " " ^ base_job_url } )
968-
| None, _, _, _ ->
969-
Error
970-
(f "Could not find base build job url for %s in:\n%s" build_job
971-
(collapse_summary "Base Pipeline Summary"
972-
base_pipeline_summary ) )
973-
| _, None, _, _ ->
974-
Error
975-
(f "Could not find head build job url for %s in:\n%s" build_job
976-
(collapse_summary "Head Pipeline Summary"
977-
head_pipeline_summary ) )
978-
| _, _, None, _ ->
970+
; failing_urls= String.concat ~sep:" " head_urls
971+
; passing_urls= String.concat ~sep:" " base_urls } )
972+
| (_, ((_ :: _) as base_failed)), _ ->
979973
Error
980-
(f "Could not find base job url for %s in:\n%s" name
974+
(f "Could not find base dependencies artifacts for %s in:\n%s"
975+
(String.concat ~sep:" " base_failed)
981976
(collapse_summary "Base Pipeline Summary"
982977
base_pipeline_summary ) )
983-
| _, _, _, None ->
978+
| _, (_, ((_ :: _) as head_failed)) ->
984979
Error
985-
(f "Could not find head job url for %s in:\n%s" name
980+
(f "Could not find head dependencies artifacts for %s in:\n%s"
981+
(String.concat ~sep:" " head_failed)
986982
(collapse_summary "Head Pipeline Summary"
987983
head_pipeline_summary ) )
988984
else

0 commit comments

Comments
 (0)