diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-21 15:05:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-21 15:05:58 +0000 |
commit | ad1e4b8fb8104b642fa79ed34fd144bc2bed8a19 (patch) | |
tree | 78f95d63d4ea5ed0b1a8b3c83c38d9cbd682f884 /app/services/ci/generate_exposed_artifacts_report_service.rb | |
parent | 664c4c7b49c6056136299817eb79e9f1de83e567 (diff) | |
download | gitlab-ce-ad1e4b8fb8104b642fa79ed34fd144bc2bed8a19.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/ci/generate_exposed_artifacts_report_service.rb')
-rw-r--r-- | app/services/ci/generate_exposed_artifacts_report_service.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/services/ci/generate_exposed_artifacts_report_service.rb b/app/services/ci/generate_exposed_artifacts_report_service.rb new file mode 100644 index 00000000000..b9bf580bcbc --- /dev/null +++ b/app/services/ci/generate_exposed_artifacts_report_service.rb @@ -0,0 +1,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 + } + rescue => e + Gitlab::Sentry.track_acceptable_exception(e, extra: { project_id: project.id }) + { + 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 |