BigW Consortium Gitlab

Commit 64c39055 by James Lopez Committed by Robert Speicher

some refactoring and fixing spec

parent b2b3e0e6
......@@ -1017,4 +1017,9 @@ class Project < ActiveRecord::Base
builds.running_or_pending.count(:all)
end
end
def mark_import_as_failed(error_message)
import_fail
update_column(:import_error, Gitlab::UrlSanitizer.sanitize(error_message))
end
end
......@@ -15,8 +15,7 @@ class RepositoryForkWorker
result = gitlab_shell.fork_repository(source_path, target_path)
unless result
logger.error("Unable to fork project #{project_id} for repository #{source_path} -> #{target_path}")
project.update(import_error: "The project could not be forked.")
project.import_fail
project.mark_import_as_failed('The project could not be forked.')
return
end
......@@ -24,8 +23,7 @@ class RepositoryForkWorker
unless project.valid_repo?
logger.error("Project #{project_id} had an invalid repository after fork")
project.update(import_error: "The forked repository is invalid.")
project.import_fail
project.mark_import_as_failed('The forked repository is invalid.')
return
end
......
......@@ -13,8 +13,7 @@ class RepositoryImportWorker
result = Projects::ImportService.new(project, current_user).execute
if result[:status] == :error
project.update(import_error: Gitlab::UrlSanitizer.sanitize(result[:message]))
project.import_fail
project.mark_import_as_failed(Gitlab::UrlSanitizer.sanitize(result[:message]))
return
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