t-bug-catcher 0.6.9__tar.gz → 0.6.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/PKG-INFO +1 -1
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/setup.cfg +1 -1
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/setup.py +1 -1
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/__init__.py +1 -1
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/bug_catcher.py +3 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/jira.py +26 -4
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher.egg-info/PKG-INFO +1 -1
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/MANIFEST.in +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/README.rst +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/pyproject.toml +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/requirements.txt +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/bug_snag.py +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/config.py +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/exceptions.py +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/resources/whispers_config.yml +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/stack_saver.py +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/utils/__init__.py +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/utils/common.py +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/utils/logger.py +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher/workitems.py +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher.egg-info/not-zip-safe +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher.egg-info/requires.txt +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/t_bug_catcher.egg-info/top_level.txt +0 -0
- {t_bug_catcher-0.6.9 → t_bug_catcher-0.6.11}/tests/test_t_bug_catcher.py +0 -0
|
@@ -26,7 +26,7 @@ setup(
|
|
|
26
26
|
packages=find_packages(include=["t_bug_catcher", "t_bug_catcher.*"]),
|
|
27
27
|
test_suite="tests",
|
|
28
28
|
url="https://www.thoughtful.ai/",
|
|
29
|
-
version="0.6.
|
|
29
|
+
version="0.6.11",
|
|
30
30
|
zip_safe=False,
|
|
31
31
|
install_requires=install_requirements,
|
|
32
32
|
include_package_data=True,
|
|
@@ -30,6 +30,7 @@ class Configurator:
|
|
|
30
30
|
api_token: str,
|
|
31
31
|
project_key: str,
|
|
32
32
|
webhook_url: Optional[str] = None,
|
|
33
|
+
webhook_secret: Optional[str] = None,
|
|
33
34
|
default_assignee: Optional[str] = None,
|
|
34
35
|
):
|
|
35
36
|
"""Configures the JiraPoster and BugSnag classes.
|
|
@@ -39,6 +40,7 @@ class Configurator:
|
|
|
39
40
|
api_token (str): The API token for the Jira account.
|
|
40
41
|
project_key (str): The key of the Jira project.
|
|
41
42
|
webhook_url (str, optional): The webhook URL for the Jira project. Defaults to None.
|
|
43
|
+
webhook_secret (str, optional): The webhook secret for the Jira project. Defaults to None.
|
|
42
44
|
default_assignee (str, optional): The default assignee for the Jira project. Defaults to None.
|
|
43
45
|
|
|
44
46
|
Returns:
|
|
@@ -49,6 +51,7 @@ class Configurator:
|
|
|
49
51
|
api_token=api_token,
|
|
50
52
|
project_key=project_key,
|
|
51
53
|
webhook_url=webhook_url,
|
|
54
|
+
webhook_secret=webhook_secret,
|
|
52
55
|
default_assignee=default_assignee,
|
|
53
56
|
)
|
|
54
57
|
|
|
@@ -54,9 +54,11 @@ class Jira:
|
|
|
54
54
|
self._issue_types = {}
|
|
55
55
|
self._project_key = None
|
|
56
56
|
self._webhook_url = None
|
|
57
|
+
self._webhook_secret = None
|
|
57
58
|
self._auth = None
|
|
58
59
|
self._default_assignee = None
|
|
59
60
|
self._build_info: Optional[dict] = None
|
|
61
|
+
self._status_to_transition = ["to do", "open", "backlog"]
|
|
60
62
|
|
|
61
63
|
@staticmethod
|
|
62
64
|
def _is_json_response(response) -> bool:
|
|
@@ -99,6 +101,7 @@ class Jira:
|
|
|
99
101
|
api_token: str,
|
|
100
102
|
project_key: str,
|
|
101
103
|
webhook_url: Optional[str] = None,
|
|
104
|
+
webhook_secret: Optional[str] = None,
|
|
102
105
|
default_assignee: Optional[str] = None,
|
|
103
106
|
) -> bool:
|
|
104
107
|
"""Sets the webhook URL for the Jira project.
|
|
@@ -108,6 +111,7 @@ class Jira:
|
|
|
108
111
|
api_token (str): The API token for the Jira account.
|
|
109
112
|
project_key (str): The key of the Jira project.
|
|
110
113
|
webhook_url (str): The webhook URL for the Jira project.
|
|
114
|
+
webhook_secret (str, optional): The webhook secret for the Jira project. Defaults to None.
|
|
111
115
|
default_assignee (str, optional): The default assignee for the Jira project. Defaults to None.
|
|
112
116
|
|
|
113
117
|
Returns:
|
|
@@ -120,6 +124,7 @@ class Jira:
|
|
|
120
124
|
if not webhook_url:
|
|
121
125
|
logger.warning("No JIRA webhook URL provided. All issues will be posted to backlog.")
|
|
122
126
|
self._webhook_url = webhook_url
|
|
127
|
+
self._webhook_secret = webhook_secret
|
|
123
128
|
self._auth = self._authenticate(login, api_token)
|
|
124
129
|
try:
|
|
125
130
|
self.get_current_user()
|
|
@@ -265,10 +270,13 @@ class Jira:
|
|
|
265
270
|
None
|
|
266
271
|
"""
|
|
267
272
|
payload = json.dumps({"issues": [ticket_id]})
|
|
273
|
+
headers = {"Content-type": "application/json"}
|
|
274
|
+
if self._webhook_secret:
|
|
275
|
+
headers["X-Automation-Webhook-Token"] = self._webhook_secret
|
|
268
276
|
requests.request(
|
|
269
277
|
"POST",
|
|
270
278
|
url=self._webhook_url,
|
|
271
|
-
headers=
|
|
279
|
+
headers=headers,
|
|
272
280
|
data=payload,
|
|
273
281
|
)
|
|
274
282
|
|
|
@@ -303,7 +311,7 @@ class Jira:
|
|
|
303
311
|
Returns:
|
|
304
312
|
dict: The board information
|
|
305
313
|
"""
|
|
306
|
-
if self._transition_types.get(
|
|
314
|
+
if any(self._transition_types.get(status) for status in self._status_to_transition):
|
|
307
315
|
return self._transition_types
|
|
308
316
|
|
|
309
317
|
response = requests.request(
|
|
@@ -1138,10 +1146,24 @@ class Jira:
|
|
|
1138
1146
|
"""
|
|
1139
1147
|
issue_status = self.check_issue_status(existing_ticket["id"])
|
|
1140
1148
|
self._transition_types = self.__get_transtion_types(issue_id=existing_ticket["id"])
|
|
1141
|
-
|
|
1149
|
+
transition_id = next(
|
|
1150
|
+
(
|
|
1151
|
+
self._transition_types.get(status)
|
|
1152
|
+
for status in self._status_to_transition
|
|
1153
|
+
if self._transition_types.get(status)
|
|
1154
|
+
),
|
|
1155
|
+
None,
|
|
1156
|
+
)
|
|
1157
|
+
if not transition_id:
|
|
1158
|
+
transitions_str = [k for k in self._transition_types.keys()]
|
|
1159
|
+
raise BadRequestError(
|
|
1160
|
+
f"Transition ID not found for statuses: {self._status_to_transition}. "
|
|
1161
|
+
f"Available transitions: {transitions_str}"
|
|
1162
|
+
)
|
|
1163
|
+
if issue_status.lower() not in self._status_to_transition:
|
|
1142
1164
|
self.issue_transition(
|
|
1143
1165
|
ticket_id=existing_ticket["id"],
|
|
1144
|
-
transition_id=
|
|
1166
|
+
transition_id=transition_id,
|
|
1145
1167
|
)
|
|
1146
1168
|
self.update_comment(
|
|
1147
1169
|
ticket_id=existing_ticket["id"],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|