Importing issues from Jira results in JIRA::HTTPError (410 - Gone) errors
Summary
See this thread for additional context. As also noted in this MR, the deprecation of the Atlassian /rest/api/2/search endpoint has resulted in several breaking changes. One outstanding item at this point in time is the inability to import issues from Jira to GitLab. Attempting to do so results in:
- The Issue import screen shows
Import in progressuntil a timeout is reached. - No issues are imported
- The issues list view shows
Import in progress. Refresh page to see newly added issues. - Attempting to re-import shows:
You have imported from this project X times before. Each new import will create duplicate issues.
On GitLab.com and Dedicated, the support team have visibility to seeing the failing error codes. This is presented such as in this example query, or using a search term like: json.class: "Gitlab::JiraImport" and json.exception.message: Gone
For Self-Managed customers, this will occur in the Sidekiq log, with entries such as:
"exception": {
"backtrace": [
"lib/gitlab/jira/http_client.rb:15:in `request'",
"jira-ruby (2.3.0) lib/jira/client.rb:306:in `request'",
"jira-ruby (2.3.0) lib/jira/client.rb:279:in `get'",
"jira-ruby (2.3.0) lib/jira/resource/issue.rb:80:in `jql'",
"jira-ruby (2.3.0) lib/jira/base_factory.rb:31:in `block (2 levels) in delegate_to_target_class'",
"lib/gitlab/jira_import/issues_importer.rb:95:in `fetch_issues'",
"lib/gitlab/jira_import/issues_importer.rb:31:in `import_issues'",
"lib/gitlab/jira_import/issues_importer.rb:23:in `execute'",
"app/workers/gitlab/jira_import/stage/import_issues_worker.rb:15:in `import'",
"app/workers/concerns/gitlab/jira_import/import_worker.rb:21:in `perform'",
<omitted for brevity>
],
"class": "JIRA::HTTPError",
"message": "Gone"
},
Steps to reproduce
- In a project, configure the Jira integration and confirm via a test that your credentials work.
- Navigate to the issue list for the project. In the dropdown (⋮), select
Import from Jira. - Select the project for scope and leave mapping to your user, for test purposes.
- You will be notified that there is a:
Import in progress - No import will complete as the API call will fail.
Example Project
https://gitlab.com/benjaminking_ultimate_group/672297 Has been created to test this. I can provide access as required.
What is the current bug behavior?
This comment summarises the problem:
According to lib/gitlab/jira_import/issues_importer.rb#L94-96, we are using the
jira-rubygem to fetch the issues here.The
jira-rubygem version we use (2.3.0) predates the changes Atlassian made to the Jira API, see https://github.com/sumoheavy/jira-ruby/issues/469 for a suggested fix by refencing the PR, or we would have to update the gem to3.0.0.
Note this last line indicates that, because we need to service both Jira Cloud and Jira Server, there may not be a 'single' solution to this fix.
What is the expected correct behavior?
We need to ensure proper issue import support from Jira for Jira Cloud and Jira Server customers.
Output of checks
This bug happens on GitLab.com
Possible fixes
We need to implement a solution that considers if Jira Cloud is in use, and use an appropriate endpoint in both situations.