-
Notifications
You must be signed in to change notification settings - Fork 127
Jira Issue Handler
Ondřej Gajdušek edited this page Jul 23, 2025
·
1 revision
The Jira issue handler (jira.py
) is currently the only implemented handler and provides comprehensive functionality for managing Jira issues.
Checks if a specific Jira issue is open by consulting cached data or calling the Jira REST API.
Logic:
- Issues with status in
JIRA_OPEN_STATUSES
are considered open - Issues with status in
JIRA_CLOSED_STATUSES
and resolution inJIRA_WONTFIX_RESOLUTIONS
are considered open (not fixed yet) - Issues not in closed statuses and not in "Testing" status are considered open
Tests are deselected if the issue status is in JIRA_CLOSED_STATUSES
and resolution is in JIRA_WONTFIX_RESOLUTIONS
Checks if all Jira issues in a list are open.
Checks if any Jira issue in a list is open.
Adds comments to Jira issues and optionally updates labels.
- Uses Bearer token authentication with
settings.jira.api_key
- Supports rate limiting with automatic retries
The collected data follows this structure:
{
"SAT-12345": {
"data": {
"key": "SAT-12345",
"summary": "Issue summary",
"status": "In Progress",
"resolution": "",
"labels": ["bug", "high-priority"],
"fixVersions": ["6.14.0"],
"is_open": true,
"is_deselected": false,
"dupe_data": null
},
"used_in": [
{
"filepath": "tests/foreman/ui/test_sync.py",
"lineno": 124,
"testcase": "test_positive_sync_custom_ostree_repo",
"component": "Repositories"
}
]
}
}
The handler uses predefined constants for status checking:
- Open Statuses: "New", "Backlog", "Refinement", "To Do", "In Progress", "Review", "Release Pending - Upstream"
- Closed Statuses: "Release Pending", "Closed"
- Testing Status: "Testing"
- Won't Fix Resolutions: "Obsolete"
-
BlockedBy
: If the issue is open, the test will be skipped/deselected. Override behavior with--blocked-by false
. -
Verifies
: Used with--verifies-issues
pytest option.
-
--verifies-issues
: Comma-separated list of Jira issues to collect tests matching theVerifies
testimony marker. If no issue is provided, all tests with theVerifies
testimony marker will be selected. -
--blocked-by
: Comma-separated list of Jira issues to collect tests matching theBlockedBy
testimony marker. If no issue is provided, all tests with theBlockedBy
testimony marker will be processed and deselected if any issue is open.
- Add a
Verifies
orBlockedBy
doc field to the test, mapping it to a Jira RFE/Bug. 2. For example,:Verifies: SAT-25230
or:BlockedBy: SAT-24796
. ForBlockedBy
, the test will be collected only if the corresponding Jira issue is in the Review (ON_QA) state. This behavior can be overridden by using the--blocked-by SAT-25230
option. - Set
ENABLE_COMMENT
to true in jira.yaml configuration file. - Use the --jira-comments pytest option.
Note:
- To prevent accidental usage of this functionality, the user is required to perform both steps 2 and 3.
- By default, the comment will be added on issues in "Review" and "Release Pending" state, but this could be overridden by setting issue_status in jira.yaml.
The Jira handler requires configuration in settings.jira
:
-
url
: Jira instance URL -
api_key
: API key for authentication -
cache_file
: Path to cache file -
cache_ttl_days
: Cache TTL in days -
comment_type
: Type of comments to add -
comment_visibility
: Comment visibility setting -
enable_comment
: Whether to enable comment functionality