From 264e95cf5fd4682fa7260f074030474f521de743 Mon Sep 17 00:00:00 2001 From: Yang Cao Date: Tue, 15 Aug 2023 07:21:47 +0800 Subject: [PATCH] SF --- script/create_test_fix_ticket.py | 8 ++++---- script/forward_failure_pull_request.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/script/create_test_fix_ticket.py b/script/create_test_fix_ticket.py index 0644cac..bd76864 100644 --- a/script/create_test_fix_ticket.py +++ b/script/create_test_fix_ticket.py @@ -17,7 +17,7 @@ from liferay.util.credentials import get_credentials -def add_test_fix_ticket(jira_connection, component, case_name, case_error): +def add_test_fix_ticket(case_error, case_name, case_result_id, component, jira_connection): issue_dict = { 'project': {'key': 'LPS'}, 'summary': 'Investigate failure in ' + case_name, @@ -54,7 +54,7 @@ def get_case_result(auth, case_result_id): return json.loads(response.text) -def get_relevant_jira_component(jira_connection, case_result): +def get_relevant_jira_component(case_result, jira_connection): jira_components = get_project_components(jira_connection, get_credentials("PROJECT_KEY")) jira_component_names = [jira_component.name for jira_component in jira_components] @@ -81,9 +81,9 @@ def get_relevant_jira_component(jira_connection, case_result): jira_connection = get_jira_connection() - component = get_relevant_jira_component(jira_connection, case_result) + component = get_relevant_jira_component(case_result, jira_connection) - issue = add_test_fix_ticket(jira_connection, component, case_name, case_error) + issue = add_test_fix_ticket(case_error, case_name, case_result_id, component, jira_connection) assign_to_me(jira_connection, issue) diff --git a/script/forward_failure_pull_request.py b/script/forward_failure_pull_request.py index 7aa7545..b06fcb6 100644 --- a/script/forward_failure_pull_request.py +++ b/script/forward_failure_pull_request.py @@ -13,11 +13,11 @@ from liferay.util.credentials import get_credentials -def add_comments_in_failure_pr(pull_request, new_pr_link): +def add_comments_in_failure_pr(new_pr_link, pull_request): pull_request.create_issue_comment("See " + new_pr_link) pull_request.create_issue_comment("ci:close") -def add_comments_in_new_pr(pull_request, failure_pr_link): +def add_comments_in_new_pr(failure_pr_link, pull_request): time.sleep(3) comments = "In order to not clog up ci resources, I'm sending the PR directly. Failure cases are unrelated to changes in this PR.\n\nSee " + failure_pr_link @@ -25,7 +25,7 @@ def add_comments_in_new_pr(pull_request, failure_pr_link): pull_request.create_issue_comment("ci:reopen") pull_request.create_issue_comment(comments) -def create_pr_to_brianchan(github_connection,failure_pr): +def create_pr_to_brianchan(failure_pr, github_connection): ticket_numbers = re.findall("[A-Z]+\-\d+", failure_pr.title) jira_links = "" @@ -56,12 +56,12 @@ def create_pr_to_brianchan(github_connection,failure_pr): push_branch_to_origin(local_repo, "temp_branch", failure_pr.head.ref) - new_pr = create_pr_to_brianchan(g, failure_pr) + new_pr = create_pr_to_brianchan(failure_pr, g) delete_temp_branch(local_repo) - add_comments_in_new_pr(new_pr, failure_pr.html_url) + add_comments_in_new_pr(failure_pr.html_url, new_pr) - add_comments_in_failure_pr(failure_pr, new_pr.html_url) + add_comments_in_failure_pr(new_pr.html_url, failure_pr) print(new_pr.html_url)