tft-cli 0.0.28__py3-none-any.whl → 0.0.29__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tft/cli/commands.py +69 -20
- {tft_cli-0.0.28.dist-info → tft_cli-0.0.29.dist-info}/METADATA +1 -1
- {tft_cli-0.0.28.dist-info → tft_cli-0.0.29.dist-info}/RECORD +6 -6
- {tft_cli-0.0.28.dist-info → tft_cli-0.0.29.dist-info}/LICENSE +0 -0
- {tft_cli-0.0.28.dist-info → tft_cli-0.0.29.dist-info}/WHEEL +0 -0
- {tft_cli-0.0.28.dist-info → tft_cli-0.0.29.dist-info}/entry_points.txt +0 -0
tft/cli/commands.py
CHANGED
|
@@ -68,7 +68,10 @@ RESERVE_URL = os.getenv("TESTING_FARM_RESERVE_URL", "https://gitlab.com/testing-
|
|
|
68
68
|
RESERVE_REF = os.getenv("TESTING_FARM_RESERVE_REF", "main")
|
|
69
69
|
RESERVE_TMT_DISCOVER_EXTRA_ARGS = f"--insert --how fmf --url {RESERVE_URL} --ref {RESERVE_REF} --test {RESERVE_TEST}"
|
|
70
70
|
|
|
71
|
+
# NOTE(mvadkert): note that reservation duration is different per ranch,
|
|
72
|
+
# ignore this fact for now here for reservations
|
|
71
73
|
DEFAULT_PIPELINE_TIMEOUT = 60 * 12
|
|
74
|
+
|
|
72
75
|
DEFAULT_AGE = "7d"
|
|
73
76
|
|
|
74
77
|
# SSH command options for reservation connections
|
|
@@ -329,6 +332,17 @@ OPTION_TMT_CONTEXT: Optional[List[str]] = typer.Option(
|
|
|
329
332
|
metavar="key=value|@file",
|
|
330
333
|
help="Context variables to pass to `tmt`. The @ prefix marks a yaml file to load.",
|
|
331
334
|
)
|
|
335
|
+
OPTION_TMT_ENVIRONMENT: Optional[List[str]] = typer.Option(
|
|
336
|
+
None,
|
|
337
|
+
"-T",
|
|
338
|
+
"--tmt-environment",
|
|
339
|
+
metavar="key=value|@file",
|
|
340
|
+
help=(
|
|
341
|
+
"Environment variables to pass to the tmt process. "
|
|
342
|
+
"Used to configure tmt report plugins like reportportal or polarion. "
|
|
343
|
+
"The @ prefix marks a yaml file to load."
|
|
344
|
+
),
|
|
345
|
+
)
|
|
332
346
|
|
|
333
347
|
|
|
334
348
|
def _option_autoconnect(panel: str) -> bool:
|
|
@@ -478,6 +492,24 @@ def _localhost_ingress_rule(session: requests.Session) -> str:
|
|
|
478
492
|
exit_error(f"Got {get_ip.status_code} while checking {settings.PUBLIC_IP_CHECKER_URL}")
|
|
479
493
|
|
|
480
494
|
|
|
495
|
+
def _extend_test_name_for_reservation(tmt_test_name: Optional[str]) -> Optional[str]:
|
|
496
|
+
"""
|
|
497
|
+
Extend test name to include the reservation test when --reserve is used.
|
|
498
|
+
"""
|
|
499
|
+
if tmt_test_name:
|
|
500
|
+
return f"{tmt_test_name}|{RESERVE_TEST}"
|
|
501
|
+
return None
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
def _extend_test_filter_for_reservation(tmt_test_filter: Optional[str]) -> Optional[str]:
|
|
505
|
+
"""
|
|
506
|
+
Extend test filter to include the reservation test when --reserve is used.
|
|
507
|
+
"""
|
|
508
|
+
if tmt_test_filter:
|
|
509
|
+
return f"{tmt_test_filter} | name:{RESERVE_TEST}"
|
|
510
|
+
return None
|
|
511
|
+
|
|
512
|
+
|
|
481
513
|
def _add_reservation(
|
|
482
514
|
ssh_public_keys: List[str],
|
|
483
515
|
rules: Dict[str, Any],
|
|
@@ -878,9 +910,14 @@ def request(
|
|
|
878
910
|
context: typer.Context,
|
|
879
911
|
api_url: str = ARGUMENT_API_URL,
|
|
880
912
|
api_token: str = ARGUMENT_API_TOKEN,
|
|
881
|
-
timeout: int = typer.Option(
|
|
882
|
-
|
|
883
|
-
help=
|
|
913
|
+
timeout: Optional[int] = typer.Option(
|
|
914
|
+
None,
|
|
915
|
+
help=(
|
|
916
|
+
"Set the timeout for the request in minutes. "
|
|
917
|
+
"If the request takes longer than this, it will be terminated. "
|
|
918
|
+
"The timeout is counted from the time the request is switched to the running state."
|
|
919
|
+
"For default timeout see https://docs.testing-farm.io/Testing%20Farm/0.1/test-request.html."
|
|
920
|
+
),
|
|
884
921
|
),
|
|
885
922
|
test_type: str = typer.Option("fmf", help="Test type to use, if not set autodetected."),
|
|
886
923
|
tmt_plan_name: Optional[str] = OPTION_TMT_PLAN_NAME,
|
|
@@ -914,17 +951,7 @@ def request(
|
|
|
914
951
|
cli_tmt_context: Optional[List[str]] = OPTION_TMT_CONTEXT,
|
|
915
952
|
variables: Optional[List[str]] = OPTION_VARIABLES,
|
|
916
953
|
secrets: Optional[List[str]] = OPTION_SECRETS,
|
|
917
|
-
tmt_environment: Optional[List[str]] =
|
|
918
|
-
None,
|
|
919
|
-
"-T",
|
|
920
|
-
"--tmt-environment",
|
|
921
|
-
metavar="key=value|@file",
|
|
922
|
-
help=(
|
|
923
|
-
"Environment variables to pass to the tmt process. "
|
|
924
|
-
"Used to configure tmt report plugins like reportportal or polarion. "
|
|
925
|
-
"The @ prefix marks a yaml file to load."
|
|
926
|
-
),
|
|
927
|
-
),
|
|
954
|
+
tmt_environment: Optional[List[str]] = OPTION_TMT_ENVIRONMENT,
|
|
928
955
|
no_wait: bool = typer.Option(False, help="Skip waiting for request completion."),
|
|
929
956
|
worker_image: Optional[str] = OPTION_WORKER_IMAGE,
|
|
930
957
|
redhat_brew_build: List[str] = OPTION_REDHAT_BREW_BUILD,
|
|
@@ -1070,10 +1097,16 @@ def request(
|
|
|
1070
1097
|
test["plan_filter"] = tmt_plan_filter
|
|
1071
1098
|
|
|
1072
1099
|
if tmt_test_name:
|
|
1073
|
-
|
|
1100
|
+
if reserve:
|
|
1101
|
+
test["test_name"] = _extend_test_name_for_reservation(tmt_test_name)
|
|
1102
|
+
else:
|
|
1103
|
+
test["test_name"] = tmt_test_name
|
|
1074
1104
|
|
|
1075
1105
|
if tmt_test_filter:
|
|
1076
|
-
|
|
1106
|
+
if reserve:
|
|
1107
|
+
test["test_filter"] = _extend_test_filter_for_reservation(tmt_test_filter)
|
|
1108
|
+
else:
|
|
1109
|
+
test["test_filter"] = tmt_test_filter
|
|
1077
1110
|
|
|
1078
1111
|
if sti_playbooks:
|
|
1079
1112
|
test["playbooks"] = sti_playbooks
|
|
@@ -1217,11 +1250,14 @@ def request(
|
|
|
1217
1250
|
request["environments"] = environments
|
|
1218
1251
|
request["settings"] = {}
|
|
1219
1252
|
|
|
1220
|
-
|
|
1253
|
+
forced_pipeline_timeout = context.get_parameter_source("timeout") == ParameterSource.COMMANDLINE
|
|
1254
|
+
|
|
1255
|
+
if reserve or pipeline_type or parallel_limit or forced_pipeline_timeout:
|
|
1221
1256
|
request["settings"]["pipeline"] = {}
|
|
1222
1257
|
|
|
1223
1258
|
# in case the reservation duration is more than the pipeline timeout, adjust also the pipeline timeout
|
|
1224
1259
|
if reserve:
|
|
1260
|
+
timeout = timeout or DEFAULT_PIPELINE_TIMEOUT
|
|
1225
1261
|
if reservation_duration > timeout:
|
|
1226
1262
|
request["settings"]["pipeline"] = {"timeout": reservation_duration}
|
|
1227
1263
|
console.print(f"⏳ Maximum reservation time is {reservation_duration} minutes")
|
|
@@ -1230,7 +1266,7 @@ def request(
|
|
|
1230
1266
|
console.print(f"⏳ Maximum reservation time is {timeout} minutes")
|
|
1231
1267
|
|
|
1232
1268
|
# forced pipeline timeout
|
|
1233
|
-
elif
|
|
1269
|
+
elif forced_pipeline_timeout:
|
|
1234
1270
|
console.print(f"⏳ Pipeline timeout forced to {timeout} minutes")
|
|
1235
1271
|
request["settings"]["pipeline"] = {"timeout": timeout}
|
|
1236
1272
|
|
|
@@ -1423,10 +1459,16 @@ def restart(
|
|
|
1423
1459
|
test["ref"] = git_ref
|
|
1424
1460
|
|
|
1425
1461
|
if tmt_test_name:
|
|
1426
|
-
|
|
1462
|
+
if reserve:
|
|
1463
|
+
test["test_name"] = _extend_test_name_for_reservation(tmt_test_name)
|
|
1464
|
+
else:
|
|
1465
|
+
test["test_name"] = tmt_test_name
|
|
1427
1466
|
|
|
1428
1467
|
if tmt_test_filter:
|
|
1429
|
-
|
|
1468
|
+
if reserve:
|
|
1469
|
+
test["test_filter"] = _extend_test_filter_for_reservation(tmt_test_filter)
|
|
1470
|
+
else:
|
|
1471
|
+
test["test_filter"] = tmt_test_filter
|
|
1430
1472
|
|
|
1431
1473
|
merge_sha_info = ""
|
|
1432
1474
|
if git_merge_sha:
|
|
@@ -1793,6 +1835,7 @@ def reserve(
|
|
|
1793
1835
|
repository: List[str] = OPTION_REPOSITORY,
|
|
1794
1836
|
repository_file: List[str] = OPTION_REPOSITORY_FILE,
|
|
1795
1837
|
redhat_brew_build: List[str] = OPTION_REDHAT_BREW_BUILD,
|
|
1838
|
+
tmt_environment: Optional[List[str]] = OPTION_TMT_ENVIRONMENT,
|
|
1796
1839
|
tmt_discover: Optional[List[str]] = _generate_tmt_extra_args("discover"),
|
|
1797
1840
|
tmt_prepare: Optional[List[str]] = _generate_tmt_extra_args("prepare"),
|
|
1798
1841
|
tmt_finish: Optional[List[str]] = _generate_tmt_extra_args("finish"),
|
|
@@ -1908,6 +1951,12 @@ def reserve(
|
|
|
1908
1951
|
if tmt_finish:
|
|
1909
1952
|
environment["tmt"]["extra_args"]["finish"] = tmt_finish
|
|
1910
1953
|
|
|
1954
|
+
if tmt_environment:
|
|
1955
|
+
if "tmt" not in environment:
|
|
1956
|
+
environment["tmt"] = {}
|
|
1957
|
+
|
|
1958
|
+
environment["tmt"].update({"environment": options_to_dict("tmt environment variables", tmt_environment)})
|
|
1959
|
+
|
|
1911
1960
|
# Setting up retries
|
|
1912
1961
|
session = requests.Session()
|
|
1913
1962
|
install_http_retries(session)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
tft/cli/__init__.py,sha256=uEJkNJbqC583PBtNI30kxWdeOr3Wj6zJzIYKf0AD72I,92
|
|
2
2
|
tft/cli/command/__init__.py,sha256=uEJkNJbqC583PBtNI30kxWdeOr3Wj6zJzIYKf0AD72I,92
|
|
3
3
|
tft/cli/command/listing.py,sha256=gEkoeKHOcEiBt2TyLzSAongOKHKi7BgEO7GQ0AAa0Ss,31276
|
|
4
|
-
tft/cli/commands.py,sha256=
|
|
4
|
+
tft/cli/commands.py,sha256=8mFsKZwf485-bsDvQRcKFKFXgpV8-76J75XCV__knm8,87730
|
|
5
5
|
tft/cli/config.py,sha256=9JWjEwBiS4_Eq1B53lxxCIceERJ7AeryUyqxj9fm9c4,1714
|
|
6
6
|
tft/cli/tool.py,sha256=AaJ7RZwWEoP7WA_f2NbmcZSolNETkTWvVAt9pgt9j-o,975
|
|
7
7
|
tft/cli/utils.py,sha256=j8B30qpieBUieaiVo_3h5bRqoKnGeGKxR9eJ7GZcNiM,13702
|
|
8
|
-
tft_cli-0.0.
|
|
9
|
-
tft_cli-0.0.
|
|
10
|
-
tft_cli-0.0.
|
|
11
|
-
tft_cli-0.0.
|
|
12
|
-
tft_cli-0.0.
|
|
8
|
+
tft_cli-0.0.29.dist-info/LICENSE,sha256=YpVAQfXkIyzQAdm5LZkI6L5UWqLppa6O8_tgDSdoabQ,574
|
|
9
|
+
tft_cli-0.0.29.dist-info/METADATA,sha256=ckMhExUPazwr36mUf_JBNqPk8uU7quU9Ge4RmKMjI_E,830
|
|
10
|
+
tft_cli-0.0.29.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
|
11
|
+
tft_cli-0.0.29.dist-info/entry_points.txt,sha256=xzdebHkH5Bx-YRf-XPMsIoVpvgfUqqcRQGuo8DFkiao,49
|
|
12
|
+
tft_cli-0.0.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|