diff options
Diffstat (limited to 'scripts/pipeline_test_report_builder.rb')
-rwxr-xr-x | scripts/pipeline_test_report_builder.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/pipeline_test_report_builder.rb b/scripts/pipeline_test_report_builder.rb index 6f69a5c692f..c84acf2fd94 100755 --- a/scripts/pipeline_test_report_builder.rb +++ b/scripts/pipeline_test_report_builder.rb @@ -19,7 +19,8 @@ require_relative 'api/default_options' # Push into expected format for failed tests class PipelineTestReportBuilder DEFAULT_OPTIONS = { - target_project: Host::DEFAULT_OPTIONS[:target_project], + target_project: Host::DEFAULT_OPTIONS[:target_project] || API::DEFAULT_OPTIONS[:project], + current_pipeline_id: API::DEFAULT_OPTIONS[:pipeline_id], mr_iid: Host::DEFAULT_OPTIONS[:mr_iid], api_endpoint: API::DEFAULT_OPTIONS[:endpoint], output_file_path: 'test_results/test_reports.json', @@ -28,6 +29,7 @@ class PipelineTestReportBuilder def initialize(options) @target_project = options.delete(:target_project) + @current_pipeline_id = options.delete(:current_pipeline_id) @mr_iid = options.delete(:mr_iid) @api_endpoint = options.delete(:api_endpoint).to_s @output_file_path = options.delete(:output_file_path).to_s @@ -47,7 +49,7 @@ class PipelineTestReportBuilder end def latest_pipeline - pipelines_sorted_descending[0] + fetch("#{target_project_api_base_url}/pipelines/#{current_pipeline_id}") end def previous_pipeline @@ -58,6 +60,8 @@ class PipelineTestReportBuilder private + attr_reader :target_project, :current_pipeline_id, :mr_iid, :api_endpoint, :output_file_path, :pipeline_index + def pipeline @pipeline ||= case pipeline_index @@ -76,8 +80,6 @@ class PipelineTestReportBuilder pipelines_for_mr.sort_by { |a| -a['id'] } end - attr_reader :target_project, :mr_iid, :api_endpoint, :output_file_path, :pipeline_index - def pipeline_project_api_base_url(pipeline) "#{api_endpoint}/projects/#{pipeline['project_id']}" end |