Class: Ci::CompareReportsBaseService
- Inherits:
-
BaseService
- Object
- BaseService
- Ci::CompareReportsBaseService
- Defined in:
- app/services/ci/compare_reports_base_service.rb
Overview
TODO: when using this class with exposed artifacts we see that there are 2 responsibilities:
-
reactive caching interface (same in all cases)
-
data generator (report comparison in most of the case but not always)
Direct Known Subclasses
CompareAccessibilityReportsService, CompareCodequalityReportsService, CompareTestReportsService, GenerateCodequalityMrDiffReportService, GenerateCoverageReportsService, GenerateExposedArtifactsReportService, GenerateTerraformReportsService
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute(base_pipeline, head_pipeline) ⇒ Object
- #latest?(base_pipeline, head_pipeline, data) ⇒ Boolean
Methods inherited from BaseService
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#execute(base_pipeline, head_pipeline) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/ci/compare_reports_base_service.rb', line 10 def execute(base_pipeline, head_pipeline) return parsing_payload(base_pipeline, head_pipeline) if base_pipeline&.running? base_report = get_report(base_pipeline) head_report = get_report(head_pipeline) comparer = build_comparer(base_report, head_report) { status: :parsed, key: key(base_pipeline, head_pipeline), data: serializer_class .new(**serializer_params) .represent(comparer).as_json } rescue Gitlab::Ci::Parsers::ParserError => e { status: :error, key: key(base_pipeline, head_pipeline), status_reason: e. } end |
#latest?(base_pipeline, head_pipeline, data) ⇒ Boolean
32 33 34 |
# File 'app/services/ci/compare_reports_base_service.rb', line 32 def latest?(base_pipeline, head_pipeline, data) data&.fetch(:key, nil) == key(base_pipeline, head_pipeline) end |