summaryrefslogtreecommitdiff
path: root/app/models/container_expiration_policy.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-11 12:08:54 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-11 12:08:54 +0000
commit0526dc1e681db465189573d0931610c049206106 (patch)
tree8d4241fc85ea1041b259a8c1ec4d4656adb26188 /app/models/container_expiration_policy.rb
parenta64fb464b4081ec468da3fec97dfdede1fbd55e7 (diff)
downloadgitlab-ce-0526dc1e681db465189573d0931610c049206106.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/container_expiration_policy.rb')
-rw-r--r--app/models/container_expiration_policy.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/container_expiration_policy.rb b/app/models/container_expiration_policy.rb
index 76bfbabf3b3..fb1e0ce255e 100644
--- a/app/models/container_expiration_policy.rb
+++ b/app/models/container_expiration_policy.rb
@@ -13,6 +13,8 @@ class ContainerExpirationPolicy < ApplicationRecord
validates :cadence, presence: true, inclusion: { in: ->(_) { self.cadence_options.stringify_keys } }
validates :older_than, inclusion: { in: ->(_) { self.older_than_options.stringify_keys } }, allow_nil: true
validates :keep_n, inclusion: { in: ->(_) { self.keep_n_options.keys } }, allow_nil: true
+ validates :name_regex, untrusted_regexp: true, if: :enabled?
+ validates :name_regex_keep, untrusted_regexp: true, if: :enabled?
scope :active, -> { where(enabled: true) }
scope :preloaded, -> { preload(project: [:route]) }