Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-26 21:08:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-26 21:08:27 +0300
commita683d38a36aadac5c244299d37325424d85fa9e5 (patch)
tree781918595397211ce4e6adb4757f6c54bcd902c6 /app/models/container_expiration_policy.rb
parenta1908447b77a6d005a77f1be2f717cd35274c82d (diff)
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.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/models/container_expiration_policy.rb b/app/models/container_expiration_policy.rb
index 641d244b665..3f91f6c796a 100644
--- a/app/models/container_expiration_policy.rb
+++ b/app/models/container_expiration_policy.rb
@@ -5,6 +5,13 @@ class ContainerExpirationPolicy < ApplicationRecord
include UsageStatistics
include EachBatch
+ POLICY_PARAMS = %w[
+ older_than
+ keep_n
+ name_regex
+ name_regex_keep
+ ].freeze
+
belongs_to :project, inverse_of: :container_expiration_policy
delegate :container_repositories, to: :project
@@ -20,8 +27,8 @@ class ContainerExpirationPolicy < ApplicationRecord
scope :active, -> { where(enabled: true) }
scope :preloaded, -> { preload(project: [:route]) }
- def self.executable
- runnable_schedules.where(
+ def self.with_container_repositories
+ where(
'EXISTS (?)',
ContainerRepository.select(1)
.where(
@@ -67,4 +74,8 @@ class ContainerExpirationPolicy < ApplicationRecord
def disable!
update_attribute(:enabled, false)
end
+
+ def policy_params
+ attributes.slice(*POLICY_PARAMS)
+ end
end