-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add Jira Cloud API support with hybrid v2/v3 approach #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add Jira Cloud API support with hybrid v2/v3 approach #361
Conversation
implemented support for Jira Cloud REST API v3 while maintaining backward compatibility with Jira Server v2. - added Basic Auth (email:token) support for Jira Cloud v3 - added JIRA_EMAIL env var requirement for v3 - added _text_to_adf() and _adf_to_text() helper functions for ADF <-> plain text conversion - stored original ADF in JiraComment.adf for roundtrip preservation - converted descriptions and comments automatically based on API version - added adftotxt library for ADF parsing - fixed pagination: use nextPageToken for v3, startAt for v2 - user lookup: v3 uses 'query' parameter and v2 uses 'username' parameter
added test_jira_cloud_uat.py script that validates all Jira API operations - test cases covering authentication, ADF conversion - tests for CRUD operations, comments, attachments, labels, status changes - validate JQL search and jotnar tag functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces support for Jira Cloud using a hybrid v2/v3 API approach, which is a significant and well-thought-out change. The strategy to use v3 for search on Cloud instances while retaining v2 for CRUD operations to avoid ADF complexity is sound. The implementation is mostly clean and follows this strategy. I have identified a few areas for improvement: a minor bug in the new UAT test script, an inconsistency in how API functions handle versioning, and a more critical issue in get_user_name where the logic for API version selection is incorrect. Addressing these points will enhance the robustness and consistency of the implementation.
aa62798 to
b851392
Compare
owtaylor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think generally this approach looks like a good way to get us across to the JIRA Cloud instance without throwing a ton of complexity into the mix.
The way the code handles the API version switch needs a little clarification, and there are a few other details, but generally it looks promising.
|
|
||
|
|
||
|
|
||
| print("All the tests passed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test script looks good, can we try posting a comment with the following contents:
BASELINE_TEST_COMMENT="""\
Automated testing for libtiff-4.4.0-13.el9_6.2 has failed.
Test results are available at: https://reportportal-rhel.apps.dno.ocp-hub.prod.psi.redhat.com/ui/#baseosqe/launches/all/9ccdf038-ca7b-462d-a236-c9e40a464b2f
Failed test runs:
* [REQ-1.4.1|https://artifacts.osci.redhat.com/testing-farm/65f0eff4-ecad-4c8a-890a-24da164d0499]
* [REQ-2.4.2|https://artifacts.osci.redhat.com/testing-farm/b5686ad4-32db-44f7-8ef0-499d99afb220]
* [REQ-3.4.3|https://artifacts.osci.redhat.com/testing-farm/a95ac61f-daab-4710-a9db-f96148657b08]
* [REQ-4.4.4|https://artifacts.osci.redhat.com/testing-farm/a7fb70cf-0688-4fa2-a00a-6782fe8bb3dd]
Reproduced failed tests with previous build libtiff-4.4.0-13.el9:
||Architecture||Original Request||Request With Old Build||Result||Comparison||
|x86_64|[65f0eff4-ecad-4c8a-890a-24da164d0499|https://api.testing-farm.io/v0.1/requests/65f0eff4-ecad-4c8a-890a-24da164d0499]|[b9d52a86-3b0c-4e78-89ab-c32a1e0cc60a|https://api.testing-farm.io/v0.1/requests/b9d52a86-3b0c-4e78-89ab-c32a1e0cc60a]|failed|[compare|^comparison-b9d52a86-3b0c-4e78-89ab-c32a1e0cc60a--65f0eff4-ecad-4c8a-890a-24da164d0499.toml]|
|ppc64le|[b5686ad4-32db-44f7-8ef0-499d99afb220|https://api.testing-farm.io/v0.1/requests/b5686ad4-32db-44f7-8ef0-499d99afb220]|[08d261c2-3540-4878-9306-cd405f14699d|https://api.testing-farm.io/v0.1/requests/08d261c2-3540-4878-9306-cd405f14699d]|failed|[compare|^comparison-08d261c2-3540-4878-9306-cd405f14699d--b5686ad4-32db-44f7-8ef0-499d99afb220.toml]|
|aarch64|[a95ac61f-daab-4710-a9db-f96148657b08|https://api.testing-farm.io/v0.1/requests/a95ac61f-daab-4710-a9db-f96148657b08]|[2e4b43f9-4654-4f98-9276-42b65afbfb9b|https://api.testing-farm.io/v0.1/requests/2e4b43f9-4654-4f98-9276-42b65afbfb9b]|failed|[compare|^comparison-2e4b43f9-4654-4f98-9276-42b65afbfb9b--a95ac61f-daab-4710-a9db-f96148657b08.toml]|
|s390x|[a7fb70cf-0688-4fa2-a00a-6782fe8bb3dd|https://api.testing-farm.io/v0.1/requests/a7fb70cf-0688-4fa2-a00a-6782fe8bb3dd]|[3425b603-d9f7-439a-827b-6d65acd2e066|https://api.testing-farm.io/v0.1/requests/3425b603-d9f7-439a-827b-6d65acd2e066]|failed|[compare|^comparison-3425b603-d9f7-439a-827b-6d65acd2e066--a7fb70cf-0688-4fa2-a00a-6782fe8bb3dd.toml]|
"""And see if it round-trips exactly (or close enough to exactly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a testcase that adds a comment with JIRA markup and check if it survives write/read cycles without losing its formatting but was unable to complete UAT testing as the UAT environment became unavailable. Will complete testing during the next UAT period (date TBA).
b851392 to
5fbeb20
Compare
simplified the Jira Cloud migration by using v2 API as the default for all operations and using v3 only for search endpoints where required. (avoids ADF conversion and uses v3 because v2 search is deprecated)
5fbeb20 to
db239f0
Compare
Implemented support for Jira Cloud while maintaining backward compatibility with Jira Server v2. Uses a hybrid approach: v2 for CRUD operations (to avoid ADF complexity) and v3 only for search endpoints (where v2 is deprecated on Cloud).
resolves https://github.com/packit/jotnar/issues/262