summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2016-01-14 13:09:54 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2016-01-14 13:09:54 +0100
commitaf3b97cdde6242b13da78f5f685975a98c35e322 (patch)
treeea6ad3f59a46147648e3eb2ca4c78d6494ccde19 /app/models
parent41eedd45716cbb68fa8c6eaeb110ce2b1f612919 (diff)
parentf981da44ab88012db984e1457170067b345660c1 (diff)
downloadgitlab-ce-af3b97cdde6242b13da78f5f685975a98c35e322.tar.gz
Merge branch 'master' into ci/api-triggers
* master: Fix version Improve the consistency of commit titles, branch names, tag names, issue/MR titles, on their respective project pages Update CHANGELOG [ci skip] Add some cosmetic changes to variables API documentation [ci skip] Modify builds API documentation style [ci skip] Modify :ci_variable factory Add 'Build' prefix to Variables entry name in API docs index Fix some typos Add some fixes after review Remove blank line Update ./doc/api Change :variable_id to :key as resource ID in API Fix a typo in method description Add create feature to variables API Add missing 'not_found' checks in variables API Add delete feature to variables API Add update feature for variables API Add features for list and show details of variables in API Conflicts: doc/api/README.md lib/api/entities.rb
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/variable.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/ci/variable.rb b/app/models/ci/variable.rb
index 7f6f497f325..e786bd7dd93 100644
--- a/app/models/ci/variable.rb
+++ b/app/models/ci/variable.rb
@@ -18,8 +18,12 @@ module Ci
belongs_to :project, class_name: '::Project', foreign_key: :gl_project_id
- validates_presence_of :key
validates_uniqueness_of :key, scope: :gl_project_id
+ validates :key,
+ presence: true,
+ length: { within: 0..255 },
+ format: { with: /\A[a-zA-Z0-9_]+\z/,
+ message: "can contain only letters, digits and '_'." }
attr_encrypted :value, mode: :per_attribute_iv_and_salt, key: Gitlab::Application.secrets.db_key_base
end