pingkscodelabs opened a new pull request, #9024:
URL: https://github.com/apache/devlake/pull/9024

   ## 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://<site>.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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to