diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-11 03:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-11 03:09:45 +0300 |
commit | 4f1e40017d9eadb0abeeb89d9690a8e5f0694fd9 (patch) | |
tree | c02455f9e9ff3092c2b4a3b00b2069d72f5d9507 /app/services | |
parent | 20a18d1f9bf452c1dd2ef996bee50e34cfcb80f4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/groups/import_export/export_service.rb | 20 | ||||
-rw-r--r-- | app/services/projects/import_export/export_service.rb | 24 |
2 files changed, 33 insertions, 11 deletions
diff --git a/app/services/groups/import_export/export_service.rb b/app/services/groups/import_export/export_service.rb index 2bfd5a5ebab..bd54b48c5f4 100644 --- a/app/services/groups/import_export/export_service.rb +++ b/app/services/groups/import_export/export_service.rb @@ -49,13 +49,23 @@ module Groups # We cannot include the file_saver with the other savers because # it removes the tmp dir. This means that if we want to add new savers # in EE the data won't be available. - if savers.all?(&:save) && file_saver.save + if save_exporters && file_saver.save notify_success else notify_error! end end + def save_exporters + log_info('Group export started') + + savers.all? do |exporter| + log_info("#{exporter.class.name} saver started") + + exporter.save + end + end + def savers [version_saver, tree_exporter] end @@ -99,12 +109,16 @@ module Groups raise Gitlab::ImportExport::Error, shared.errors.to_sentence end - def notify_success + def log_info(message) @logger.info( - message: 'Group Export succeeded', + message: message, group_id: group.id, group_name: group.name ) + end + + def notify_success + log_info('Group Export succeeded') notification_service.group_was_exported(group, current_user) end diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb index d8d35422590..fb791115c5b 100644 --- a/app/services/projects/import_export/export_service.rb +++ b/app/services/projects/import_export/export_service.rb @@ -54,15 +54,21 @@ module Projects end def save_all! + log_info('Project export started') + if save_exporters && save_export_archive - notify_success + log_info('Project successfully exported') else notify_error! end end def save_exporters - exporters.all?(&:save) + exporters.all? do |exporter| + log_info("#{exporter.class.name} saver started") + + exporter.save + end end def save_export_archive @@ -127,11 +133,10 @@ module Projects raise Gitlab::ImportExport::Error, shared.errors.to_sentence end - def notify_success + def log_info(message) logger.info( - message: 'Project successfully exported', - project_name: project.name, - project_id: project.id + message: message, + **log_base_data ) end @@ -139,8 +144,7 @@ module Projects logger.error( message: 'Project export error', export_errors: shared.errors.join(', '), - project_name: project.name, - project_id: project.id + **log_base_data ) user = current_user @@ -150,6 +154,10 @@ module Projects NotificationService.new.project_not_exported(project, user, errors) end end + + def log_base_data + @log_base_data ||= Gitlab::ImportExport::LogUtil.exportable_to_log_payload(project) + end end end end |