diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /app/presenters/commit_status_presenter.rb | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) | |
download | gitlab-ce-14.4.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'app/presenters/commit_status_presenter.rb')
-rw-r--r-- | app/presenters/commit_status_presenter.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/app/presenters/commit_status_presenter.rb b/app/presenters/commit_status_presenter.rb index 3c39470b730..7919e501bf0 100644 --- a/app/presenters/commit_status_presenter.rb +++ b/app/presenters/commit_status_presenter.rb @@ -28,19 +28,36 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated ci_quota_exceeded: 'No more CI minutes available', no_matching_runner: 'No matching runner available', trace_size_exceeded: 'The job log size limit was reached', - builds_disabled: 'The CI/CD is disabled for this project' + builds_disabled: 'The CI/CD is disabled for this project', + environment_creation_failure: 'This job could not be executed because it would create an environment with an invalid parameter.' + }.freeze + + TROUBLESHOOTING_DOC = { + environment_creation_failure: { path: 'ci/environments/index', anchor: 'a-deployment-job-failed-with-this-job-could-not-be-executed-because-it-would-create-an-environment-with-an-invalid-parameter-error' } }.freeze private_constant :CALLOUT_FAILURE_MESSAGES - presents :build + presents ::CommitStatus, as: :build def self.callout_failure_messages CALLOUT_FAILURE_MESSAGES end def callout_failure_message - self.class.callout_failure_messages.fetch(failure_reason.to_sym) + message = self.class.callout_failure_messages.fetch(failure_reason.to_sym) + + if doc = TROUBLESHOOTING_DOC[failure_reason.to_sym] + message += " #{help_page_link(doc[:path], doc[:anchor])}" + end + + message + end + + private + + def help_page_link(path, anchor) + ActionController::Base.helpers.link_to('How do I fix it?', help_page_path(path, anchor: anchor)) end end |