summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorImre Farkas <ifarkas@gitlab.com>2019-05-24 17:31:08 +0200
committerImre Farkas <ifarkas@gitlab.com>2019-05-27 20:35:18 +0200
commitabf2767f2ae86457750ed309dc10be664635f961 (patch)
tree748b7306f59170786c346497e5d398273ecd244f
parent90bb8a21b8333e88912eef3ac08836d7939b9a5b (diff)
downloadgitlab-ce-if-10137-ee_specific_lines_variables_api.tar.gz
Move EE specific lines in API::Variablesif-10137-ee_specific_lines_variables_api
-rw-r--r--lib/api/helpers/variables_helpers.rb13
-rw-r--r--lib/api/variables.rb10
2 files changed, 17 insertions, 6 deletions
diff --git a/lib/api/helpers/variables_helpers.rb b/lib/api/helpers/variables_helpers.rb
new file mode 100644
index 00000000000..78a92d0f5a6
--- /dev/null
+++ b/lib/api/helpers/variables_helpers.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module API
+ module Helpers
+ module VariablesHelpers
+ extend ActiveSupport::Concern
+ extend Grape::API::Helpers
+
+ params :optional_params_ee do
+ end
+ end
+ end
+end
diff --git a/lib/api/variables.rb b/lib/api/variables.rb
index a1bb21b3a06..e952d981221 100644
--- a/lib/api/variables.rb
+++ b/lib/api/variables.rb
@@ -7,6 +7,8 @@ module API
before { authenticate! }
before { authorize! :admin_build, user_project }
+ helpers Helpers::VariablesHelpers
+
helpers do
def filter_variable_parameters(params)
# This method exists so that EE can more easily filter out certain
@@ -57,9 +59,7 @@ module API
optional :protected, type: String, desc: 'Whether the variable is protected'
optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
- if Gitlab.ee?
- optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
- end
+ use :optional_params_ee
end
post ':id/variables' do
variable_params = declared_params(include_missing: false)
@@ -83,9 +83,7 @@ module API
optional :protected, type: String, desc: 'Whether the variable is protected'
optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
- if Gitlab.ee?
- optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
- end
+ use :optional_params_ee
end
# rubocop: disable CodeReuse/ActiveRecord
put ':id/variables/:key' do