summaryrefslogtreecommitdiff
path: root/lib/api/variables.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-06-02 15:28:17 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-06-02 15:28:17 +0100
commitf461de24dff1d1a1b877fbe6ab45aa71e3f3f32d (patch)
tree453b6bde71e9e800dd57bcb72853ee8c485893a8 /lib/api/variables.rb
parent4a8a59c857c34a46fb7e0f1d61171ae8bd2c9b37 (diff)
parentdab266219441144a74b86fa27f4e0528810482d1 (diff)
downloadgitlab-ce-job-details-increase-deboune.tar.gz
Merge branch 'master' into job-details-increase-debounejob-details-increase-deboune
* master: (273 commits) Pipeline show view real time header section Minor refactor based on review feedback Address review comments Show current user immediately in issuable filters Rename `Gitlab::Git::EncodingHelper` to `Gitlab::EncodingHelper` Add new Rake task to simplify the compilation of PO files Fix race condition between pipeline creation and MR diff_head_sha update Resolve "Improve Container Registry description" Allow admins to delete users from the admin users page Add username parameter to gravatar URL Explicitly test etag cache invalidation Fix replying to a commit discussion displayed in the context of an MR Add fog-aliyun as backup storage provider Add missing specs Make sure protected can't be null; Test protected! Update session cookie key name to be unique to instance in development Just mention which GitLab version is required Fix data inconsistency issue for old artifacts by moving them to a currently used path Fix N+1 queries for non-members in comment threads Fix rubocop in spec/helpers/diff_helper_spec.rb ...
Diffstat (limited to 'lib/api/variables.rb')
-rw-r--r--lib/api/variables.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/api/variables.rb b/lib/api/variables.rb
index 5acde41551b..381c4ef50b0 100644
--- a/lib/api/variables.rb
+++ b/lib/api/variables.rb
@@ -42,6 +42,7 @@ module API
params do
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'
end
post ':id/variables' do
variable = user_project.variables.create(declared(params, include_parent_namespaces: false).to_h)
@@ -59,13 +60,14 @@ module API
params do
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'
end
put ':id/variables/:key' do
variable = user_project.variables.find_by(key: params[:key])
return not_found!('Variable') unless variable
- if variable.update(value: params[:value])
+ if variable.update(declared_params(include_missing: false).except(:key))
present variable, with: Entities::Variable
else
render_validation_error!(variable)