From 0ac7e6729d4763b1fce8cb3540b2b8d0d20b2ed8 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 15 Apr 2019 17:56:53 +1200 Subject: Update API to support typed CI variables Update API endpoints and docs about project level variables, group level variables, pipeline variables, and pipeline schedule variables to support variable types. --- lib/api/variables.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/api/variables.rb') diff --git a/lib/api/variables.rb b/lib/api/variables.rb index 3489ba827e4..bf09a1c8a4d 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -55,6 +55,7 @@ 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' + optional :variable_type, type: String, 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' @@ -80,6 +81,7 @@ 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' + optional :variable_type, type: String, 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' -- cgit v1.2.1 From 3d52949e5b5d5f929baf2d7e353ca029d4c4db29 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 17 Apr 2019 10:39:32 +1200 Subject: Add validation for variable type to API endpoints --- lib/api/variables.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/api/variables.rb') diff --git a/lib/api/variables.rb b/lib/api/variables.rb index bf09a1c8a4d..a1bb21b3a06 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -55,7 +55,7 @@ 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' - optional :variable_type, type: String, 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? optional :environment_scope, type: String, desc: 'The environment_scope of the variable' @@ -81,7 +81,7 @@ 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' - optional :variable_type, type: String, 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? optional :environment_scope, type: String, desc: 'The environment_scope of the variable' -- cgit v1.2.1