diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-05 18:08:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-05 18:08:39 +0300 |
commit | 5db6a7a014eb5cac640767687819c2784b24187a (patch) | |
tree | 437b944acf93e1fc293ced48ea9f59e9515db075 /app/services/bulk_imports | |
parent | b90cf01a88df981f452a7f6b6d74e8fd0ccbf90b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/bulk_imports')
-rw-r--r-- | app/services/bulk_imports/create_service.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/services/bulk_imports/create_service.rb b/app/services/bulk_imports/create_service.rb index 26d678cfe3c..01ff593be46 100644 --- a/app/services/bulk_imports/create_service.rb +++ b/app/services/bulk_imports/create_service.rb @@ -36,6 +36,8 @@ module BulkImports end def execute + validate! + bulk_import = create_bulk_import Gitlab::Tracking.event(self.class.name, 'create', label: 'bulk_import_group') @@ -43,7 +45,8 @@ module BulkImports BulkImportWorker.perform_async(bulk_import.id) ServiceResponse.success(payload: bulk_import) - rescue ActiveRecord::RecordInvalid, BulkImports::NetworkError => e + + rescue ActiveRecord::RecordInvalid, BulkImports::Error, BulkImports::NetworkError => e ServiceResponse.error( message: e.message, http_status: :unprocessable_entity @@ -52,6 +55,11 @@ module BulkImports private + def validate! + client.validate_instance_version! + client.validate_import_scopes! + end + def create_bulk_import BulkImport.transaction do bulk_import = BulkImport.create!( |