Skip to content

Quote project key in Jira JQL queries

Markus Koller requested to merge jira-escape-project-key into master

What does this MR do and why?

These queries fail when the project key is set to a reserved word like INT, so we have to put it in quotation marks.

Prompted by this Slack conversation (internal):

I’m helping a customer that’s receiving a Projects::Integrations::Jira::IssuesFinder::RequestError exception when attempting to fetch JIRA issues from GitLab. Connection is okay and other projects can fetch issues without problem. The exception above points to an incorrect Project Key in use. The Project Key however matches what’s on the JIRA side. After some testing I believe I was able to recreate this and apparently we error out when the Project Key is set to INT (this is the key the customer is using). So even if the key is correct, if it’s set to INT it fails, can somebody check and confirm this or see if I’m just seeing things?

Confirmed with a request like https://qa-toupeira.atlassian.net/rest/api/2/search?jql=project+%3D+INT:

image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Set up a Jira project with the key INT (renaming an existing one seems to work too)
  2. Set up a GitLab project with the Jira integration, check Enable Jira issues (needs EE), and set the project key to INT
  3. Go to Issues → Jira issues
  4. Verify that no error message appears

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Markus Koller

Merge request reports