t-bug-catcher 0.2.6__tar.gz → 0.3.0__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.2.6 → t_bug_catcher-0.3.0}/PKG-INFO +1 -1
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/setup.cfg +1 -1
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/setup.py +1 -1
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/__init__.py +1 -1
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/config.py +7 -1
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/jira.py +28 -10
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/workitems.py +2 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher.egg-info/PKG-INFO +1 -1
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/MANIFEST.in +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/README.rst +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/pyproject.toml +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/requirements.txt +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/bug_catcher.py +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/bug_snag.py +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/exceptions.py +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/utils/__init__.py +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/utils/common.py +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher/utils/logger.py +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher.egg-info/SOURCES.txt +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher.egg-info/dependency_links.txt +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher.egg-info/not-zip-safe +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher.egg-info/requires.txt +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/t_bug_catcher.egg-info/top_level.txt +0 -0
- {t_bug_catcher-0.2.6 → t_bug_catcher-0.3.0}/tests/test_t_bug_catcher.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
|
|
3
|
-
from .workitems import variables
|
|
3
|
+
from .workitems import metadata, variables
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Config:
|
|
@@ -13,6 +13,8 @@ class Config:
|
|
|
13
13
|
MAX_ISSUE_ATTACHMENTS: int = 100
|
|
14
14
|
MAX_DESCRIPTION_LENGTH: int = 250
|
|
15
15
|
|
|
16
|
+
SUPPORT_BOARD = "AB"
|
|
17
|
+
|
|
16
18
|
RC_RUN_LINK = (
|
|
17
19
|
f"https://cloud.robocorp.com/organizations/{os.environ.get('RC_ORGANIZATION_ID')}"
|
|
18
20
|
f"/workspaces/{os.environ.get('RC_WORKSPACE_ID')}/processes"
|
|
@@ -25,5 +27,9 @@ class Config:
|
|
|
25
27
|
else variables.get("environment", "local")
|
|
26
28
|
)
|
|
27
29
|
|
|
30
|
+
STAGE = metadata.get("process", dict()).get("implementationStage", "")
|
|
31
|
+
ADMIN_CODE = metadata.get("process", dict()).get("adminCode", "")
|
|
32
|
+
EMPOWER_URL = metadata.get("process", dict()).get("processRunUrl") or variables.get("processRunUrl")
|
|
33
|
+
|
|
28
34
|
|
|
29
35
|
CONFIG = Config()
|
|
@@ -89,7 +89,12 @@ class Jira:
|
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
def config(
|
|
92
|
-
self,
|
|
92
|
+
self,
|
|
93
|
+
login: str,
|
|
94
|
+
api_token: str,
|
|
95
|
+
project_key: str,
|
|
96
|
+
webhook_url: Optional[str] = None,
|
|
97
|
+
default_assignee: Optional[str] = None,
|
|
93
98
|
) -> bool:
|
|
94
99
|
"""Sets the webhook URL for the Jira project.
|
|
95
100
|
|
|
@@ -104,7 +109,7 @@ class Jira:
|
|
|
104
109
|
bool: True if the configuration was successful, False otherwise.
|
|
105
110
|
"""
|
|
106
111
|
try:
|
|
107
|
-
self._project_key = project_key
|
|
112
|
+
self._project_key = project_key if CONFIG.STAGE not in ["hypercare", "support"] else CONFIG.SUPPORT_BOARD
|
|
108
113
|
self._default_assignee = default_assignee
|
|
109
114
|
if not webhook_url:
|
|
110
115
|
logger.warning("No JIRA webhook URL provided. All issues will be posted to backlog.")
|
|
@@ -227,6 +232,8 @@ class Jira:
|
|
|
227
232
|
}
|
|
228
233
|
if labels:
|
|
229
234
|
fields["fields"]["labels"] = labels
|
|
235
|
+
if self._project_key == CONFIG.SUPPORT_BOARD and CONFIG.ADMIN_CODE:
|
|
236
|
+
fields["fields"]["customfield_10077"] = [CONFIG.ADMIN_CODE]
|
|
230
237
|
payload = json.dumps(fields)
|
|
231
238
|
return payload
|
|
232
239
|
|
|
@@ -525,11 +532,11 @@ class Jira:
|
|
|
525
532
|
variables.get("environment"): [
|
|
526
533
|
{
|
|
527
534
|
"type": "text",
|
|
528
|
-
"text":
|
|
535
|
+
"text": CONFIG.EMPOWER_URL,
|
|
529
536
|
"marks": [
|
|
530
537
|
{
|
|
531
538
|
"type": "link",
|
|
532
|
-
"attrs": {"href":
|
|
539
|
+
"attrs": {"href": CONFIG.EMPOWER_URL},
|
|
533
540
|
},
|
|
534
541
|
{"type": "underline"},
|
|
535
542
|
],
|
|
@@ -839,11 +846,20 @@ class Jira:
|
|
|
839
846
|
Returns:
|
|
840
847
|
The response from creating the ticket.
|
|
841
848
|
"""
|
|
842
|
-
|
|
843
|
-
self._issue_types.get("
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
)
|
|
849
|
+
if CONFIG.STAGE.lower() == "hypercare":
|
|
850
|
+
issue_type = self._issue_types.get("hypercare") or self._issue_types.get("epic")
|
|
851
|
+
elif CONFIG.STAGE.lower() == "support":
|
|
852
|
+
issue_type = self._issue_types.get("support") or self._issue_types.get("epic")
|
|
853
|
+
elif CONFIG.STAGE.lower() == "delivery" and self._project_key == CONFIG.SUPPORT_BOARD:
|
|
854
|
+
issue_type = self._issue_types.get("development") or self._issue_types.get("epic")
|
|
855
|
+
else:
|
|
856
|
+
issue_type = (
|
|
857
|
+
self._issue_types.get("bug")
|
|
858
|
+
or self._issue_types.get("task")
|
|
859
|
+
or self._issue_types.get("support")
|
|
860
|
+
or self._issue_types.get("epic")
|
|
861
|
+
)
|
|
862
|
+
|
|
847
863
|
issue = self.__generate_issue_body(
|
|
848
864
|
summary=summary[:255].split("\n")[0],
|
|
849
865
|
description=description,
|
|
@@ -877,7 +893,7 @@ class Jira:
|
|
|
877
893
|
for attachment in attachments:
|
|
878
894
|
if os.path.exists(str(attachment)):
|
|
879
895
|
self.add_attachment(attachment, ticket_id)
|
|
880
|
-
if self._webhook_url:
|
|
896
|
+
if self._webhook_url and self._project_key != CONFIG.SUPPORT_BOARD:
|
|
881
897
|
self.move_ticket_to_board(ticket_id)
|
|
882
898
|
return response
|
|
883
899
|
|
|
@@ -1218,4 +1234,6 @@ class Jira:
|
|
|
1218
1234
|
f"[{exc_type.__name__}:{os.path.basename(file_name)}:{line_no}] "
|
|
1219
1235
|
f"{self.remove_locators_from_exception(exc_value)}"
|
|
1220
1236
|
)
|
|
1237
|
+
if self._project_key == CONFIG.SUPPORT_BOARD and CONFIG.ADMIN_CODE:
|
|
1238
|
+
summary = CONFIG.ADMIN_CODE + " - " + summary
|
|
1221
1239
|
return summary
|
|
@@ -7,6 +7,8 @@ try:
|
|
|
7
7
|
work_items.get_input_work_item()
|
|
8
8
|
work_item = work_items.get_work_item_variables()
|
|
9
9
|
variables = work_item.get("variables", dict())
|
|
10
|
+
metadata = work_item.get("metadata", dict())
|
|
10
11
|
except (ImportError, KeyError):
|
|
11
12
|
logger.warning("Workitems unavailable. Variables will be empty.")
|
|
12
13
|
variables = {}
|
|
14
|
+
metadata = {}
|
|
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
|