pingkscodelabs opened a new pull request, #9039: URL: https://github.com/apache/devlake/pull/9039
This pull request modernizes and clarifies the Jira Search API usage in the plugin, introducing a clear separation between Jira Cloud and non-Cloud (Server/Data Center) deployments. It standardizes endpoint selection, request formatting, and pagination, and adds comprehensive tests and documentation for the migration. The changes improve maintainability, compatibility, and future extensibility of the Jira plugin. **Jira Search API migration and endpoint selection:** * Introduced `getJiraSearchEndpoint` and related helpers in `shared.go` to select the correct search endpoint (`api/3/search/jql` for Cloud with POST body, `api/2/search` for non-Cloud with GET query) based on deployment type, and refactored all collectors to use these helpers. [[1]](diffhunk://#diff-9c17ac288ec03b3416b5138130a441484b1ee22976ee858a029e41bd6ef53ea8R21-R57) [[2]](diffhunk://#diff-63f9c67746a5f69337461dcf96e19c32fd63aacddd7c7bb60c05c7a3c11ed969L85-R87) [[3]](diffhunk://#diff-47ec8ec3295c2df75a29ccda1277b07c5c2468f3c3ecc83967320e152a988dc7L98-R100) [[4]](diffhunk://#diff-a28ec3e7aa74a2fd85fa4125d466f6e3792847d8c98249c9ff0ccfd8fbd8d8b1L205-R215) * Added `buildJiraV3SearchRequestBody` for Cloud search requests, ensuring the correct JSON payload is sent, and updated collectors to use this for POST requests. [[1]](diffhunk://#diff-9c17ac288ec03b3416b5138130a441484b1ee22976ee858a029e41bd6ef53ea8R21-R57) [[2]](diffhunk://#diff-63f9c67746a5f69337461dcf96e19c32fd63aacddd7c7bb60c05c7a3c11ed969L155-R184) [[3]](diffhunk://#diff-47ec8ec3295c2df75a29ccda1277b07c5c2468f3c3ecc83967320e152a988dc7L215-R223) * Ensured correct handling of user lookup and time zone retrieval for non-Cloud deployments, improving compatibility. **Testing and documentation:** * Added comprehensive unit tests for endpoint selection, request body construction, and pagination logic in `search_api_test.go`, and expanded tests for epic collector endpoint selection. [[1]](diffhunk://#diff-196540b20629582dfe1b70baddd0fa850efbde62a60dbe7d7d233f8352ae3ed0R1-R117) [[2]](diffhunk://#diff-a28ec3e7aa74a2fd85fa4125d466f6e3792847d8c98249c9ff0ccfd8fbd8d8b1L181-R206) * Introduced `SEARCH_API_MIGRATION.md` to document the migration, endpoint differences, request/pagination formats, and compatibility considerations. **Authentication and connection improvements:** * Refined connection testing logic to avoid misleading hints for Atlassian API Gateway endpoints when `/rest/` is missing, and added tests for both Bearer token and BasicAuth scenarios. [[1]](diffhunk://#diff-688e17d94abebb55f9ca9bcca2b61dfc13f5cf8812ec86c502f5640aed293b6eL61-R64) [[2]](diffhunk://#diff-7f35cdd4126695e57475f7c6e7b5cc81cba60b8a1c1e483e27d918950ff8e181R1-R144) These changes provide a robust foundation for handling Jira's evolving APIs while maintaining backward compatibility and improving developer clarity. -- 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]
