-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
75 lines (62 loc) · 2.52 KB
/
cli.py
File metadata and controls
75 lines (62 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from typing import Optional
import click
from scripts.client import TC
from scripts.utils.models import AutoTestsInfo
from scripts.utils.trigger_helpers import trigger_tests
@click.group()
def cli():
pass
@cli.command(
"trigger-auto-tests",
help="Trigger Automated Tests on TeamCity for specified Shells and changed package",
)
@click.option("--tc-url", required=False, help="TeamCity URL")
@click.option("--tc-user", required=False, help="TeamCity User")
@click.option("--tc-password", required=False, help="TeamCity Password")
def trigger_auto_tests(
tc_url: Optional[str], tc_user: Optional[str], tc_password: Optional[str]
):
tc = TC(tc_url, tc_user, tc_password)
current_build = tc.get_current_build()
tests_info = AutoTestsInfo.from_current_build(current_build)
trigger_tests(tests_info, tc)
@cli.command("get-commits-from-changes", help="Return commits from the VCS changes.")
@click.option("--tc-url", required=False, help="TeamCity URL")
@click.option("--tc-user", required=False, help="TeamCity User")
@click.option("--tc-password", required=False, help="TeamCity Password")
def get_commits_from_changes(
tc_url: Optional[str], tc_user: Optional[str], tc_password: Optional[str]
):
tc = TC(tc_url, tc_user, tc_password)
current_build = tc.get_current_build()
commits = tc.get_build_commits(current_build)
click.echo(" ".join(commits))
@cli.command(
"trigger-qualix-auto-tests",
help="Trigger Qualix Automated Tests on TeamCity for specified qualix ip",
)
@click.option("--tc-url", required=False, help="TeamCity URL")
@click.option("--tc-user", required=False, help="TeamCity User")
@click.option("--tc-password", required=False, help="TeamCity Password")
@click.option("--qualix-host", required=False, default=None, help="Tested Qualix host")
@click.option(
"--qualix-version", required=False, default=None, help="Tested Qualix version"
)
@click.option("--image-tag", required=False, default=None, help="Tested Qualix image")
def trigger_qualix_auto_tests(
tc_url: Optional[str],
tc_user: Optional[str],
tc_password: Optional[str],
qualix_host: Optional[str],
qualix_version: Optional[str],
image_tag: Optional[str],
):
tc = TC(tc_url, tc_user, tc_password)
current_build = tc.get_current_build()
tests_info = AutoTestsInfo.from_current_build(current_build)
tests_info.qualix_host = qualix_host
tests_info.qualix_version = qualix_version
tests_info.image_tag = image_tag
trigger_tests(tests_info, tc)
if __name__ == "__main__":
cli()