Extract EE specific files/lines for CI/CD lib/api
We have the following files containing EE specific code. We should move them to ee/
lib/api/triggers.rb
diff --git a/lib/api/triggers.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/api/triggers.rb
index 8fc7c7361e1..0e829c5699b 100644
--- a/lib/api/triggers.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/api/triggers.rb
@@ -13,7 +13,7 @@ module API
end
params do
requires :ref, type: String, desc: 'The commit sha or name of a branch or tag', allow_blank: false
- requires :token, type: String, desc: 'The unique token of trigger'
+ requires :token, type: String, desc: 'The unique token of trigger or job token'
optional :variables, type: Hash, desc: 'The list of variables to be injected into build'
end
post ":id/(ref/:ref/)trigger/pipeline", requirements: { ref: /.+/ } do
lib/api/variables.rb
diff --git a/lib/api/variables.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/api/variables.rb
index 148deb86c4c..921b8887a57 100644
--- a/lib/api/variables.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/api/variables.rb
@@ -47,10 +47,17 @@ module API
requires :key, type: String, desc: 'The key of the variable'
requires :value, type: String, desc: 'The value of the variable'
optional :protected, type: String, desc: 'Whether the variable is protected'
+
+ # EE
+ optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
end
post ':id/variables' do
variable_params = declared_params(include_missing: false)
+ # EE
+ variable_params.delete(:environment_scope) unless
+ user_project.feature_available?(:variable_environment_scope)
+
variable = user_project.variables.create(variable_params)
if variable.valid?
@@ -67,6 +74,9 @@ module API
optional :key, type: String, desc: 'The key of the variable'
optional :value, type: String, desc: 'The value of the variable'
optional :protected, type: String, desc: 'Whether the variable is protected'
+
+ # EE
+ optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
end
# rubocop: disable CodeReuse/ActiveRecord
put ':id/variables/:key' do
@@ -76,6 +86,10 @@ module API
variable_params = declared_params(include_missing: false).except(:key)
+ # EE
+ variable_params.delete(:environment_scope) unless
+ user_project.feature_available?(:variable_environment_scope)
+
if variable.update(variable_params)
present variable, with: Entities::Variable
else
Edited by Yorick Peterse