Commit ba4977ab authored by Imre Farkas's avatar Imre Farkas Committed by Yorick Peterse

CE port of Move EE specific lines in API::Variables

parent c8624438
# 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
...@@ -7,6 +7,8 @@ module API ...@@ -7,6 +7,8 @@ module API
before { authenticate! } before { authenticate! }
before { authorize! :admin_build, user_project } before { authorize! :admin_build, user_project }
helpers Helpers::VariablesHelpers
helpers do helpers do
def filter_variable_parameters(params) def filter_variable_parameters(params)
# This method exists so that EE can more easily filter out certain # This method exists so that EE can more easily filter out certain
...@@ -58,9 +60,7 @@ module API ...@@ -58,9 +60,7 @@ module API
optional :masked, type: Boolean, desc: 'Whether the variable is masked' optional :masked, type: Boolean, desc: 'Whether the variable is masked'
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' 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? use :optional_params_ee
optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
end
end end
post ':id/variables' do post ':id/variables' do
variable_params = declared_params(include_missing: false) variable_params = declared_params(include_missing: false)
...@@ -85,9 +85,7 @@ module API ...@@ -85,9 +85,7 @@ module API
optional :masked, type: Boolean, desc: 'Whether the variable is masked' optional :masked, type: Boolean, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file' 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? use :optional_params_ee
optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
end
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
put ':id/variables/:key' do put ':id/variables/:key' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment