@@ -479,11 +479,15 @@ def format_test_name_for_linewrap(text: str) -> str:
479479
480480def format_test_status (text : str ) -> str :
481481 """Format the test status for better readability."""
482- color = (
483- "red"
484- if text .lower ().startswith ("fail" )
485- else "orange" if text .lower () in ("error" , "broken" , "pending" ) else "green"
486- )
482+ if text .lower ().startswith ("fail" ):
483+ color = "red"
484+ elif text .lower () == "skipped" :
485+ color = "grey"
486+ elif text .lower () in ("success" , "ok" , "passed" , "pass" ):
487+ color = "green"
488+ else :
489+ color = "orange"
490+
487491 return f'<span style="font-weight: bold; color: { color } ">{ text } </span>'
488492
489493
@@ -511,28 +515,41 @@ def format_results_as_html_table(results) -> str:
511515 return html
512516
513517
514- def parse_args () -> argparse .Namespace :
515- parser = argparse .ArgumentParser (description = "Create a combined CI report." )
516- parser .add_argument ( # Need the full URL rather than just the ID to query the databases
517- "--actions-run-url" , required = True , help = "URL of the actions run"
518- )
519- parser .add_argument (
520- "--pr-number" , help = "Pull request number for the S3 path" , type = int
521- )
522- parser .add_argument ("--commit-sha" , help = "Commit SHA for the S3 path" )
523- parser .add_argument (
524- "--no-upload" , action = "store_true" , help = "Do not upload the report"
525- )
526- parser .add_argument (
527- "--known-fails" , type = str , help = "Path to the file with known fails"
528- )
529- parser .add_argument (
530- "--cves" , action = "store_true" , help = "Get CVEs from Grype results"
531- )
532- parser .add_argument (
533- "--mark-preview" , action = "store_true" , help = "Mark the report as a preview"
534- )
535- return parser .parse_args ()
518+ def backfill_skipped_statuses (
519+ job_statuses : pd .DataFrame , pr_number : int , branch : str , commit_sha : str
520+ ):
521+ """
522+ Fill in the job statuses for skipped jobs.
523+ """
524+
525+ if pr_number == 0 :
526+ ref_param = f"REF={ branch } "
527+ workflow_name = "MasterCI"
528+ else :
529+ ref_param = f"PR={ pr_number } "
530+ workflow_name = "PR"
531+
532+ status_file = f"result_{ workflow_name .lower ()} .json"
533+ s3_path = f"https://{ S3_BUCKET } .s3.amazonaws.com/{ ref_param .replace ('=' , 's/' )} /{ commit_sha } /{ status_file } "
534+ response = requests .get (s3_path )
535+
536+ if response .status_code != 200 :
537+ return job_statuses
538+
539+ status_data = response .json ()
540+ skipped_jobs = []
541+ for job in status_data ["results" ]:
542+ if job ["status" ] == "skipped" and len (job ["links" ]) > 0 :
543+ skipped_jobs .append (
544+ {
545+ "job_name" : job ["name" ],
546+ "job_status" : job ["status" ],
547+ "message" : job ["info" ],
548+ "results_link" : job ["links" ][0 ],
549+ }
550+ )
551+
552+ return pd .concat ([job_statuses , pd .DataFrame (skipped_jobs )], ignore_index = True )
536553
537554
538555def get_build_report_links (
@@ -549,10 +566,16 @@ def get_build_report_links(
549566 build_report_links = {}
550567
551568 for job in job_statuses .itertuples ():
552- if job .job_name not in build_job_names or job .job_status != "success" :
553- continue
554-
555- build_report_links [job .job_name ] = job .results_link
569+ if (
570+ job .job_name in build_job_names
571+ and job .job_status
572+ in (
573+ "success" ,
574+ "skipped" ,
575+ )
576+ and job .results_link
577+ ):
578+ build_report_links [job .job_name ] = job .results_link
556579
557580 if len (build_report_links ) > 0 :
558581 # Possible that only one build job succeeded, in which case we only have one link.
@@ -594,6 +617,30 @@ def get_build_report_links(
594617 return build_report_links
595618
596619
620+ def parse_args () -> argparse .Namespace :
621+ parser = argparse .ArgumentParser (description = "Create a combined CI report." )
622+ parser .add_argument ( # Need the full URL rather than just the ID to query the databases
623+ "--actions-run-url" , required = True , help = "URL of the actions run"
624+ )
625+ parser .add_argument (
626+ "--pr-number" , help = "Pull request number for the S3 path" , type = int
627+ )
628+ parser .add_argument ("--commit-sha" , help = "Commit SHA for the S3 path" )
629+ parser .add_argument (
630+ "--no-upload" , action = "store_true" , help = "Do not upload the report"
631+ )
632+ parser .add_argument (
633+ "--known-fails" , type = str , help = "Path to the file with known fails"
634+ )
635+ parser .add_argument (
636+ "--cves" , action = "store_true" , help = "Get CVEs from Grype results"
637+ )
638+ parser .add_argument (
639+ "--mark-preview" , action = "store_true" , help = "Mark the report as a preview"
640+ )
641+ return parser .parse_args ()
642+
643+
597644def create_workflow_report (
598645 actions_run_url : str ,
599646 pr_number : int = None ,
@@ -686,6 +733,10 @@ def create_workflow_report(
686733 except Exception as e :
687734 pr_info_html = e
688735
736+ fail_results ["job_statuses" ] = backfill_skipped_statuses (
737+ fail_results ["job_statuses" ], pr_number , branch_name , commit_sha
738+ )
739+
689740 high_cve_count = 0
690741 if not cves_not_checked and len (fail_results ["docker_images_cves" ]) > 0 :
691742 high_cve_count = (
0 commit comments