| ... | @@ -11,6 +11,7 @@ module Gitlab |
... | @@ -11,6 +11,7 @@ module Gitlab |
|
|
{ title: 'task', color: '#7F8C8D' }].freeze
|
|
{ title: 'task', color: '#7F8C8D' }].freeze
|
|
|
|
|
|
|
|
attr_reader :project, :client, :errors, :users
|
|
attr_reader :project, :client, :errors, :users
|
|
|
|
attr_accessor :logger
|
|
|
|
|
|
|
|
def initialize(project)
|
|
def initialize(project)
|
|
|
@project = project
|
|
@project = project
|
| ... | @@ -19,6 +20,7 @@ module Gitlab |
... | @@ -19,6 +20,7 @@ module Gitlab |
|
|
@labels = {}
|
|
@labels = {}
|
|
|
@errors = []
|
|
@errors = []
|
|
|
@users = {}
|
|
@users = {}
|
|
|
|
@logger = Gitlab::Import::Logger.build
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
def execute
|
| ... | @@ -41,6 +43,18 @@ module Gitlab |
... | @@ -41,6 +43,18 @@ module Gitlab |
|
|
}.to_json)
|
|
}.to_json)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
def store_pull_request_error(pull_request, ex)
|
|
|
|
backtrace = Gitlab::Profiler.clean_backtrace(ex.backtrace)
|
|
|
|
error = { type: :pull_request, iid: pull_request.iid, errors: ex.message, trace: backtrace, raw_response: pull_request.raw }
|
|
|
|
|
|
|
|
log_error(error)
|
|
|
|
# Omit the details from the database to avoid blowing up usage in the error column
|
|
|
|
error.delete(:trace)
|
|
|
|
error.delete(:raw_response)
|
|
|
|
|
|
|
|
errors << error
|
|
|
|
end
|
|
|
|
|
|
|
def gitlab_user_id(project, username)
|
|
def gitlab_user_id(project, username)
|
|
|
find_user_id(username) || project.creator_id
|
|
find_user_id(username) || project.creator_id
|
|
|
end
|
|
end
|
| ... | @@ -176,7 +190,7 @@ module Gitlab |
... | @@ -176,7 +190,7 @@ module Gitlab |
|
|
|
|
|
|
|
import_pull_request_comments(pull_request, merge_request) if merge_request.persisted?
|
|
import_pull_request_comments(pull_request, merge_request) if merge_request.persisted?
|
|
|
rescue StandardError => e
|
|
rescue StandardError => e
|
|
|
errors << { type: :pull_request, iid: pull_request.iid, errors: e.message, trace: e.backtrace.join("\n"), raw_response: pull_request.raw }
|
|
store_pull_request_error(pull_request, e)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | @@ -254,6 +268,18 @@ module Gitlab |
... | @@ -254,6 +268,18 @@ module Gitlab |
|
|
updated_at: comment.updated_at
|
|
updated_at: comment.updated_at
|
|
|
}
|
|
}
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def log_error(details)
|
|
|
|
logger.error(log_base_data.merge(details))
|
|
|
|
end
|
|
|
|
|
|
|
|
def log_base_data
|
|
|
|
{
|
|
|
|
class: self.class.name,
|
|
|
|
project_id: project.id,
|
|
|
|
project_path: project.full_path
|
|
|
|
}
|
|
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end |
|
end |