77from pip_download import PipDownloader
88from pydantic import BaseModel
99
10- from scripts .trigger_auto_tests .utils .tc_api import TeamCityAPI
11-
1210REPOS_OWNER = "QualiSystems"
1311
1412
@@ -47,37 +45,10 @@ def is_shell_uses_package(shell_name: str, tests_info: "AutoTestsInfo") -> bool:
4745
4846
4947def trigger_auto_tests_build (
50- tc_api : TeamCityAPI ,
51- shell_name : str ,
52- automation_project_id : str ,
53- package_vcs_url : str ,
54- package_commit_id : str ,
55- ) -> int :
56- locator_data = {
57- "name" : shell_name ,
58- "project" : automation_project_id ,
59- }
60- additional_data = {
61- "triggeringOptions" : {"queueAtTop" : True },
62- "properties" : {
63- "property" : [
64- {"name" : "conf.triggered_by_project.url" , "value" : package_vcs_url },
65- {
66- "name" : "conf.triggered_by_project.commit_id" ,
67- "value" : package_commit_id ,
68- },
69- ]
70- },
71- }
72- data = tc_api .trigger_builds (locator_data , additional_data = additional_data )
73- return data .id
74-
75-
76- def trigger_auto_tests_build2 (
7748 tc : TeamCity ,
7849 shell_name : str ,
7950 tests_info : "AutoTestsInfo" ,
80- ) -> int :
51+ ) -> tuple [ int , str ] :
8152 bt = tc .projects .get_build_type (
8253 project_locator = f"id:{ tests_info .automation_project_id } " ,
8354 bt_locator = f"name:{ shell_name } " ,
@@ -91,27 +62,29 @@ def trigger_auto_tests_build2(
9162 new_build = Build (build_type_id = bt .id , properties = properties )
9263 update_tc_csrf (tc )
9364 build = tc .build_queues .queue_new_build (body = new_build , move_to_top = True )
94- return build .id
65+ return build .id , build . web_url
9566
9667
9768def is_last_build_successful (
9869 tc : TeamCity , shell_name : str , tests_info : "AutoTestsInfo"
99- ) -> bool :
70+ ) -> tuple [ bool , str ] :
10071 bt : BuildType = tc .projects .get_build_type (
10172 project_locator = f"id:{ tests_info .automation_project_id } " ,
10273 bt_locator = f"name:{ shell_name } " ,
10374 )
75+ build_url = ""
10476 for build in bt .get_builds ():
10577 params = get_build_params (build )
10678 if (
10779 params ["conf.triggered_by_project.url" ] == tests_info .vcs_url
10880 and params ["conf.triggered_by_project.commit_id" ] == tests_info .commit_id
10981 ):
11082 is_success = is_build_success (build )
83+ build_url = build .web_url
11184 break
11285 else :
11386 is_success = False
114- return is_success
87+ return is_success , build_url
11588
11689
11790def is_build_finished (build : Build ) -> bool :
0 commit comments