Skip to content

feat(jira): support Jira Cloud via Atlassian API Gateway - #9024

Merged
klesh merged 1 commit into
apache:mainfrom
pingkscodelabs:feature/jira-cloud-gateway-support
Jul 30, 2026
Merged

feat(jira): support Jira Cloud via Atlassian API Gateway#9024
klesh merged 1 commit into
apache:mainfrom
pingkscodelabs:feature/jira-cloud-gateway-support

Conversation

@pingkscodelabs

Copy link
Copy Markdown

Summary

Adds support for connecting to Jira Cloud through the Atlassian API Gateway endpoint (https://api.atlassian.com/ex/jira/{cloudId}/).

Some organisations access Jira Cloud through this gateway URL rather than the standard https://.atlassian.net/ endpoint, using service accounts with scoped API tokens. The existing connector assumes the standard endpoint and produces unhelpful error messages when the gateway URL is used.

Changes

Backend - backend/plugins/jira/api/connection_api.go

  • Added a guard in testConnection() so the '/rest/ missing' hint is NOT shown for api.atlassian.com endpoints. A 404 against the gateway indicates a wrong Cloud ID, not a missing path segment.

Frontend - config-ui/src/plugins/register/jira/connection-fields/auth.tsx

  • Added a third connection mode: Jira Cloud (Atlassian API Gateway)
  • Users enter only their Cloud ID; the full endpoint URL is auto-constructed as https://api.atlassian.com/ex/jira/{cloudId}/rest/
  • Auth method is automatically set to AccessToken (scoped API token)
  • On edit, a saved gateway connection loads back into the correct mode with Cloud ID pre-filled
  • Existing Jira Cloud (*.atlassian.net) and Jira Server / Data Center modes are completely unchanged

Tests

  • backend/plugins/jira/api/connection_api_test.go (new): 3 httptest-based tests verifying Bearer token is sent for gateway mode and Basic auth remains for standard cloud
  • config-ui/src/plugins/register/jira/connection-fields/auth.test.ts (new): 15 unit tests for regex patterns and Cloud ID to endpoint builder

Backward Compatibility

No database migration required. No new columns. The endpoint and token fields in _tool_jira_connections store the gateway URL and scoped token respectively - both already exist and are encrypted at rest. All collectors, extractors, converters, domain models, incremental sync, and Grafana dashboards are unchanged.

How to Test

Mock test (no credentials needed):
cd backend && go test -timeout 60s -v ./plugins/jira/api/...

UI test:

  1. Start DevLake locally
  2. Create a new Jira connection
  3. Select Jira Cloud (Atlassian API Gateway)
  4. Enter a Cloud ID - endpoint auto-populates as https://api.atlassian.com/ex/jira/{cloudId}/rest/
  5. Enter a scoped API token and click Test Connection

Find your Cloud ID at admin.atlassian.com - Settings - Organisation.

- Add JIRA_GATEWAY_REGEX and a third connection mode 'Jira Cloud (Atlassian
  API Gateway)' in the connection UI
- Auto-build endpoint from Cloud ID input: the user types only the Cloud ID
  and the full gateway URL is constructed automatically
- Force authMethod=AccessToken for gateway connections; existing BasicAuth
  path for standard cloud and server connections is unchanged
- Detect gateway endpoints on edit/load and pre-fill the Cloud ID field
- Suppress misleading /rest/ hint in testConnection() for api.atlassian.com
  endpoints (a 404 there means a bad Cloud ID, not a missing /rest/ path)
- Add unit tests for gateway and standard-cloud connection flows
- Add frontend test suite for regex patterns and Cloud ID builder

No migration script required. No new DB columns.
All collectors, extractors, converters and domain models unchanged.

@klesh klesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thanks for your contribution.

@klesh
klesh merged commit 14a4e5b into apache:main Jul 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants