diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 11:10:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 11:10:13 +0000 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /app/models/bulk_imports | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) | |
download | gitlab-ce-0ea3fcec397b69815975647f5e2aa5fe944a8486.tar.gz |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'app/models/bulk_imports')
-rw-r--r-- | app/models/bulk_imports/entity.rb | 13 | ||||
-rw-r--r-- | app/models/bulk_imports/export_status.rb | 17 | ||||
-rw-r--r-- | app/models/bulk_imports/file_transfer/project_config.rb | 9 | ||||
-rw-r--r-- | app/models/bulk_imports/tracker.rb | 2 |
4 files changed, 18 insertions, 23 deletions
diff --git a/app/models/bulk_imports/entity.rb b/app/models/bulk_imports/entity.rb index dee533944e9..cad2fafe640 100644 --- a/app/models/bulk_imports/entity.rb +++ b/app/models/bulk_imports/entity.rb @@ -99,18 +99,7 @@ class BulkImports::Entity < ApplicationRecord end def pipeline_exists?(name) - pipelines.any? { |_, pipeline| pipeline.to_s == name.to_s } - end - - def create_pipeline_trackers! - self.class.transaction do - pipelines.each do |stage, pipeline| - trackers.create!( - stage: stage, - pipeline_name: pipeline - ) - end - end + pipelines.any? { _1[:pipeline].to_s == name.to_s } end def entity_type diff --git a/app/models/bulk_imports/export_status.rb b/app/models/bulk_imports/export_status.rb index a9750a76987..4fea62edb2a 100644 --- a/app/models/bulk_imports/export_status.rb +++ b/app/models/bulk_imports/export_status.rb @@ -13,11 +13,15 @@ module BulkImports end def started? - export_status['status'] == Export::STARTED + !empty? && export_status['status'] == Export::STARTED end def failed? - export_status['status'] == Export::FAILED + !empty? && export_status['status'] == Export::FAILED + end + + def empty? + export_status.nil? end def error @@ -30,14 +34,7 @@ module BulkImports def export_status strong_memoize(:export_status) do - status = fetch_export_status - - relation_export_status = status&.find { |item| item['relation'] == relation } - - # Consider empty response as failed export - raise StandardError, 'Empty relation export status' unless relation_export_status&.present? - - relation_export_status + fetch_export_status&.find { |item| item['relation'] == relation } end rescue StandardError => e { 'status' => Export::FAILED, 'error' => e.message } diff --git a/app/models/bulk_imports/file_transfer/project_config.rb b/app/models/bulk_imports/file_transfer/project_config.rb index 38884df9fcf..8d4c68f7b5a 100644 --- a/app/models/bulk_imports/file_transfer/project_config.rb +++ b/app/models/bulk_imports/file_transfer/project_config.rb @@ -9,6 +9,8 @@ module BulkImports ).freeze LFS_OBJECTS_RELATION = 'lfs_objects' + REPOSITORY_BUNDLE_RELATION = 'repository' + DESIGN_BUNDLE_RELATION = 'design' def import_export_yaml ::Gitlab::ImportExport.config_file @@ -19,7 +21,12 @@ module BulkImports end def file_relations - [UPLOADS_RELATION, LFS_OBJECTS_RELATION] + [ + UPLOADS_RELATION, + LFS_OBJECTS_RELATION, + REPOSITORY_BUNDLE_RELATION, + DESIGN_BUNDLE_RELATION + ] end end end diff --git a/app/models/bulk_imports/tracker.rb b/app/models/bulk_imports/tracker.rb index a994cc3f8ce..fa38b7617d2 100644 --- a/app/models/bulk_imports/tracker.rb +++ b/app/models/bulk_imports/tracker.rb @@ -18,6 +18,8 @@ class BulkImports::Tracker < ApplicationRecord validates :stage, presence: true + delegate :file_extraction_pipeline?, to: :pipeline_class + DEFAULT_PAGE_SIZE = 500 scope :next_pipeline_trackers_for, -> (entity_id) { |