summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-04-24 20:28:06 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-04-24 20:28:06 -0300
commit5c72ba0ff1be82f31c292765e8d6a76277327979 (patch)
tree6b0cd0fd84b37af152f4bd8383536bcefb0f842c
parent1f498b73dabfd1bb1f2beb9cc6639db4e433ad28 (diff)
downloadgitlab-ce-5c72ba0ff1be82f31c292765e8d6a76277327979.tar.gz
Finish the import process if some error occurs when fetching the repo
-rw-r--r--lib/github/error.rb6
-rw-r--r--lib/github/import.rb11
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/github/error.rb b/lib/github/error.rb
new file mode 100644
index 00000000000..41cd4c67847
--- /dev/null
+++ b/lib/github/error.rb
@@ -0,0 +1,6 @@
+module Github
+ class Error < StandardError
+ end
+
+ class RepositoryFetchError < Error; end
+end
diff --git a/lib/github/import.rb b/lib/github/import.rb
index 8ffbb21bac0..56b0b7a3d4f 100644
--- a/lib/github/import.rb
+++ b/lib/github/import.rb
@@ -1,3 +1,4 @@
+require_relative 'error'
module Github
class Import
include Gitlab::ShellAdapter
@@ -48,9 +49,12 @@ module Github
fetch_issues
fetch_wiki_repository
expire_repository_cache
- track_errors
- errors
+ true
+ rescue Github::RepositoryFetchError
+ false
+ ensure
+ keep_track_of_errors
end
private
@@ -63,6 +67,7 @@ module Github
project.repository.fetch_remote('github', forced: true)
rescue Gitlab::Shell::Error => e
error(:project, "https://github.com/#{repo}.git", e.message)
+ raise Github::RepositoryFetchError
end
end
@@ -368,7 +373,7 @@ module Github
repository.expire_content_cache
end
- def track_errors
+ def keep_track_of_errors
return unless errors.any?
project.update_column(:import_error, {