From 5fbfc5bfc9b70383426c26e19f38969f317ce0cb Mon Sep 17 00:00:00 2001 From: Crola1702 Date: Fri, 2 Aug 2024 11:30:14 -0500 Subject: [PATCH] Report: Jobs Last Success Date subsection (#75) PR comments Signed-off-by: Crola1702 --- database/scripts/format_report.rb | 2 +- database/scripts/generate_report.rb | 2 +- database/scripts/lib/buildfarm_tools.rb | 4 ++-- database/scripts/lib/report_formatter.rb | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/database/scripts/format_report.rb b/database/scripts/format_report.rb index 4a38b6e..87d8633 100755 --- a/database/scripts/format_report.rb +++ b/database/scripts/format_report.rb @@ -10,7 +10,7 @@ report['urgent']['build_regressions'] = ReportFormatter::build_regressions(report['urgent']['build_regressions']) report['urgent']['test_regressions_consecutive'] = ReportFormatter::test_regressions_consecutive(report['urgent']['test_regressions_consecutive']) report['urgent']['test_regressions_flaky'] = ReportFormatter::test_regressions_flaky(report['urgent']['test_regressions_flaky']) -report['maintenance']['jobs_failing'] = ReportFormatter::jobs_failing(report['maintenance']['jobs_failing']) +report['maintenance']['jobs_last_success_date'] = ReportFormatter::jobs_last_success_date(report['maintenance']['jobs_last_success_date']) # Sample output: # puts report['urgent']['build_regressions'] diff --git a/database/scripts/generate_report.rb b/database/scripts/generate_report.rb index 303e4d3..a97631f 100755 --- a/database/scripts/generate_report.rb +++ b/database/scripts/generate_report.rb @@ -32,7 +32,7 @@ def generate_report(report_name, exclude_set) 'test_regressions_flaky' => urgent_flaky_test_regressions = BuildfarmToolsLib::flaky_test_regressions(group_issues: true), }, 'maintenance' => { - 'jobs_failing' => maintenance_jobs_failing = BuildfarmToolsLib::jobs_failing(days_exclude: 7), + 'jobs_last_success_date' => maintenance_jobs_last_success_date = BuildfarmToolsLib::jobs_last_success_date(older_than_days: 7), 'gh_issues_reported' => [], 'tests_disabled' => [], }, diff --git a/database/scripts/lib/buildfarm_tools.rb b/database/scripts/lib/buildfarm_tools.rb index 8028ae5..379e7a6 100644 --- a/database/scripts/lib/buildfarm_tools.rb +++ b/database/scripts/lib/buildfarm_tools.rb @@ -98,7 +98,7 @@ def self.jobs_never_passed run_command('./sql_run.sh jobs_never_passed.sql') end - def self.jobs_failing(days_exclude: 0) + def self.jobs_last_success_date(older_than_days: 0) # Keys: job_name, last_success out = [] jobs_never_passed.each do |e| @@ -107,7 +107,7 @@ def self.jobs_failing(days_exclude: 0) jobs_last_success.each do |e| last_success = DateTime.parse(e['last_success_time']) - next if last_success > (Date.today - days_exclude) + next if last_success > (Date.today - older_than_days) out << {"job_name" => e["job_name"], "last_success" => last_success.strftime('%Y-%m-%d')} end out diff --git a/database/scripts/lib/report_formatter.rb b/database/scripts/lib/report_formatter.rb index 7c32386..dde87fe 100644 --- a/database/scripts/lib/report_formatter.rb +++ b/database/scripts/lib/report_formatter.rb @@ -128,7 +128,7 @@ def self.test_regressions_flaky(tr_array) out end - def self.jobs_failing(job_array) + def self.jobs_last_success_date(job_array) return "" if job_array.empty? table = "| Job Name | Last Success |\n| -- | -- |\n" job_array.each do |job| @@ -139,7 +139,7 @@ def self.jobs_failing(job_array) def self.format_report(report_hash) # Use
and tags to prevent long reports - details_subcategories = ['test_regressions_flaky', 'jobs_failing'] + details_subcategories = ['test_regressions_flaky', 'jobs_last_success_date'] output_report = "" report_hash.each_pair do |category, subcategory_hash|