Fetching Jira issue types via `-/services/jira/test` returns 500 error when using a self-hosted Jira instance
Summary
Fetching a Jira project's issue types via the -/services/jira/test
endpoint from a self-hosted Jira instance results in a 500
error:
JIRA::HTTPError at /h5bp/html5-boilerplate/-/services/jira/test
===============================================================
> {"errorMessages":["not a valid scheme id: project"],"errors":{}}
lib/gitlab/jira/http_client.rb, line 15
---------------------------------------
''' ruby
10
11 override :request
12 def request(*args)
13 result = make_request(*args)
14
> 15 raise JIRA::HTTPError.new(result.response) unless result.response.is_a?(Net::HTTPSuccess)
16
17 result
18 end
19
20 override :make_cookie_auth_request
'''
Steps to reproduce
- Go to a GitLab Project's Jira Integration settings (settings -> integrations -> Jira)
- Enter the URL of a self-hosted Jira instance into the 'Web URL' input
- Enter credentials and the Jira project key
- Either click 'Test settings' or the 'Fetch issue types' button next to the 'Select issue type' dropdown
Example Project
(Set up to use a self-hosted instance with the error showing up)
What is the current bug behavior?
Fetching Jira issue types causes a 500 error.
What is the expected correct behavior?
The endpoint returns the list of Jira issue types.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
Implementation plan
-
backend It seems like for self hosted instance for some reason it is considering “project” as an scheme id. But it was supposed to be considered as api endpoint. While exploring, saw a similar problem mention here: https://community.atlassian.com/t5/Jira-questions/I-am-using-python-jira-api-GET-rest-api-3-issuetypescheme/qaq-p/1507276. So first we need to explore Jira api option for extracting issue scheme ids when using a self-hosted Jira instance. -
backend Update these places (https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/models/project_services/ee/jira_service.rb#L92, https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/models/project_services/ee/jira_service.rb#L106) to use proper api which can provide scheme id list in all scenario. (saw a suggestion here https://community.atlassian.com/t5/Jira-questions/I-am-using-python-jira-api-GET-rest-api-3-issuetypescheme/qaq-p/1507276 )