diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-07-06 13:11:07 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-07-06 13:11:07 +0000 |
commit | ec3b10e078de03ac32ef85872d3d1518ef8526d5 (patch) | |
tree | 032fc483f456228b19587cafbce8d31c9ab5603a /lib/api | |
parent | 1bdd295394d115cb88a9b6be7f44851c6e58a491 (diff) | |
parent | d9435d61218f677395f3b53976a41ac5f361f24b (diff) | |
download | gitlab-ce-ec3b10e078de03ac32ef85872d3d1518ef8526d5.tar.gz |
Merge branch '34716-environment-specific-variables-ce' into 'master'
Backports for ee-2112
Closes #34716
See merge request !12671
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/variables.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/variables.rb b/lib/api/variables.rb index 10374995497..7fa528fb2d3 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -45,7 +45,9 @@ module API optional :protected, type: String, desc: 'Whether the variable is protected' end post ':id/variables' do - variable = user_project.variables.create(declared_params(include_missing: false)) + variable_params = declared_params(include_missing: false) + + variable = user_project.variables.create(variable_params) if variable.valid? present variable, with: Entities::Variable @@ -67,7 +69,9 @@ module API return not_found!('Variable') unless variable - if variable.update(declared_params(include_missing: false).except(:key)) + variable_params = declared_params(include_missing: false).except(:key) + + if variable.update(variable_params) present variable, with: Entities::Variable else render_validation_error!(variable) |