summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-02-05 15:23:32 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-02-05 18:58:21 +0100
commit79570ce24fa93709db7a7bdd4fae2532a7235486 (patch)
treece9bd4dbce252fdc71441e02896bd4f47e5e1105 /app
parentf7ed096455c932a5ead8bafb8c937ff9cdb3070c (diff)
downloadgitlab-ce-79570ce24fa93709db7a7bdd4fae2532a7235486.tar.gz
Fix validation of duplicate new variablesdynamic-pipeline-variables
Diffstat (limited to 'app')
-rw-r--r--app/models/group.rb1
-rw-r--r--app/models/project.rb1
2 files changed, 2 insertions, 0 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index 29df4144d03..75bf013ecd2 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -36,6 +36,7 @@ class Group < Namespace
validate :visibility_level_allowed_by_projects
validate :visibility_level_allowed_by_sub_groups
validate :visibility_level_allowed_by_parent
+ validates :variables, variable_duplicates: true
validates :two_factor_grace_period, presence: true, numericality: { greater_than_or_equal_to: 0 }
diff --git a/app/models/project.rb b/app/models/project.rb
index 12d5f28f5ea..7e0a10cb4cd 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -261,6 +261,7 @@ class Project < ActiveRecord::Base
validates :repository_storage,
presence: true,
inclusion: { in: ->(_object) { Gitlab.config.repositories.storages.keys } }
+ validates :variables, variable_duplicates: true
has_many :uploads, as: :model, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent