jira_app ¤
Modules:
-
client– -
management–Management commands for jira_app.
-
models– -
service_postmortem–Service for creating and managing Jira post-mortems.
-
signals– -
utils–
client ¤
Classes:
JiraClient ¤
Methods:
-
assign_issue–Assign a Jira issue to a user.
-
create_postmortem_issue–Create a Jira post-mortem issue with custom fields.
-
get_jira_user_from_jira_id–Look for a Jira User in DB, if not found, fetch it from Jira API.
-
get_jira_user_from_user–Fetches a Jira user from the Jira API.
-
get_watchers_from_jira_ticket–Fetch watchers for a specific Jira ticket from Jira API.
-
transition_issue_auto–Attempts to close an issue by applying transitions to it.
Source code in src/firefighter/jira_app/client.py
assign_issue ¤
Assign a Jira issue to a user.
Parameters:
-
issue_key(str) –Jira issue key (e.g., "INCIDENT-123")
-
account_id(str) –Jira account ID of the user
Returns:
-
bool–True if assignment succeeded, False otherwise
Note
This method does not raise exceptions. Assignment failures are logged as warnings since assignment is typically an optional operation.
Source code in src/firefighter/jira_app/client.py
create_postmortem_issue ¤
create_postmortem_issue(project_key: str, issue_type: str, fields: dict[str, Any], parent_issue_key: str | None = None) -> dict[str, Any]
Create a Jira post-mortem issue with custom fields.
Parameters:
-
project_key(str) –Jira project key (e.g., "INCIDENT")
-
issue_type(str) –Issue type name (e.g., "Post-mortem")
-
fields(dict[str, Any]) –Dictionary of field IDs to values
-
parent_issue_key(str | None, default:None) –Optional parent issue key to link this post-mortem to
Returns:
Raises:
-
JiraAPIError–If issue creation fails
Source code in src/firefighter/jira_app/client.py
get_jira_user_from_jira_id ¤
Look for a Jira User in DB, if not found, fetch it from Jira API.
Parameters:
-
jira_account_id(str) –Jira account id
Raises:
-
JiraUserNotFoundError–User not found in Jira nor in DB
-
JiraUserDatabaseError–Unable to create user in DB
-
ValueError–Empty jira_account_id
Returns:
-
JiraUser(JiraUser) –Jira user object
Source code in src/firefighter/jira_app/client.py
get_jira_user_from_user ¤
Fetches a Jira user from the Jira API.
Parameters:
-
user(User) –User object
Raises:
-
JiraUserNotFoundError–User not found in Jira
Returns:
-
JiraAPIUser(JiraUser) –Jira API user object
Source code in src/firefighter/jira_app/client.py
get_watchers_from_jira_ticket ¤
Fetch watchers for a specific Jira ticket from Jira API.
Parameters:
Raises:
-
ValueError–Empty issue id
Returns:
-
list(User) –List of Jira users object, or empty list if ticket doesn't exist
Source code in src/firefighter/jira_app/client.py
transition_issue_auto ¤
Attempts to close an issue by applying transitions to it.
Parameters:
-
issue_id(str | int) –Jira issue id
-
target_status_name(str) –target status name
-
workflow_name(str) –workflow name
Source code in src/firefighter/jira_app/client.py
management ¤
models ¤
Classes:
-
JiraIssue–Jira issue model.
-
JiraPostMortem–Jira Post-mortem linked to an Incident.
-
JiraUser–Jira user model. It maps an User with the Jira account id.
JiraPostMortem ¤
service_postmortem ¤
Service for creating and managing Jira post-mortems.
Classes:
-
JiraPostMortemService–Service for creating and managing Jira post-mortems.
JiraPostMortemService ¤
Service for creating and managing Jira post-mortems.
Methods:
-
create_postmortem_for_incident–Create a Jira post-mortem for an incident.
Source code in src/firefighter/jira_app/service_postmortem.py
create_postmortem_for_incident ¤
create_postmortem_for_incident(incident: Incident, created_by: User | None = None) -> JiraPostMortem
Create a Jira post-mortem for an incident.
Parameters:
-
incident(Incident) –Incident to create post-mortem for
-
created_by(User | None, default:None) –User creating the post-mortem
Returns:
-
JiraPostMortem–JiraPostMortem instance
Raises:
-
ValueError–If incident already has a Jira post-mortem
-
JiraAPIError–If Jira API call fails
Source code in src/firefighter/jira_app/service_postmortem.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
signals ¤
Modules:
-
incident_key_events_updated–Signal handlers for incident key events updates to sync with Jira post-mortem.
-
postmortem_created–
Functions:
-
postmortem_created_handler–Handle post-mortem creation when incident reaches MITIGATED status.
-
sync_key_events_to_jira_postmortem–Update Jira post-mortem timeline when key events are updated.
postmortem_created_handler ¤
postmortem_created_handler(
sender: Any, incident: Incident, incident_update: IncidentUpdate, updated_fields: list[str], **kwargs: Never
) -> None
Handle post-mortem creation when incident reaches MITIGATED status.
This handler is registered in jira_app to ensure it works independently of Confluence being enabled. It creates post-mortems for both Confluence and Jira based on their respective feature flags.
Source code in src/firefighter/jira_app/signals/postmortem_created.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
sync_key_events_to_jira_postmortem ¤
sync_key_events_to_jira_postmortem(sender: Any, incident: Incident, **kwargs: dict[str, Any]) -> None
Update Jira post-mortem timeline when key events are updated.
This handler is triggered when incident key events are updated via the web UI or Slack, and syncs the timeline to the associated Jira post-mortem ticket.
Parameters:
-
sender(Any) –The sender of the signal
-
incident(Incident) –The incident whose key events were updated
-
**kwargs(dict[str, Any], default:{}) –Additional keyword arguments
Source code in src/firefighter/jira_app/signals/incident_key_events_updated.py
incident_key_events_updated ¤
Signal handlers for incident key events updates to sync with Jira post-mortem.
Functions:
-
sync_key_events_to_jira_postmortem–Update Jira post-mortem timeline when key events are updated.
sync_key_events_to_jira_postmortem ¤
sync_key_events_to_jira_postmortem(sender: Any, incident: Incident, **kwargs: dict[str, Any]) -> None
Update Jira post-mortem timeline when key events are updated.
This handler is triggered when incident key events are updated via the web UI or Slack, and syncs the timeline to the associated Jira post-mortem ticket.
Parameters:
-
sender(Any) –The sender of the signal
-
incident(Incident) –The incident whose key events were updated
-
**kwargs(dict[str, Any], default:{}) –Additional keyword arguments
Source code in src/firefighter/jira_app/signals/incident_key_events_updated.py
postmortem_created ¤
Functions:
-
postmortem_created_handler–Handle post-mortem creation when incident reaches MITIGATED status.
postmortem_created_handler ¤
postmortem_created_handler(
sender: Any, incident: Incident, incident_update: IncidentUpdate, updated_fields: list[str], **kwargs: Never
) -> None
Handle post-mortem creation when incident reaches MITIGATED status.
This handler is registered in jira_app to ensure it works independently of Confluence being enabled. It creates post-mortems for both Confluence and Jira based on their respective feature flags.
Source code in src/firefighter/jira_app/signals/postmortem_created.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
utils ¤
Functions:
-
pythonic_keys–Converts camelCase keys in a dict or list of dict to snake_case. Works recursively.
pythonic_keys ¤
Converts camelCase keys in a dict or list of dict to snake_case. Works recursively.