swingbit / jira2gitlab

Migrate Jira projects into a Gitlab instance
MIT License
20 stars 11 forks source link

Migration fails when Jira Reporter is "Anonymous" #8

Closed caseybea closed 2 years ago

caseybea commented 2 years ago

I do not know how or even why this happened, but I have discovered some old issues we have in Jira somehow got changed to a REPORTER identifier of "Anonymous". And some of these issues were reported by user(s) that actually do still exist in our Jira environment.

When running the jira2gitlab import script and it hits such an issue (Reporter = "Anonymous"), I get the followwing error:

[INFO] #1006/2307 Migrating Jira issue ITS-1155 ... Traceback (most recent call last): File "./jira2gitlab.py", line 884, in migrate_project(jira_project, gitlab_project) File "./jira2gitlab.py", line 446, in migrate_project reporter = issue['fields']['reporter']['name'] TypeError: 'NoneType' object is not subscriptable

Migration failed

caseybea commented 2 years ago

A little good neews, sort of :-)

The only way I have worked around this for now is simply... DELETING the offending issues (in jira) and then starting over. Thus far I only ran into a small handful of offending (anonymous) issues in a large project (2300 issues); and the "offending" issues were to be honest, ones we really didn't care about and held no historical significance.

But as we move on to migrating the remainder of jira projects, this has a bit of potential to be a problem. I assume internal the "anonyous" reporter in Jira is actually a blank or NULL or some such similar deal. In jira it shows up as "Anonymous" in ITALICS. Not sure what you would do to set the reporter to but guess it could be a customizable field, or just set to the root user or.. ??

swingbit commented 2 years ago

The error suggests that the reporter field is completely missing. The commit above should fix this. The Gitlab issue will be created as reported by the admin user.

caseybea commented 2 years ago

Fantastic! Thank you so veery much.

I'm hoping all this commit activity ends up pushing your code to the top of the search list when someone else is looking to export jira to gitlab. Most certinly the best of the bunch.

caseybea commented 2 years ago

I also agree that the (reporter) field is most very likely empty in these cases. Very odd, one of the issues I found that had this state was reported by a user that still existed in our jira users-list. But no way to search for "Anonymous" or "" reporter to try to bulk-fix it in jira. I assume for one weird reason or another that across the years the handful of issues this happend to broke somehow during one of the million upgrades I did over the years or......