Save external_identifiers on ImportFailure for file import relations
What does this MR do and why?
Save external_identifiers on ImportFailure for file import relations
The FileImport
model has a field for tracking the external identifier
associated with a failed record import. This field is used for other
importers such as GitHub and BitBucket, but not file-based import.
This MR tracks the IID associated with issues, merge requests, milestones and CI pipelines that fail to import. It also lays the groundwork for tracking identifiers for other relations, should the need arise and we can identify a unique key.
Related issue: #434945 (closed)
Changelog: changed
How to set up and validate locally
- Enable the "GitLab export" import source in
/admin/application_settings
. - Import a new project and select "GitLab export."
- Import the attached project export.
- In the Rails console, confirm that the recorded IIDs match the IID in the imported archive. You can extract the archive and view the NDJSON files in the tree folder.
p = Project.last
p.import_failures.count
# should eq 4
p.import_failures.collect { |f| [f.relation_key, f.external_identifiers] }
# [["milestones", {"iid"=>99}],
# ["issues", {"iid"=>31}],
# ["merge_requests", {"iid"=>1}],
# ["ci_pipelines", {"iid"=>1234}]]
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.
Edited by James Nutt