Skip to content

Commit

Permalink
deleting excess comment and making issue list before new ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
nbshiland committed Jul 31, 2024
1 parent 3ebadeb commit 0f180e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
27 changes: 1 addition & 26 deletions abr-testing/abr_testing/automation/jira_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def issues_on_board(self, board_id: str) -> List[List[Any]]:
for i in all_issues:
issue_id = i.get("id")
issue_summary = i["fields"].get("summary")
# print(f"summary: {issue_summary} {issue_id}")
issue_ids.append([issue_id, issue_summary])
return issue_ids

Expand All @@ -54,8 +53,6 @@ def match_issues(self, issue_ids: List[List[str]], ticket_summary: str) -> List:
to_link = []
error = ticket_summary.split("_")[3]
robot = ticket_summary.split("_")[0]
print(error)
print(robot)
# for every issue see if both match, if yes then grab issue ID and add it to a list
for issue in issue_ids:
summary = issue[1]
Expand All @@ -74,23 +71,6 @@ def link_issues(self, to_link: list, ticket_key: str) -> None:
for issue in to_link:
link_data = json.dumps(
{
"comment": {
"body": {
"content": [
{
"content": [
{
"text": "Linked related issue!",
"type": "text",
}
],
"type": "paragraph",
}
],
"type": "doc",
"version": 1,
},
},
"inwardIssue": {"key": ticket_key},
"outwardIssue": {"id": issue},
"type": {"name": "Relates"},
Expand All @@ -102,12 +82,7 @@ def link_issues(self, to_link: list, ticket_key: str) -> None:
auth=self.auth,
data=link_data,
)
# print(response.raise_for_status())

# except requests.exceptions.HTTPError:
# print("HTTP ERROR OH NO")
# except json.JSONDecodeError:
# print("JSON decoding error")
print(response)

def open_issue(self, issue_key: str) -> str:
"""Open issue on web browser."""
Expand Down
9 changes: 4 additions & 5 deletions abr-testing/abr_testing/data_collection/abr_robot_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ def get_run_error_info_from_robot(
print(robot)
parent_key = project_key + "-" + robot.split("ABR")[1]

# Grab all previous issues
all_issues = ticket.issues_on_board(board_id)

# TODO: read board to see if ticket for run id already exists.
# CREATE TICKET
issue_key, raw_issue_url = ticket.create_ticket(
Expand All @@ -534,12 +537,8 @@ def get_run_error_info_from_robot(
parent_key,
)

# Link Tickets (hopefully)
all_issues = ticket.issues_on_board(board_id)
print(type(all_issues))
print(type(summary))
# Link Tickets
to_link = ticket.match_issues(all_issues, summary)
print(to_link)
ticket.link_issues(to_link, issue_key)

# OPEN TICKET
Expand Down

0 comments on commit 0f180e1

Please sign in to comment.