From 33212c8ff1f99cdb896e8fc6f6450882287e0de5 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 15 Sep 2020 12:09:30 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- lib/gitlab/alert_management/alert_params.rb | 1 + lib/gitlab/alerting/notification_payload_parser.rb | 11 +++++++++-- lib/gitlab/checks/lfs_integrity.rb | 2 +- lib/gitlab/cleanup/orphan_lfs_file_references.rb | 8 -------- lib/gitlab/import_export/lfs_saver.rb | 2 +- lib/gitlab/pages/settings.rb | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/gitlab/alert_management/alert_params.rb b/lib/gitlab/alert_management/alert_params.rb index 0edc77efa10..3bb839c1114 100644 --- a/lib/gitlab/alert_management/alert_params.rb +++ b/lib/gitlab/alert_management/alert_params.rb @@ -20,6 +20,7 @@ module Gitlab hosts: Array(annotations[:hosts]), payload: payload, started_at: parsed_payload['startsAt'], + ended_at: parsed_payload['endsAt'], severity: annotations[:severity], fingerprint: annotations[:fingerprint], environment: annotations[:environment] diff --git a/lib/gitlab/alerting/notification_payload_parser.rb b/lib/gitlab/alerting/notification_payload_parser.rb index ce04205a1ba..348f851f551 100644 --- a/lib/gitlab/alerting/notification_payload_parser.rb +++ b/lib/gitlab/alerting/notification_payload_parser.rb @@ -20,7 +20,8 @@ module Gitlab def call { 'annotations' => annotations, - 'startsAt' => starts_at + 'startsAt' => starts_at, + 'endsAt' => ends_at }.compact end @@ -74,6 +75,12 @@ module Gitlab current_time end + def ends_at + Time.parse(payload[:end_time].to_s).rfc3339 + rescue ArgumentError + nil + end + def environment environment_name = payload[:gitlab_environment_name] @@ -85,7 +92,7 @@ module Gitlab end def secondary_params - payload.except(:start_time) + payload.except(:start_time, :end_time) end def flatten_secondary_params diff --git a/lib/gitlab/checks/lfs_integrity.rb b/lib/gitlab/checks/lfs_integrity.rb index e18cf6ff8f2..78952db7a3e 100644 --- a/lib/gitlab/checks/lfs_integrity.rb +++ b/lib/gitlab/checks/lfs_integrity.rb @@ -17,7 +17,7 @@ module Gitlab return false unless new_lfs_pointers.present? - existing_count = @project.all_lfs_objects + existing_count = @project.lfs_objects .for_oids(new_lfs_pointers.map(&:lfs_oid)) .count diff --git a/lib/gitlab/cleanup/orphan_lfs_file_references.rb b/lib/gitlab/cleanup/orphan_lfs_file_references.rb index 10b227f3a2a..14eac474e27 100644 --- a/lib/gitlab/cleanup/orphan_lfs_file_references.rb +++ b/lib/gitlab/cleanup/orphan_lfs_file_references.rb @@ -17,14 +17,6 @@ module Gitlab end def run! - # If this project is an LFS storage project (e.g. is the root of a fork - # network), what it is safe to remove depends on the sum of its forks. - # For now, skip cleaning up LFS for this complicated case - if project.forks_count > 0 && project.lfs_storage_project == project - log_info("Skipping orphan LFS check for #{project.name_with_namespace} as it is a fork root") - return - end - log_info("Looking for orphan LFS files for project #{project.name_with_namespace}") remove_orphan_references diff --git a/lib/gitlab/import_export/lfs_saver.rb b/lib/gitlab/import_export/lfs_saver.rb index 18c590e1ca9..515fd98630c 100644 --- a/lib/gitlab/import_export/lfs_saver.rb +++ b/lib/gitlab/import_export/lfs_saver.rb @@ -16,7 +16,7 @@ module Gitlab end def save - project.all_lfs_objects.find_in_batches(batch_size: BATCH_SIZE) do |batch| + project.lfs_objects.find_in_batches(batch_size: BATCH_SIZE) do |batch| batch.each do |lfs_object| save_lfs_object(lfs_object) end diff --git a/lib/gitlab/pages/settings.rb b/lib/gitlab/pages/settings.rb index 47f56072b37..8650a80a85e 100644 --- a/lib/gitlab/pages/settings.rb +++ b/lib/gitlab/pages/settings.rb @@ -6,7 +6,7 @@ module Gitlab DiskAccessDenied = Class.new(StandardError) def path - if ::Gitlab::Runtime.web_server? && ENV['GITLAB_PAGES_DENY_DISK_ACCESS'] == '1' + if ::Gitlab::Runtime.web_server? && !::Gitlab::Runtime.test_suite? raise DiskAccessDenied end -- cgit v1.2.1