Commit 27867f35 authored by James Lopez's avatar James Lopez

Merge branches 'feature/project-export' and 'feature/project-import' of...

Merge branches 'feature/project-export' and 'feature/project-import' of gitlab.com:gitlab-org/gitlab-ce into feature/project-import
parents a86da1b7 cffae0d2
...@@ -27,7 +27,7 @@ module Projects ...@@ -27,7 +27,7 @@ module Projects
end end
def notify_worker def notify_worker
raise Gitlab::ImportExport::Error @shared.errors.join(', ') raise Gitlab::ImportExport::Error.new(@shared.errors.join(', '))
end end
end end
end end
......
class ProjectExportWorker class ProjectExportWorker
include Sidekiq::Worker include Sidekiq::Worker
# TODO: enabled retry - disabled for QA purposes # TODO: enable retry - disabled for QA purposes
sidekiq_options queue: :gitlab_shell, retry: false sidekiq_options queue: :gitlab_shell, retry: false
def perform(current_user_id, project_id) def perform(current_user_id, project_id)
current_user = User.find(current_user_id) current_user = User.find(current_user_id)
project = Project.find(project_id) project = Project.find(project_id)
::Projects::ImportExport::ExportService.new(project, current_user).execute ::Projects::ImportExport::ExportService.new(project, current_user).execute
# TODO : Handle errors
end end
end end
...@@ -13,7 +13,7 @@ module Gitlab ...@@ -13,7 +13,7 @@ module Gitlab
def save def save
if compress_and_save if compress_and_save
remove_storage_path remove_export_path
Rails.logger.info("Saved project export #{archive_file}") Rails.logger.info("Saved project export #{archive_file}")
archive_file archive_file
else else
...@@ -27,15 +27,15 @@ module Gitlab ...@@ -27,15 +27,15 @@ module Gitlab
private private
def compress_and_save def compress_and_save
tar_czf(archive: archive_file, dir: @shared.storage_path) tar_czf(archive: archive_file, dir: @shared.export_path)
end end
def remove_storage_path def remove_export_path
FileUtils.rm_rf(@shared.storage_path) FileUtils.rm_rf(@shared.export_path)
end end
def archive_file def archive_file
@archive_file ||= File.join(@shared.storage_path, '..', "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_project_export.tar.gz") @archive_file ||= File.join(@shared.export_path, '..', "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_project_export.tar.gz")
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment