Update NdjsonPipeline#transform to return if data is nil
What does this MR do and why?
bulk_import_projects
feature flag that is currently off by default (and disabled on .com).
This MR fixes a bug where an exception would be raised in NdjsonPipeline#transform
because of incoming data being nil. It is used in a GitLab Migration feature https://docs.gitlab.com/ee/user/group/import/ that imports groups and projects with one click.
For example, when importing project does not have push rule, then the contents of downloaded push_rule.ndjson
file is nil
, which is being read from file and converted into [nil, 0]
during extraction, which raises exception NoMethodError: undefined method
except for nil
here: http://gitlab.com/gitlab-org/gitlab/blob/6e39022e6514273e2f34a764b6db51af3f844a87/lib/gitlab/import_export/base/relation_factory.rb#L51-L51
This MR makes sure that if no data is exported from source, there is no need to raise an exception, just return early and do nothing.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
-
Feature.enable(:bulk_import)
. -
Feature.enable(:bulk_import_projects)
. - Create a top level group and project in it. Do not specify any push rules.
- Go to
/groups/new#import-group-pane
page and enter instance url and access token (needs to beapi
&read_repository
scope). - Select newly created group and click Import.
- Wait for Group import to complete and verify
bulk_import_failures
table. There should be no error coming fromPushRulePipeline
.
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.