Support Jira Cloud and Server issue fetching

What does this MR do and why?

This MR fixes a regression introduced in GitLab 18.5 where the Jira issues integration stopped working for Jira Server and Data Center deployments.

Background

In !206815 (merged) (GitLab 18.5), we migrated to Jira Cloud's new /rest/api/3/search/jql endpoint with token-based pagination. However, this endpoint and pagination method only exist on Jira Cloud, breaking the integration for customers using Jira Server or Data Center.

What this MR does

This MR restores support for both deployment types by:

  • Creating separate service classes for Cloud and Server implementations:
    • CloudListService: Uses API v3 (/rest/api/3/search/jql) with token-based pagination (nextPageToken)
    • ServerListService: Uses API v2 (/rest/api/2/search) with offset-based pagination (startAt, page numbers)
    • Refactoring the base ListService into an abstract class with shared behaviour
  • Updating the controller to handle both pagination approaches seamlessly
  • Updating the frontend resolver to work with both token and page-based pagination
  • Adding comprehensive test coverage for both service implementations, and fixed some flaky tests

To all reviewers: I apologize for the size of this merge request! 😅 In my opinion, it was necessary to capture all of these changes in a single MR but please let me know if you have differing thoughts 🙂

References

Screenshots or screen recordings

Scenario Deployment Before After Differences
Viewing Jira issues in GitLab Jira Cloud image.png image.png No difference - Jira Cloud issues load before and after changes
Jira Server image.png image.png Jira Server issues did not load before and displayed an error. After the changes, Jira Server issues do load
Viewing related Jira issues for GitLab vulnerabilities Jira Cloud image.png image.png No difference - Jira Cloud issues load before and after changes
Jira Server image.png image.png Jira Server issues did not load before and displayed an error. After the changes, Jira Server issues do load

video3790227426

How to set up and validate locally

Repeat these steps twice, once for Jira Cloud and Jira Data Center.

  1. In GDK, select a project and configure the Jira integration
    • If you require Jira credentials, I'm happy to share mine. Please contact me in Slack.
  2. View the Jira issues in the project. Use the navigation/search/filters/sort, click into a Jira issue, confirm it all works.
  3. If you don't have vulnerabilities in the project, use bundle exec rake gitlab:seed:vulnerabilities to seed some.
  4. Try to create a Jira issue for a vulnerability. The newly created issue should appear.
    • For Jira Cloud, the created issue sometimes appears in the related Jira issues component. If it doesn't you need to perform a hard refresh. See here to understand why this happens.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Anton Smith

Merge request reports

Loading