2018-07-24 06:00:56 -04:00
|
|
|
# frozen_string_literal: true
|
2018-05-16 16:58:20 -04:00
|
|
|
class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
|
|
|
|
CALLOUT_FAILURE_MESSAGES = {
|
2018-07-30 11:05:50 -04:00
|
|
|
unknown_failure: 'There is an unknown failure, please try again',
|
|
|
|
script_failure: nil,
|
|
|
|
api_failure: 'There has been an API failure, please try again',
|
|
|
|
stuck_or_timeout_failure: 'There has been a timeout failure or the job got stuck. Check your timeout limits or try again',
|
|
|
|
runner_system_failure: 'There has been a runner system failure, please try again',
|
|
|
|
missing_dependency_failure: 'There has been a missing dependency failure',
|
2018-09-26 01:43:03 -04:00
|
|
|
runner_unsupported: 'Your runner is outdated, please upgrade your runner',
|
2018-10-28 14:31:08 -04:00
|
|
|
stale_schedule: 'Delayed job could not be executed by some reason, please try again',
|
2018-10-23 06:58:41 -04:00
|
|
|
job_execution_timeout: 'The script exceeded the maximum execution time set for the job',
|
2019-03-03 18:56:20 -05:00
|
|
|
archived_failure: 'The job is archived and cannot be run',
|
2019-10-30 17:07:58 -04:00
|
|
|
unmet_prerequisites: 'The job failed to complete prerequisite tasks',
|
|
|
|
scheduler_failure: 'The scheduler failed to assign job to the runner, please try again or contact system administrator',
|
2020-02-10 07:08:59 -05:00
|
|
|
data_integrity_failure: 'There has been a structural integrity problem detected, please contact system administrator',
|
2020-02-17 04:08:52 -05:00
|
|
|
forward_deployment_failure: 'The deployment job is older than the previously succeeded deployment job, and therefore cannot be run',
|
2021-05-17 14:10:42 -04:00
|
|
|
pipeline_loop_detected: 'This job could not be executed because it would create infinitely looping pipelines',
|
2020-02-10 07:08:59 -05:00
|
|
|
invalid_bridge_trigger: 'This job could not be executed because downstream pipeline trigger definition is invalid',
|
|
|
|
downstream_bridge_project_not_found: 'This job could not be executed because downstream bridge project could not be found',
|
|
|
|
insufficient_bridge_permissions: 'This job could not be executed because of insufficient permissions to create a downstream pipeline',
|
|
|
|
bridge_pipeline_is_child_pipeline: 'This job belongs to a child pipeline and cannot create further child pipelines',
|
2020-08-10 08:09:55 -04:00
|
|
|
downstream_pipeline_creation_failed: 'The downstream pipeline could not be created',
|
2020-09-08 11:08:41 -04:00
|
|
|
secrets_provider_not_found: 'The secrets provider can not be found',
|
2021-04-12 11:09:30 -04:00
|
|
|
reached_max_descendant_pipelines_depth: 'You reached the maximum depth of child pipelines',
|
|
|
|
project_deleted: 'The job belongs to a deleted project',
|
2021-05-05 14:10:31 -04:00
|
|
|
user_blocked: 'The user who created this job is blocked',
|
2021-05-25 05:10:54 -04:00
|
|
|
ci_quota_exceeded: 'No more CI minutes available',
|
2021-07-07 08:08:23 -04:00
|
|
|
no_matching_runner: 'No matching runner available',
|
2021-09-17 11:11:44 -04:00
|
|
|
trace_size_exceeded: 'The job log size limit was reached',
|
|
|
|
builds_disabled: 'The CI/CD is disabled for this project'
|
2018-05-16 16:58:20 -04:00
|
|
|
}.freeze
|
|
|
|
|
2018-09-05 16:46:13 -04:00
|
|
|
private_constant :CALLOUT_FAILURE_MESSAGES
|
|
|
|
|
2021-09-21 05:12:21 -04:00
|
|
|
presents ::CommitStatus, as: :build
|
2018-05-16 16:58:20 -04:00
|
|
|
|
2018-09-05 16:46:13 -04:00
|
|
|
def self.callout_failure_messages
|
|
|
|
CALLOUT_FAILURE_MESSAGES
|
|
|
|
end
|
|
|
|
|
2018-05-16 16:58:20 -04:00
|
|
|
def callout_failure_message
|
2021-09-08 02:10:46 -04:00
|
|
|
self.class.callout_failure_messages.fetch(failure_reason.to_sym)
|
2018-05-16 16:58:20 -04:00
|
|
|
end
|
2018-05-15 14:03:09 -04:00
|
|
|
end
|
2020-04-12 17:09:39 -04:00
|
|
|
|
2021-05-11 17:10:21 -04:00
|
|
|
CommitStatusPresenter.prepend_mod_with('CommitStatusPresenter')
|