From 7c6436cba745f0c979c94f6c72da754b58afc46f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Gilbert?= Date: Wed, 22 Jan 2025 09:48:41 +0100 Subject: [PATCH 1/2] Check summary: report all dependencies not just the "build" job. --- src/actions.ml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/actions.ml b/src/actions.ml index e22fb3d6..f3f1275f 100644 --- a/src/actions.ml +++ b/src/actions.ml @@ -12,7 +12,7 @@ open Lwt.Syntax type coq_job_info = { docker_image: string - ; build_dependency: string + ; dependencies: string list ; compiler: string ; opam_variant: string } @@ -77,27 +77,33 @@ let send_status_check ~bot_info job_info ~pr_num (gh_owner, gh_repo) if string_match ~regexp line then Some (Str.matched_group 1 line) else None ) ) in + let find_all regexps = + List.filter_map trace_lines ~f:(fun line -> + List.find_map regexps ~f:(fun regexp -> + if string_match ~regexp line then Some (Str.matched_group 1 line) + else None ) ) + in find [ "^Using Docker executor with image \\([^ ]+\\)" ; "options=Options(docker='\\([^']+\\)')" ] >>= fun docker_image -> - find ["^Downloading artifacts for \\(build:[^ ]+\\)"] - >>= fun build_dependency -> + let dependencies = find_all ["^Downloading artifacts for \\([^ ]+\\)"] in find ["^COMPILER=\\(.*\\)"] >>= fun compiler -> find ["^OPAM_VARIANT=\\(.*\\)"] >>= fun opam_variant -> - Some {docker_image; build_dependency; compiler; opam_variant} + Some {docker_image; dependencies; compiler; opam_variant} in let* summary_tail_prefix = match coq_job_info with - | Some {docker_image; build_dependency; compiler; opam_variant} -> + | Some {docker_image; dependencies; compiler; opam_variant} -> let switch_name = compiler ^ opam_variant in + let dependencies = String.concat ~sep:"` `" dependencies in Lwt.return (f - "This job ran on the Docker image `%s`, depended on the build job \ - `%s` with OCaml `%s`.\n\n" - docker_image build_dependency switch_name ) + "This job ran on the Docker image `%s` with OCaml `%s` and depended on jobs \ + `%s` .\n\n" + docker_image switch_name dependencies ) | None -> Lwt.return "" in From 6c597691798eb0dea72ddaca0ae6968545bb7fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Gilbert?= Date: Wed, 22 Jan 2025 10:07:38 +0100 Subject: [PATCH 2/2] Fix auto minimizer to download all dependencies Fix #332 --- src/actions.ml | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/src/actions.ml b/src/actions.ml index f3f1275f..e9c073ec 100644 --- a/src/actions.ml +++ b/src/actions.ml @@ -917,15 +917,16 @@ let ci_minimization_extract_job_specific_info ~head_pipeline_summary if string_match ~regexp: - "This job ran on the Docker image `\\([^`]+\\)`, depended on the \ - build job `\\([^`]+\\)` with OCaml `\\([^`]+\\)`.\n\n" + "This job ran on the Docker image `\\([^`]+\\)` with OCaml `\\([^`]+\\)` and depended on jobs \ + \\(\\(`[^`]+` ?\\)+\\) .\n\n" summary then - let docker_image, build_job, opam_switch = + let docker_image, opam_switch, dependencies = ( Str.matched_group 1 summary , Str.matched_group 2 summary , Str.matched_group 3 summary ) in + let dependencies = Str.split (Str.regexp "[ `]+") dependencies in let missing_error, non_v_file = if string_match @@ -941,16 +942,19 @@ let ci_minimization_extract_job_specific_info ~head_pipeline_summary else Some filename ) else (true, None) in + let extract_artifacts url = + List.partition_map ~f:(fun name -> + match extract_artifact_url name url with + | Some v -> First v + | None -> Second name) + (name::dependencies) + in match - ( extract_artifact_url build_job base_pipeline_summary - , extract_artifact_url build_job head_pipeline_summary - , extract_artifact_url name base_pipeline_summary - , extract_artifact_url name head_pipeline_summary ) + ( extract_artifacts base_pipeline_summary + , extract_artifacts head_pipeline_summary ) with - | ( Some base_build_url - , Some head_build_url - , Some base_job_url - , Some head_job_url ) -> + | ( (base_urls, []) + , (head_urls, []) ) -> Ok ( { base_job_failed ; base_job_errored @@ -963,26 +967,18 @@ let ci_minimization_extract_job_specific_info ~head_pipeline_summary ; full_target= name ; docker_image ; opam_switch - ; failing_urls= head_build_url ^ " " ^ head_job_url - ; passing_urls= base_build_url ^ " " ^ base_job_url } ) - | None, _, _, _ -> - Error - (f "Could not find base build job url for %s in:\n%s" build_job - (collapse_summary "Base Pipeline Summary" - base_pipeline_summary ) ) - | _, None, _, _ -> - Error - (f "Could not find head build job url for %s in:\n%s" build_job - (collapse_summary "Head Pipeline Summary" - head_pipeline_summary ) ) - | _, _, None, _ -> + ; failing_urls= String.concat ~sep:" " head_urls + ; passing_urls= String.concat ~sep:" " base_urls } ) + | (_, ((_ :: _) as base_failed)), _ -> Error - (f "Could not find base job url for %s in:\n%s" name + (f "Could not find base dependencies artifacts for %s in:\n%s" + (String.concat ~sep:" " base_failed) (collapse_summary "Base Pipeline Summary" base_pipeline_summary ) ) - | _, _, _, None -> + | _, (_, ((_ :: _) as head_failed)) -> Error - (f "Could not find head job url for %s in:\n%s" name + (f "Could not find head dependencies artifacts for %s in:\n%s" + (String.concat ~sep:" " head_failed) (collapse_summary "Head Pipeline Summary" head_pipeline_summary ) ) else