2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
# TODO: a couple of points with this approach:
|
|
|
|
# + reuses existing architecture and reactive caching
|
|
|
|
# - it's not a report comparison and some comparing features must be turned off.
|
|
|
|
# see CompareReportsBaseService for more notes.
|
|
|
|
# issue: https://gitlab.com/gitlab-org/gitlab/issues/34224
|
|
|
|
class GenerateExposedArtifactsReportService < CompareReportsBaseService
|
|
|
|
def execute(base_pipeline, head_pipeline)
|
|
|
|
data = FindExposedArtifactsService.new(project, current_user).for_pipeline(head_pipeline)
|
|
|
|
{
|
|
|
|
status: :parsed,
|
|
|
|
key: key(base_pipeline, head_pipeline),
|
|
|
|
data: data
|
|
|
|
}
|
2021-06-08 01:23:25 +05:30
|
|
|
rescue StandardError => e
|
2020-01-01 13:55:28 +05:30
|
|
|
Gitlab::ErrorTracking.track_exception(e, project_id: project.id)
|
2019-12-26 22:10:19 +05:30
|
|
|
{
|
|
|
|
status: :error,
|
|
|
|
key: key(base_pipeline, head_pipeline),
|
|
|
|
status_reason: _('An error occurred while fetching exposed artifacts.')
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def latest?(base_pipeline, head_pipeline, data)
|
|
|
|
data&.fetch(:key, nil) == key(base_pipeline, head_pipeline)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|