Skip to content

Conversation

@panyamkeerthana
Copy link
Collaborator

@panyamkeerthana panyamkeerthana commented Nov 14, 2025

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).

  • added is_jira_cloud() helper to detect Cloud vs Server instances
  • authentication based on instance type: Basic Auth (email:token) for Cloud, Bearer token for Server
  • explicitly use v3 only for Cloud search endpoints (/search/jql)
  • added api_version parameter for version control
  • fixed pagination: cloud v3 uses nextPageToken, server v2 uses startAt
  • removed adftotxt dependency by using v2 CRUD endpoints that support plain text
  • removed ADF conversion logic (_text_to_adf, _adf_to_text) and JiraComment.adf field
  • added UAT test script to validate authentication,CRUD operations, comments, attachments, labels, status changes, and JQL search

resolves https://github.com/packit/jotnar/issues/262

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
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

@panyamkeerthana panyamkeerthana force-pushed the panyamkeerthana/jira_api_migration branch 2 times, most recently from aa62798 to b851392 Compare November 14, 2025 20:54
@panyamkeerthana panyamkeerthana self-assigned this Nov 14, 2025
@panyamkeerthana panyamkeerthana removed their assignment Nov 17, 2025
Copy link
Collaborator

@owtaylor owtaylor left a 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")
Copy link
Collaborator

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)

Copy link
Collaborator Author

@panyamkeerthana panyamkeerthana Nov 17, 2025

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).

@panyamkeerthana panyamkeerthana force-pushed the panyamkeerthana/jira_api_migration branch from b851392 to 5fbeb20 Compare November 17, 2025 21:28
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)
@panyamkeerthana panyamkeerthana force-pushed the panyamkeerthana/jira_api_migration branch from 5fbeb20 to db239f0 Compare November 17, 2025 21:31
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