diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index d08d303912d3d79ada646f3a10381075a767df35..241ed7a860f3d81ceec3bb51bdb42202c19e1cad 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -321,5 +321,3 @@ def unrecoverable_failure? script_failure? || missing_dependency_failure? || archived_failure? || scheduler_failure? || data_integrity_failure? end end - -CommitStatus.prepend_mod_with('CommitStatus') diff --git a/app/models/concerns/enums/ci/commit_status.rb b/app/models/concerns/enums/ci/commit_status.rb index 312b88a4d6dabcef4b2bd84297b38e01d19ecc38..49d4dcfe4496c008def894c6286881bd03bb1927 100644 --- a/app/models/concerns/enums/ci/commit_status.rb +++ b/app/models/concerns/enums/ci/commit_status.rb @@ -29,9 +29,12 @@ def self.failure_reasons builds_disabled: 20, environment_creation_failure: 21, deployment_rejected: 22, + protected_environment_failure: 1_000, insufficient_bridge_permissions: 1_001, downstream_bridge_project_not_found: 1_002, invalid_bridge_trigger: 1_003, + upstream_bridge_project_not_found: 1_004, + insufficient_upstream_permissions: 1_005, bridge_pipeline_is_child_pipeline: 1_006, # not used anymore, but cannot be deleted because of old data downstream_pipeline_creation_failed: 1_007, secrets_provider_not_found: 1_008, @@ -41,5 +44,3 @@ def self.failure_reasons end end end - -Enums::Ci::CommitStatus.prepend_mod_with('Enums::Ci::CommitStatus') diff --git a/app/presenters/commit_status_presenter.rb b/app/presenters/commit_status_presenter.rb index fdfcc896bf85d09d3e91b74d3a18446e1dae99b7..98a06be54cb671e5a57e5b11805c0b2b71588ffd 100644 --- a/app/presenters/commit_status_presenter.rb +++ b/app/presenters/commit_status_presenter.rb @@ -16,8 +16,11 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated data_integrity_failure: 'There has been a structural integrity problem detected, please contact system administrator', forward_deployment_failure: 'The deployment job is older than the previously succeeded deployment job, and therefore cannot be run', pipeline_loop_detected: 'This job could not be executed because it would create infinitely looping pipelines', + insufficient_upstream_permissions: 'This job could not be executed because of insufficient permissions to track the upstream project.', + upstream_bridge_project_not_found: 'This job could not be executed because upstream bridge project could not be found.', 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', + protected_environment_failure: 'The environment this job is deploying to is protected. Only users with permission may successfully run this job.', 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', downstream_pipeline_creation_failed: 'The downstream pipeline could not be created', @@ -61,5 +64,3 @@ def help_page_link(path, anchor) ActionController::Base.helpers.link_to('How do I fix it?', help_page_path(path, anchor: anchor)) end end - -CommitStatusPresenter.prepend_mod_with('CommitStatusPresenter') diff --git a/ee/app/models/concerns/ee/enums/ci/commit_status.rb b/ee/app/models/concerns/ee/enums/ci/commit_status.rb deleted file mode 100644 index e0cf7daa292056c9b1d02c4be77427b905640a45..0000000000000000000000000000000000000000 --- a/ee/app/models/concerns/ee/enums/ci/commit_status.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module EE - module Enums - module Ci - module CommitStatus - extend ActiveSupport::Concern - - class_methods do - extend ::Gitlab::Utils::Override - - override :failure_reasons - def failure_reasons - super.merge(protected_environment_failure: 1_000, - upstream_bridge_project_not_found: 1_004, - insufficient_upstream_permissions: 1_005) - end - end - end - end - end -end diff --git a/ee/app/models/ee/commit_status.rb b/ee/app/models/ee/commit_status.rb deleted file mode 100644 index 2329b810745ac9e2083b1ecea356b8b21cf7891e..0000000000000000000000000000000000000000 --- a/ee/app/models/ee/commit_status.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true -module EE - module CommitStatus - EE_FAILURE_REASONS = { - protected_environment_failure: 1_000 - }.freeze - end -end diff --git a/ee/app/presenters/ee/commit_status_presenter.rb b/ee/app/presenters/ee/commit_status_presenter.rb deleted file mode 100644 index 923b18d2a31039f540b40baa13c971f060d179f3..0000000000000000000000000000000000000000 --- a/ee/app/presenters/ee/commit_status_presenter.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true -module EE - module CommitStatusPresenter - extend ActiveSupport::Concern - - prepended do - EE_CALLOUT_FAILURE_MESSAGES = const_get(:CALLOUT_FAILURE_MESSAGES, false).merge( - protected_environment_failure: 'The environment this job is deploying to is protected. Only users with permission may successfully run this job.', - insufficient_upstream_permissions: 'This job could not be executed because of insufficient permissions to track the upstream project.', - upstream_bridge_project_not_found: 'This job could not be executed because upstream bridge project could not be found.' - ).freeze - - EE::CommitStatusPresenter.private_constant :EE_CALLOUT_FAILURE_MESSAGES - end - - class_methods do - def callout_failure_messages - EE_CALLOUT_FAILURE_MESSAGES - end - end - end -end diff --git a/ee/lib/ee/gitlab/ci/status/build/failed.rb b/ee/lib/ee/gitlab/ci/status/build/failed.rb deleted file mode 100644 index 10ab56ebb8a7c7cf30a46edd2d2a054402b40236..0000000000000000000000000000000000000000 --- a/ee/lib/ee/gitlab/ci/status/build/failed.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module EE - module Gitlab - module Ci - module Status - module Build - module Failed - extend ActiveSupport::Concern - - prepended do - EE_REASONS = const_get(:REASONS, false).merge( - protected_environment_failure: 'protected environment failure', - upstream_bridge_project_not_found: 'upstream project could not be found', - insufficient_upstream_permissions: 'no permissions to read upstream project' - ).freeze - EE::Gitlab::Ci::Status::Build::Failed.private_constant :EE_REASONS - end - - class_methods do - extend ::Gitlab::Utils::Override - - override :reasons - def reasons - EE_REASONS - end - end - end - end - end - end - end -end diff --git a/lib/gitlab/ci/status/build/failed.rb b/lib/gitlab/ci/status/build/failed.rb index 5dd28157b1f73ba9191077a1a6933c51a573386a..3ba2a3c7debf5fa5af375f1f2a89dcf094e99eba 100644 --- a/lib/gitlab/ci/status/build/failed.rb +++ b/lib/gitlab/ci/status/build/failed.rb @@ -20,10 +20,13 @@ class Failed < Status::Extended scheduler_failure: 'scheduler failure', data_integrity_failure: 'data integrity failure', forward_deployment_failure: 'forward deployment failure', + protected_environment_failure: 'protected environment failure', pipeline_loop_detected: 'job would create infinitely looping pipelines', invalid_bridge_trigger: 'downstream pipeline trigger definition is invalid', downstream_bridge_project_not_found: 'downstream project could not be found', + upstream_bridge_project_not_found: 'upstream project could not be found', insufficient_bridge_permissions: 'no permissions to trigger downstream pipeline', + insufficient_upstream_permissions: 'no permissions to read upstream project', bridge_pipeline_is_child_pipeline: 'creation of child pipeline not allowed from another child pipeline', downstream_pipeline_creation_failed: 'downstream pipeline can not be created', secrets_provider_not_found: 'secrets provider can not be found', @@ -74,5 +77,3 @@ def failure_reason_message end end end - -Gitlab::Ci::Status::Build::Failed.prepend_mod_with('Gitlab::Ci::Status::Build::Failed')