diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-11-22 12:47:26 +0100 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-11-22 12:51:46 +0100 |
commit | a952c84ffdf736e1c4fae39ee38d7f8a75093c3b (patch) | |
tree | c52d6e1f5d64177d90264fd049f4aed223f6c432 | |
parent | 2e3dab38295b7c36ab100f20c654fdfaf9b00885 (diff) | |
download | gitlab-ce-revert-enum-changes.tar.gz |
Revert changes to enums.revert-enum-changes
All enums has to be backported to CE.
-rw-r--r-- | app/models/ci/job_artifact.rb | 1 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 26 | ||||
-rw-r--r-- | app/models/ci/pipeline_enums.rb | 28 | ||||
-rw-r--r-- | app/models/commit_status.rb | 17 | ||||
-rw-r--r-- | app/models/commit_status_enums.rb | 20 | ||||
-rw-r--r-- | app/models/user_callout.rb | 10 | ||||
-rw-r--r-- | app/models/user_callout_enums.rb | 16 |
7 files changed, 42 insertions, 76 deletions
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index 11c88200c37..5300bcdd0d0 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -75,6 +75,7 @@ module Ci delegate :filename, :exists?, :open, to: :file + # All EE-only enums has to be backported to CE enum file_type: { archive: 1, metadata: 2, diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 9512ba42f67..c97ef362294 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -58,19 +58,33 @@ module Ci after_create :keep_around_commits, unless: :importing? - # We use `Ci::PipelineEnums.sources` here so that EE can more easily extend - # this `Hash` with new values. - enum_with_nil source: ::Ci::PipelineEnums.sources + # All EE-only enums has to be backported to CE + enum_with_nil source: { + unknown: nil, + push: 1, + web: 2, + trigger: 3, + schedule: 4, + api: 5, + external: 6, + pipeline: 7, # EE-only + chat: 8 # EE-only + } + # All EE-only enums has to be backported to CE enum_with_nil config_source: { unknown_source: nil, repository_source: 1, auto_devops_source: 2 } - # We use `Ci::PipelineEnums.failure_reasons` here so that EE can more easily - # extend this `Hash` with new values. - enum failure_reason: ::Ci::PipelineEnums.failure_reasons + # All EE-only enums has to be backported to CE + enum failure_reason: { + unknown_failure: 0, + config_error: 1, + activity_limit_exceeded: 20, # EE-only + size_limit_exceeded: 21 # EE-only + } state_machine :status, initial: :created do event :enqueue do diff --git a/app/models/ci/pipeline_enums.rb b/app/models/ci/pipeline_enums.rb deleted file mode 100644 index 8d8d16e2ec1..00000000000 --- a/app/models/ci/pipeline_enums.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -module Ci - module PipelineEnums - # Returns the `Hash` to use for creating the `failure_reason` enum for - # `Ci::Pipeline`. - def self.failure_reasons - { - unknown_failure: 0, - config_error: 1 - } - end - - # Returns the `Hash` to use for creating the `sources` enum for - # `Ci::Pipeline`. - def self.sources - { - unknown: nil, - push: 1, - web: 2, - trigger: 3, - schedule: 4, - api: 5, - external: 6 - } - end - end -end diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 0f50bd39131..ecbb9caea3c 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -42,9 +42,20 @@ class CommitStatus < ActiveRecord::Base scope :retried_ordered, -> { retried.ordered.includes(project: :namespace) } scope :after_stage, -> (index) { where('stage_idx > ?', index) } - # We use `CommitStatusEnums.failure_reasons` here so that EE can more easily - # extend this `Hash` with new values. - enum_with_nil failure_reason: ::CommitStatusEnums.failure_reasons + # All EE-only enums has to be backported to CE + enum_with_nil failure_reason: { + unknown_failure: nil, + script_failure: 1, + api_failure: 2, + stuck_or_timeout_failure: 3, + runner_system_failure: 4, + missing_dependency_failure: 5, + runner_unsupported: 6, + stale_schedule: 7, + job_execution_timeout: 8, + archived_failure: 9, + protected_environment_failure: 1_000 # EE-only + } ## # We still create some CommitStatuses outside of CreatePipelineService. diff --git a/app/models/commit_status_enums.rb b/app/models/commit_status_enums.rb deleted file mode 100644 index 152105d9429..00000000000 --- a/app/models/commit_status_enums.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module CommitStatusEnums - # Returns the Hash to use for creating the `failure_reason` enum for - # `CommitStatus`. - def self.failure_reasons - { - unknown_failure: nil, - script_failure: 1, - api_failure: 2, - stuck_or_timeout_failure: 3, - runner_system_failure: 4, - missing_dependency_failure: 5, - runner_unsupported: 6, - stale_schedule: 7, - job_execution_timeout: 8, - archived_failure: 9 - } - end -end diff --git a/app/models/user_callout.rb b/app/models/user_callout.rb index 76e7bc06b4e..8b2203c24b8 100644 --- a/app/models/user_callout.rb +++ b/app/models/user_callout.rb @@ -3,9 +3,13 @@ class UserCallout < ActiveRecord::Base belongs_to :user - # We use `UserCalloutEnums.feature_names` here so that EE can more easily - # extend this `Hash` with new values. - enum feature_name: ::UserCalloutEnums.feature_names + # All EE-only enums has to be backported to CE + enum feature_name: { + gke_cluster_integration: 1, + gcp_signup_offer: 2, + cluster_security_warning: 3, + gold_trial: 4 # EE-only + } validates :user, presence: true validates :feature_name, diff --git a/app/models/user_callout_enums.rb b/app/models/user_callout_enums.rb deleted file mode 100644 index b9373ae6166..00000000000 --- a/app/models/user_callout_enums.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module UserCalloutEnums - # Returns the `Hash` to use for the `feature_name` enum in the `UserCallout` - # model. - # - # This method is separate from the `UserCallout` model so that it can be - # extended by EE. - def self.feature_names - { - gke_cluster_integration: 1, - gcp_signup_offer: 2, - cluster_security_warning: 3 - } - end -end |