summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2018-12-13 15:12:36 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2018-12-13 15:12:36 +0100
commitc5536fd947d30975f7c302bb8adf55ffc70be90e (patch)
tree9dbe7bca15623dab54f852a8751b3343752dccbe
parent81ddb69255f36bccd79c714a2c12d542cf782f8d (diff)
downloadgitlab-ce-c5536fd947d30975f7c302bb8adf55ffc70be90e.tar.gz
Refactor Ci::Pipeline's config_sources enum
This enum is now defined in the Ci::PipelineEnums module, allowing EE to extend this enum without having to modify Ci::Pipeline directly.
-rw-r--r--app/models/ci/pipeline.rb6
-rw-r--r--app/models/ci/pipeline_enums.rb10
2 files changed, 11 insertions, 5 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index d06022a0fb7..2cdb4780412 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -68,11 +68,7 @@ module Ci
# this `Hash` with new values.
enum_with_nil source: ::Ci::PipelineEnums.sources
- enum_with_nil config_source: {
- unknown_source: nil,
- repository_source: 1,
- auto_devops_source: 2
- }
+ enum_with_nil config_source: ::Ci::PipelineEnums.config_sources
# We use `Ci::PipelineEnums.failure_reasons` here so that EE can more easily
# extend this `Hash` with new values.
diff --git a/app/models/ci/pipeline_enums.rb b/app/models/ci/pipeline_enums.rb
index c0f16066e0b..2994aaae4aa 100644
--- a/app/models/ci/pipeline_enums.rb
+++ b/app/models/ci/pipeline_enums.rb
@@ -25,5 +25,15 @@ module Ci
merge_request: 10
}
end
+
+ # Returns the `Hash` to use for creating the `config_sources` enum for
+ # `Ci::Pipeline`.
+ def self.config_sources
+ {
+ unknown_source: nil,
+ repository_source: 1,
+ auto_devops_source: 2
+ }
+ end
end
end