summaryrefslogtreecommitdiff
path: root/app/models/ci/variable.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-01-14 13:11:12 +0100
committerDouwe Maan <douwe@gitlab.com>2016-01-14 13:11:12 +0100
commit6b000bee8cdc7005358c2a5cf3a1f12af57dc862 (patch)
treed5a2c566c4106cc359a2f438a81c3e586ac9df29 /app/models/ci/variable.rb
parent05187f0fc671e1ddcbe6d7b0f76971d792acaada (diff)
parentf981da44ab88012db984e1457170067b345660c1 (diff)
downloadgitlab-ce-diff-parse-first-commit.tar.gz
Merge branch 'master' into diff-parse-first-commitdiff-parse-first-commit
Diffstat (limited to 'app/models/ci/variable.rb')
-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