summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2016-01-07 13:49:38 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2016-01-07 13:49:38 +0100
commitb60c146267dfa8dc1c170426e1817c6b2a168d1a (patch)
tree1eb9a3417f802616e884f68548576fdbb5beadf8 /app/models/ci
parent16bd4df083135e2e4a263b2e1bdd71b78a875ef7 (diff)
downloadgitlab-ce-b60c146267dfa8dc1c170426e1817c6b2a168d1a.tar.gz
Change :variable_id to :key as resource ID in API
Diffstat (limited to 'app/models/ci')
-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 0e2712086ca..1d9ee91a31c 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