Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import issues from Bugzilla #7802

Open
2 of 7 tasks
argv-minus-one opened this issue Aug 8, 2019 · 9 comments
Open
2 of 7 tasks

Import issues from Bugzilla #7802

argv-minus-one opened this issue Aug 8, 2019 · 9 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@argv-minus-one
Copy link

  • Gitea version: 1.9.0
  • Git version: 2.20.1
  • Operating system: Debian Linux amd64
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

Please add support for importing issues from Bugzilla.

Note that Bugzilla is often used to track issues for many different projects in one place, whereas Gitea/GitHub-style issue tracking has a separate issue tracker for each project. A Gitea importer would need to be able to select which Bugzilla “product” to import issues for.

@argv-minus-one
Copy link
Author

It would also be preferable if Gitea could import from Bugzilla XML output, without contacting a Bugzilla instance directly. That way, Gitea won't need to deal with authenticating itself to Bugzilla, which may require a client certificate, Kerberos/Active Directory ticket, or the like.

@lunny lunny added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Aug 9, 2019
@mrsdizzie
Copy link
Member

I think this would be pretty low priority if being honest, as most migrations are centered around github at the moment (and in the future probably similar services with similar APIs).

If you are looking to do this yourself, you could probably try and script it from the BugZilla XML export. This is an older script that took data from BugZilla and put it into Github.

https://github.com/erikmd/github-issues-import-api-tools/blob/master/attic/bugzilla2github

And perhaps some more information here:

https://www.theozimmermann.net/2017/10/bugzilla-to-github/

As a starting point for how somebody else did something similar

@argv-minus-one
Copy link
Author

argv-minus-one commented Aug 9, 2019

@mrsdizzie I can indeed do that, except that there's currently no way in the API to preserve the issue numbers, and @lunny thinks it would be a bad idea to add a way, because issue migration should be built into Gitea instead. That's why I opened this issue.

As you say, Gitea's migration code seems designed for migrating Git repositories and associated data from GitHub-like sites. It would need a pretty major redesign to handle migrating anything else, such as issues from a separate issue tracker like Bugzilla. That's why I posted #7790: it would be a much simpler change, and allow people like me to write external issue-migration tools without having to make such drastic changes to Gitea itself.

With you apparently disagreeing with @lunny, I'm now at a loss as to what to do. Should I insert issues through Gitea's API and then change the issue numbers (with UPDATE issue SET `index` = ? WHERE `id` = ?) in the database directly? That seems to work, but will it break anything?

@mrsdizzie
Copy link
Member

I don't disagree with Lunny or have any particular opinion other than I wouldn't expect somebody else to add this migration code to Gitea anytime soon if you were hoping the issue would result in that.

Given that I was just pointing to a script of somebody who did something similar with Github which has the same limitations on not allowing setting an issue number via API.

@guillep2k
Copy link
Member

Have you checked the "external issue tracker" option? I don't know what it does, but sounds interesting:

image

(Available at Repository Settings)

@argv-minus-one
Copy link
Author

@mrsdizzie Ok, fair enough. Would you happen to know if changing the issue numbers in the database after they're created (with the API) will break anything?

@guillep2k Yes, I saw that. That is an option, but I was hoping to migrate the issues into Gitea, because Bugzilla is rather slow and much less user-friendly than Gitea.

@guillep2k
Copy link
Member

@mrsdizzie Ok, fair enough. Would you happen to know if changing the issue numbers in the database after they're created (with the API) will break anything?

@argv-minus-one You need to update all the other related tables (attachment, issue_assignees, issue_watch, issue_dependency, issue_user, reaction, stopwatch, tracked_time, pull, review) to reflect the changes. But you'll probably have no rows in many of them if you've just created the issues. Disclaimer: I've just made a crude search through the source code to get the list; it may not be complete.

@jpicht
Copy link
Contributor

jpicht commented Aug 11, 2019

@argv-minus-one Two things:

  • Do you have an example of a Bugzilla XML file?
  • Would it be useful solution for you to only be able to import the XML while also importing the repository via migrations?

@argv-minus-one
Copy link
Author

argv-minus-one commented Aug 13, 2019

@jpicht

  • Do you have an example of a Bugzilla XML file?

Here's one from Mozilla's Bugzilla instance.

Here's the XML DTD from Mozilla's Bugzilla instance. Note that the DTD varies from instance to instance, because it reflects whatever custom fields are configured in the Bugzilla instance. Here's a Gist containing the DTD from my Bugzilla instance, which doesn't have any custom fields configured.

  • Would it be useful solution for you to only be able to import the XML while also importing the repository via migrations?

Yes.

I'd prefer to be able to upload the XML from my browser, instead of Gitea pulling it directly from a running Bugzilla instance, for two reasons:

  1. I need to edit the comments in Bugzilla. Besides Bugzilla, I am also preparing to migrate from Mercurial to Git, and some of the comments in Bugzilla talk about Mercurial commit identifiers. These need to be rewritten to the corresponding Git commit identifiers, and the simplest way to do that is by editing the XML before handing it off to Gitea.

  2. In my Bugzilla instance, user names are email addresses, and that's what appears in the XML. I need to rewrite them to Gitea user names. Again, the simplest way to do that is by editing the XML.

In the longer term, it would be ideal if Gitea could migrate issues (and perhaps other kinds of data) into existing repositories as well. However, I understand that Gitea's current design doesn't allow for this.

@6543 6543 mentioned this issue Sep 3, 2020
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

5 participants