Skip to content

Bitbucket Server: Safe fail when import data is missing

Madelein van Niekerk requested to merge 425735-safe-fail-notes-importer into master

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 ImportPullRequestNotesWorkers 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.

Related to #425735 (closed)

Edited by Madelein van Niekerk

Merge request reports