Skip to content

INTEROP-8954: Prepare firewatch for Jira Cloud migration#266

Merged
amp-rh merged 7 commits intoRedHatQE:mainfrom
amp-rh:jira-migration-prep
Mar 17, 2026
Merged

INTEROP-8954: Prepare firewatch for Jira Cloud migration#266
amp-rh merged 7 commits intoRedHatQE:mainfrom
amp-rh:jira-migration-prep

Conversation

@amp-rh
Copy link
Collaborator

@amp-rh amp-rh commented Dec 3, 2025

Summary

Prepare firewatch for Jira Cloud migration (INTEROP-8954, INTEROP-8496):

  • Switch user identification from username to accountId ([~accountId:...] mention format)
  • Switch auth from Bearer token (token_auth) to Basic auth (basic_auth) — Bearer with API tokens returns 403 on Cloud
  • Set REST API version to 3 (required for Cloud)
  • Handle optional email (may be None due to Cloud privacy settings)
  • Remove quotes from JQL issue key lookups (Cloud requires unquoted keys for standard fields)
  • Add --email option to jira-config-gen CLI

Changes by file

File Change
src/objects/jira_base.py Basic auth with email+token, API v3, unquoted JQL keys, backwards-compatible fallback to token_auth when email not configured
src/escalation/jira_escalation.py accountId-based mentions and user comparison
src/jira_config_gen/jira_config_gen.py Accept optional email parameter
src/commands/jira_config_gen.py Add --email CLI option
src/templates/jira.config.j2 Include email field when provided
tests/e2e/conftest.py Add JIRA_EMAIL env var fixture, update API endpoint to v3
tests/e2e/templates/jira_configs/jira.config.j2 Include email field
tests/unittests/conftest.py Mock config uses email+token (Basic auth), search mock handles /search/jql
tests/unittests/.../fake_server_info.json Report deploymentType: Cloud
tests/unittests/.../test_jira_escalation.py 7 tests for helper methods, accountId mention format

Pagination note

No code changes needed — python-jira 3.10.5 already detects deploymentType: Cloud and routes search_issues() to enhanced_search_issues(), which uses the /search/jql endpoint with nextPageToken pagination automatically.

UAT follow-up

  • assign_issue email lookup works in Cloud (src/objects/jira_base.py)
  • get_field("assignee") string output displays correctly in issue tables
  • Verify JIRA_EMAIL env var is set in CI secrets alongside JIRA_TOKEN

Switch from username-based to accountId-based user identification
to support Jira Cloud migration:

- Use accountId for @mention syntax ([~accountId:...] format)
- Compare comment authors by accountId instead of email
- Add _get_user_account_id helper for safe accountId extraction
- Add _get_user_email helper with None handling for Cloud privacy
- Handle optional assignee_email (may be None in Cloud)

Includes 7 unit tests for the new helper methods.
@amp-rh
Copy link
Collaborator Author

amp-rh commented Mar 2, 2026

Gentle ping — this PR has been open since December 3 and is ready for review. It prepares Jira escalation for the Cloud migration by switching from username-based to accountId-based user identification (required for Jira Cloud). Could a maintainer take a look when available?

- Switch auth from token_auth (Bearer) to basic_auth (email + API token)
  to avoid 403 errors on Jira Cloud. Falls back to token_auth when email
  is not configured, preserving backward compatibility.
- Set REST API version to 3 (required for Cloud).
- Remove quotes from JQL issue key lookups (Cloud requires unquoted keys
  for standard fields).
- Add --email option to jira-config-gen CLI and config templates.
- Update test fixtures: fake server info reports Cloud deployment type,
  mock HTTP handler matches /search/jql endpoint, e2e fixture uses
  /rest/api/3/issue.

Made-with: Cursor
@amp-rh amp-rh changed the title Prepare Jira escalation for Cloud migration INTEROP-8954: Prepare firewatch for Jira Cloud migration Mar 17, 2026
amp-rh and others added 4 commits March 17, 2026 09:25
Replace all issues.stage.redhat.com references with
redhat.stage.atlassian.net across CLI help, docstrings,
docs, and test fixtures.

Made-with: Cursor
Co-authored-by: sg-rh <sgill@redhat.com>
Co-authored-by: sg-rh <sgill@redhat.com>
The accepted suggestions had malformed code (truncated triple-quote
with code on the same line). Also reverts the explicit
enhanced_search_issues call since python-jira 3.10.5 already
auto-routes search_issues() to enhanced_search_issues() on Cloud.

Made-with: Cursor
Cover auth branching (basic_auth vs token_auth), API v3,
unquoted JQL epic search, and JiraConfig email rendering.

Made-with: Cursor
@amp-rh amp-rh force-pushed the jira-migration-prep branch from a1f64ed to cd09f4d Compare March 17, 2026 15:51
@amp-rh amp-rh requested a review from etirta March 17, 2026 15:55
@amp-rh amp-rh enabled auto-merge (squash) March 17, 2026 16:42
Copy link

@etirta etirta left a comment

Choose a reason for hiding this comment

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

Approve.

@amp-rh amp-rh merged commit 62c4c19 into RedHatQE:main Mar 17, 2026
4 checks passed
@amp-rh amp-rh deleted the jira-migration-prep branch March 17, 2026 20:47
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.

3 participants