diff options
Diffstat (limited to 'app/presenters/ci')
-rw-r--r-- | app/presenters/ci/build_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/ci/pipeline_artifacts/code_quality_mr_diff_presenter.rb | 10 | ||||
-rw-r--r-- | app/presenters/ci/pipeline_presenter.rb | 21 |
4 files changed, 19 insertions, 16 deletions
diff --git a/app/presenters/ci/build_presenter.rb b/app/presenters/ci/build_presenter.rb index 51a81158f78..384cb3285fc 100644 --- a/app/presenters/ci/build_presenter.rb +++ b/app/presenters/ci/build_presenter.rb @@ -51,4 +51,4 @@ module Ci end end -Ci::BuildPresenter.prepend_if_ee('EE::Ci::BuildPresenter') +Ci::BuildPresenter.prepend_mod_with('Ci::BuildPresenter') diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 6978bc46475..5b233ad89ec 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -138,4 +138,4 @@ module Ci end end -Ci::BuildRunnerPresenter.prepend_if_ee('EE::Ci::BuildRunnerPresenter') +Ci::BuildRunnerPresenter.prepend_mod_with('Ci::BuildRunnerPresenter') diff --git a/app/presenters/ci/pipeline_artifacts/code_quality_mr_diff_presenter.rb b/app/presenters/ci/pipeline_artifacts/code_quality_mr_diff_presenter.rb index 2fe3104fe69..d28b4523fd5 100644 --- a/app/presenters/ci/pipeline_artifacts/code_quality_mr_diff_presenter.rb +++ b/app/presenters/ci/pipeline_artifacts/code_quality_mr_diff_presenter.rb @@ -5,18 +5,20 @@ module Ci class CodeQualityMrDiffPresenter < Gitlab::View::Presenter::Delegated include Gitlab::Utils::StrongMemoize - def for_files(filenames) - quality_files = raw_report["files"].select { |key| filenames.include?(key) } + def for_files(merge_request) + filenames = merge_request.new_paths + mr_diff_report = raw_report(merge_request.id) + quality_files = mr_diff_report["files"]&.select { |key| filenames.include?(key) } { files: quality_files } end private - def raw_report + def raw_report(merge_request_id) strong_memoize(:raw_report) do self.each_blob do |blob| - Gitlab::Json.parse(blob).with_indifferent_access + Gitlab::Json.parse(blob).with_indifferent_access.fetch("merge_request_#{merge_request_id}", {}) end end end diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index a2cdabb912f..82f00f74692 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -8,15 +8,16 @@ module Ci # We use a class method here instead of a constant, allowing EE to redefine # the returned `Hash` more easily. def self.failure_reasons - { unknown_failure: 'Unknown pipeline failure!', - config_error: 'CI/CD YAML configuration error!', - external_validation_failure: 'External pipeline validation failed!', - activity_limit_exceeded: 'Pipeline activity limit exceeded!', - size_limit_exceeded: 'Pipeline size limit exceeded!', - job_activity_limit_exceeded: 'Pipeline job activity limit exceeded!', - deployments_limit_exceeded: 'Pipeline deployments limit exceeded!', - project_deleted: 'The associated project was deleted', - user_blocked: 'The user who created this pipeline is blocked' } + { unknown_failure: 'The reason for the pipeline failure is unknown.', + config_error: 'The pipeline failed due to an error on the CI/CD configuration file.', + external_validation_failure: 'The external pipeline validation failed.', + user_not_verified: 'The pipeline failed due to the user not being verified', + activity_limit_exceeded: 'The pipeline activity limit was exceeded.', + size_limit_exceeded: 'The pipeline size limit was exceeded.', + job_activity_limit_exceeded: 'The pipeline job activity limit was exceeded.', + deployments_limit_exceeded: 'The pipeline deployments limit was exceeded.', + project_deleted: 'The project associated with this pipeline was deleted.', + user_blocked: 'The user who created this pipeline is blocked.' } end presents :pipeline @@ -163,4 +164,4 @@ module Ci end end -Ci::PipelinePresenter.prepend_if_ee('EE::Ci::PipelinePresenter') +Ci::PipelinePresenter.prepend_mod_with('Ci::PipelinePresenter') |