Skip to content

Commit

Permalink
SF
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang Cao committed Aug 14, 2023
1 parent 495dfcc commit 264e95c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions script/create_test_fix_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand All @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions script/forward_failure_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
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

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 = ""
Expand Down Expand Up @@ -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)

0 comments on commit 264e95c

Please sign in to comment.