summaryrefslogtreecommitdiff
path: root/app/models/ci/variable.rb
diff options
context:
space:
mode:
authorDiego Souza <diegosouza.br@gmail.com>2016-09-08 22:01:49 -0300
committerDiego Souza <diegosouza.br@gmail.com>2016-09-09 15:06:50 -0300
commit43d2cd511c3e068f78fb71387ae0ac31db4926b1 (patch)
treee0d86ec12536dfc53ee3d24b1dbcaa0144f9968c /app/models/ci/variable.rb
parent796bdf1dcb86b5e77fc054208afc632f75518605 (diff)
downloadgitlab-ce-43d2cd511c3e068f78fb71387ae0ac31db4926b1.tar.gz
Sort secret variables by key (fix #20870)
Diffstat (limited to 'app/models/ci/variable.rb')
-rw-r--r--app/models/ci/variable.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/ci/variable.rb b/app/models/ci/variable.rb
index c9c47ec7419..6959223aed9 100644
--- a/app/models/ci/variable.rb
+++ b/app/models/ci/variable.rb
@@ -1,7 +1,7 @@
module Ci
class Variable < ActiveRecord::Base
extend Ci::Model
-
+
belongs_to :project, class_name: '::Project', foreign_key: :gl_project_id
validates_uniqueness_of :key, scope: :gl_project_id
@@ -11,7 +11,9 @@ module Ci
format: { with: /\A[a-zA-Z0-9_]+\z/,
message: "can contain only letters, digits and '_'." }
- attr_encrypted :value,
+ scope :order_key_asc, -> { reorder(key: :asc) }
+
+ attr_encrypted :value,
mode: :per_attribute_iv_and_salt,
insecure_mode: true,
key: Gitlab::Application.secrets.db_key_base,