def check_issue(branch): jira = get_jira_server() issue = get_jira_issue(jira, branch) if str(issue.fields.status) == 'Resolved': test_scenario_field = check_test_scenario_field( get_test_scenario_field(issue)) if check_git_branch(branch) == True: conflict = check_git_conflict(branch) pullrequest = check_pullrequest(branch) success_build, build_number = find_unsuccessfull_build_for_branch( branch) if not conflict and pullrequest and success_build and \ test_scenario_field: print 'This issue', branch, 'is successfully completed' comment = 'Test success' add_comment(jira, branch, comment) write_env_var(FAIL_REASON, SUCCESS_MSG) else: print 'This issue', branch, 'is unsuccessfully completed' comment = get_comment( test_scenario_field, conflict, pullrequest, success_build, build_number) reopen_issue( jira, issue, branch, comment) write_env_var(FAIL_REASON, comment) else: if test_scenario_field: print 'This issue', branch, 'is successfully completed' comment = 'Test success' add_comment(jira, branch, comment) write_env_var(FAIL_REASON, SUCCESS_MSG) else: print 'This issue', branch, 'is unsuccessfully completed' comment = get_comment(False) reopen_issue(jira, issue, branch, comment) write_env_var(FAIL_REASON, comment) else: write_env_var(FAIL_REASON, SUCCESS_MSG)
def check_issue(branch): jira = get_jira_server() issue = get_jira_issue(jira, branch) if str(issue.fields.status) == 'Resolved': test_scenario_field = check_test_scenario_field( get_test_scenario_field(issue)) if check_git_branch(branch) == True: conflict = check_git_conflict(branch) pullrequest = check_pullrequest(branch) success_build, build_number = find_unsuccessfull_build_for_branch( branch) if not conflict and pullrequest and success_build and \ test_scenario_field: print 'This issue', branch, 'is successfully completed' comment = 'Test success' add_comment(jira, branch, comment) write_env_var(FAIL_REASON, SUCCESS_MSG) else: print 'This issue', branch, 'is unsuccessfully completed' comment = get_comment(test_scenario_field, conflict, pullrequest, success_build, build_number) reopen_issue(jira, issue, branch, comment) write_env_var(FAIL_REASON, comment) else: if test_scenario_field: print 'This issue', branch, 'is successfully completed' comment = 'Test success' add_comment(jira, branch, comment) write_env_var(FAIL_REASON, SUCCESS_MSG) else: print 'This issue', branch, 'is unsuccessfully completed' comment = get_comment(False) reopen_issue(jira, issue, branch, comment) write_env_var(FAIL_REASON, comment) else: write_env_var(FAIL_REASON, SUCCESS_MSG)
def main(branch): redmine = get_redmine_server() issue = get_redmine_issue(redmine, branch) check_test_scenario_field(get_test_scenario_field(issue))