Skip to content

Commit 24e2cd1

Browse files
committed
fix adding build id
1 parent 6cf8696 commit 24e2cd1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scripts/trigger_auto_tests/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import time
2+
from typing import Optional
23

34
import click
45
from dohq_teamcity import TeamCity
@@ -18,7 +19,7 @@
1819

1920
def main(tc_user: str, tc_password: str):
2021
errors = []
21-
triggered_builds = {}
22+
triggered_builds: dict[str, int] = {}
2223
tc = TeamCity(TC_URL, auth=(tc_user, tc_password))
2324
tests_info = AutoTestsInfo.get_current(tc)
2425
if tests_info.re_run_builds:
@@ -28,7 +29,8 @@ def main(tc_user: str, tc_password: str):
2829

2930
for shell_name in tests_info.supported_shells:
3031
try:
31-
triggered_builds = _run_tests_for_shell(tc, shell_name, tests_info)
32+
build_id = _run_tests_for_shell(tc, shell_name, tests_info)
33+
triggered_builds[shell_name] = build_id
3234
except Exception as e:
3335
errors.append(e)
3436
click.echo(e, err=True)
@@ -43,8 +45,8 @@ def main(tc_user: str, tc_password: str):
4345

4446
def _run_tests_for_shell(
4547
tc: TeamCity, shell_name: str, tests_info: AutoTestsInfo
46-
) -> dict[str, int]:
47-
triggered_builds = {}
48+
) -> Optional[int]:
49+
build_id = None
4850
if is_shell_uses_package(shell_name, tests_info):
4951
if tests_info.re_run_builds:
5052
if is_last_build_successful(tc, shell_name, tests_info):
@@ -55,14 +57,12 @@ def _run_tests_for_shell(
5557
else:
5658
click.echo(f"{shell_name} Re run automation tests")
5759
build_id = trigger_auto_tests_build2(tc, shell_name, tests_info)
58-
triggered_builds[shell_name] = build_id
5960
else:
6061
click.echo(f"{shell_name} Automation tests build triggering")
6162
build_id = trigger_auto_tests_build2(tc, shell_name, tests_info)
62-
triggered_builds[shell_name] = build_id
6363
else:
6464
click.echo(f"{shell_name} is not uses package with this version, skipped tests")
65-
return triggered_builds
65+
return build_id
6666

6767

6868
def _wait_build_finish(

0 commit comments

Comments
 (0)