go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
43.04k stars 5.32k forks source link

Import Issues from Jira #18305

Open thigg opened 2 years ago

thigg commented 2 years ago

Feature Description

It should be possible to migrate issues from jira to gitea.

Currently its possible to import issues from Jira into gitlab and migrate it afterwards into gitea. As of now this unfortunatley does neither migrate comments or attachments into gitlab, thus they cannot be migrated to gitea in turn.

Gitlab mitigates this a bit by linking the original jira issue. This is useful in cases where you have the jira instance left on the network for a while at least.

Thus I propose two things:

  1. Migrate links from gitlab issue titles into gitlab as well
  2. add jira issue import directly into gitea

Screenshots

No response

ivptr commented 1 year ago

Anybody found a way to migrate Jira issues (with comments and attachments) to Gitea?

lafriks commented 1 year ago

I think Jira could have so many different customizations that it would be not feasible to implement that into gitea, that should probably be done as external tool to import using gitea api

ivptr commented 1 year ago

No need to import customized things.

How about having empty Gitea instance and then use REPLACE INTO SQL statements to populate "issue" and "comment" Gitea tables based on Jira tables? Would that work?

lafriks commented 1 year ago

For basic issue data that could probably work

ivptr commented 1 year ago

Please find attached SQL queries to directly migrate issues from Jira to Gitea, including comments, attachments and string based custom fields.

Warning: It deletes all issues, comments and attachments from Gitea. Please read all comments carefully.

migrate_from_jira_to_gitea.txt

achikhv commented 1 year ago

Here is simple and very dirty tool which I used to import jira issues into gitea's SQL Server database. Should be easy to port other DB servers though.

juangarcia06 commented 1 year ago

Using @achikhv tool, I modified it to work with MySQL, I will be publishing it as one of my repositories in the near future. There also is some errors in achikhvs tool I fixed.

delvh commented 1 year ago

Once it is published, please add your repo to https://gitea.com/gitea/awesome-gitea#migration.

achikhv commented 1 year ago

Using @achikhv tool, I modified it to work with MySQL, I will be publishing it as one of my repositories in the near future. There also is some errors in achikhvs tool I fixed.

Would love to see PR's with fixes. Could be useful to others.

juangarcia06 commented 1 year ago

Here you have the code, it works fine and documentation is better, hope it helps! https://github.com/juangarcia06/jira2giteaMySql Was quite a lot of work. I didn't get attachments working. If anyone can get them to work and can make a pull request I would appreciate it a lot since this took me about 2 weeks of work.

metal450 commented 4 months ago

Trying out @juangarcia06's importer, but I'm getting 400's (bad request) when it tries to fetch the data from Jira. I'm certain I have the correct login/password in launchSettings.json. However, I am trying to import from a local Jira instance (JiraServer url is http://192.168.5.40:9876). Has anyone else gotten this to work? Any ideas?

Edit: Nevermind, figured it out. For anyone else: the instructions say --JiraFilter searchSomethingInJiraAndGetTheFilterFromTheUrl, but the filter must be numeric. If you have a url like /issues/?filter=allopenissues, you cannot use allopenissues as the jiraFilter. You must re-save it as your own filter, which will then show it as a number, and use that.

metal450 commented 4 months ago

Also for anyone interested: the script can be tweaked to work with sqlite fairly easily:

metal450 commented 4 months ago

Oh and I just realized: this is importing comments, but not comment counts. i.e. although the comments are actually there, all the issues show a count of 0 comments. And even if you add your own comments to those imported issues, the counts remain as 0.

Looks like the issue is it's not properly setting the issue.num_comments column.