summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-05 23:11:43 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-05 23:11:43 +0000
commit13d327df4f3c52505bf8ec1144f2dedb6a351ad6 (patch)
tree546e42fe159cde302b5e4d0b923d399e79bfbf71 /lib
parent9a70fcd2e277721bbe7b9a0c92ed925ddea201b6 (diff)
downloadgitlab-ce-13d327df4f3c52505bf8ec1144f2dedb6a351ad6.tar.gz
Add latest changes from gitlab-org/gitlab@13-9-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/background_migration/backfill_artifact_expiry_date.rb13
-rw-r--r--lib/gitlab/kroki.rb3
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/gitlab/background_migration/backfill_artifact_expiry_date.rb b/lib/gitlab/background_migration/backfill_artifact_expiry_date.rb
index 0a8c203421b..f6b36571c90 100644
--- a/lib/gitlab/background_migration/backfill_artifact_expiry_date.rb
+++ b/lib/gitlab/background_migration/backfill_artifact_expiry_date.rb
@@ -6,9 +6,9 @@ module Gitlab
class BackfillArtifactExpiryDate
include Gitlab::Utils::StrongMemoize
- BATCH_SIZE = 1_000
- DEFAULT_EXPIRATION_SWITCH_DATE = Date.new(2020, 6, 22).freeze
+ SWITCH_DATE = Date.new(2020, 06, 22).freeze
OLD_ARTIFACT_AGE = 15.months
+ BATCH_SIZE = 1_000
OLD_ARTIFACT_EXPIRY_OFFSET = 3.months
RECENT_ARTIFACT_EXPIRY_OFFSET = 1.year
@@ -18,16 +18,17 @@ module Gitlab
self.table_name = 'ci_job_artifacts'
- scope :between, -> (start_id, end_id) { where(id: start_id..end_id) }
- scope :before_default_expiration_switch, -> { where('created_at < ?', DEFAULT_EXPIRATION_SWITCH_DATE) }
scope :without_expiry_date, -> { where(expire_at: nil) }
+ scope :before_switch, -> { where("date(created_at AT TIME ZONE 'UTC') < ?::date", SWITCH_DATE) }
+ scope :between, -> (start_id, end_id) { where(id: start_id..end_id) }
scope :old, -> { where(self.arel_table[:created_at].lt(OLD_ARTIFACT_AGE.ago)) }
scope :recent, -> { where(self.arel_table[:created_at].gt(OLD_ARTIFACT_AGE.ago)) }
end
def perform(start_id, end_id)
- Ci::JobArtifact.between(start_id, end_id)
- .without_expiry_date.before_default_expiration_switch
+ Ci::JobArtifact
+ .without_expiry_date.before_switch
+ .between(start_id, end_id)
.each_batch(of: BATCH_SIZE) do |batch|
batch.old.update_all(expire_at: old_artifact_expiry_date)
batch.recent.update_all(expire_at: recent_artifact_expiry_date)
diff --git a/lib/gitlab/kroki.rb b/lib/gitlab/kroki.rb
index 2948b6ebd5b..fa10e922c80 100644
--- a/lib/gitlab/kroki.rb
+++ b/lib/gitlab/kroki.rb
@@ -31,9 +31,6 @@ module Gitlab
DIAGRAMS_FORMATS
end
- # No additional diagram formats
- return diagram_formats unless current_settings.kroki_formats.present?
-
# Diagrams that require a companion container must be explicitly enabled from the settings
diagram_formats.select do |diagram_type|
current_settings.kroki_format_supported?(diagram_type)