Bitbucket Server: Safe fail when import data is missing
What does this MR do and why?
Fixes #425735 (closed) whereby if import_data
is missing from a project (due to it being cancelled or failed), there can be ImportPullRequestNotesWorker
s that are already enqueued and therefore fail with NoMethodError undefined method 'credentials' for nil:NilClass
.
The failure happens when trying to run BitbucketServer::Client.new(project.import_data.credentials)
.
The fix is to move bits out of initialize
into separate methods and only call execute
if the project has import_data
.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #425735 (closed)
Edited by Madelein van Niekerk