Commit 4599d643 authored by Douwe Maan's avatar Douwe Maan

Exit with non-zero status when import-repository fails

parent 79fdf65c
...@@ -154,19 +154,23 @@ class GitlabProjects ...@@ -154,19 +154,23 @@ class GitlabProjects
Timeout.timeout(timeout) do Timeout.timeout(timeout) do
Process.wait(pid) Process.wait(pid)
end end
return false unless $?.exitstatus.zero?
rescue Timeout::Error rescue Timeout::Error
$logger.error "Importing project #{@project_name} from <#{masked_source}> failed due to timeout." $logger.error "Importing project #{@project_name} from <#{masked_source}> failed due to timeout."
Process.kill('KILL', pid) Process.kill('KILL', pid)
Process.wait Process.wait
FileUtils.rm_rf(full_path) FileUtils.rm_rf(full_path)
false return false
else
self.class.create_hooks(full_path)
# The project was imported successfully.
# Remove the origin URL since it may contain password.
remove_origin_in_repo
end end
self.class.create_hooks(full_path)
# The project was imported successfully.
# Remove the origin URL since it may contain password.
remove_origin_in_repo
true
end end
# Move repository from one directory to another # Move repository from one directory to another
......
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