tft-cli 0.0.25__tar.gz → 0.0.26__tar.gz
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-0.0.25 → tft_cli-0.0.26}/PKG-INFO +1 -1
- {tft_cli-0.0.25 → tft_cli-0.0.26}/pyproject.toml +10 -3
- {tft_cli-0.0.25 → tft_cli-0.0.26}/src/tft/cli/commands.py +28 -17
- {tft_cli-0.0.25 → tft_cli-0.0.26}/src/tft/cli/config.py +2 -2
- {tft_cli-0.0.25 → tft_cli-0.0.26}/LICENSE +0 -0
- {tft_cli-0.0.25 → tft_cli-0.0.26}/LICENSE_SPDX +0 -0
- {tft_cli-0.0.25 → tft_cli-0.0.26}/src/tft/cli/__init__.py +0 -0
- {tft_cli-0.0.25 → tft_cli-0.0.26}/src/tft/cli/tool.py +0 -0
- {tft_cli-0.0.25 → tft_cli-0.0.26}/src/tft/cli/utils.py +0 -0
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
dynamic = ["version"]
|
|
3
|
+
name = "tft-cli"
|
|
4
|
+
|
|
1
5
|
[tool.poetry]
|
|
2
6
|
name = "tft-cli"
|
|
3
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.26"
|
|
4
8
|
description = "Testing Farm CLI tool"
|
|
5
9
|
authors = ["Miroslav Vadkerti <mvadkert@redhat.com>"]
|
|
6
10
|
license = "Apache-2.0"
|
|
@@ -43,6 +47,9 @@ skip-string-normalization = true
|
|
|
43
47
|
profile = "black"
|
|
44
48
|
multi_line_output = 3
|
|
45
49
|
|
|
50
|
+
[tool.poetry-dynamic-versioning]
|
|
51
|
+
enable = false
|
|
52
|
+
|
|
46
53
|
[build-system]
|
|
47
|
-
requires = ["poetry-core>=1.0.0"]
|
|
48
|
-
build-backend = "
|
|
54
|
+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
|
|
55
|
+
build-backend = "poetry_dynamic_versioning.backend"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import base64
|
|
5
5
|
import codecs
|
|
6
|
+
import importlib.metadata
|
|
6
7
|
import ipaddress
|
|
7
8
|
import json
|
|
8
9
|
import os
|
|
@@ -17,7 +18,6 @@ import xml.etree.ElementTree as ET
|
|
|
17
18
|
from enum import Enum
|
|
18
19
|
from typing import Any, Dict, List, Optional
|
|
19
20
|
|
|
20
|
-
import pkg_resources
|
|
21
21
|
import requests
|
|
22
22
|
import typer
|
|
23
23
|
from click.core import ParameterSource # pyre-ignore[21]
|
|
@@ -41,7 +41,7 @@ from tft.cli.utils import (
|
|
|
41
41
|
uuid_valid,
|
|
42
42
|
)
|
|
43
43
|
|
|
44
|
-
cli_version: str =
|
|
44
|
+
cli_version: str = importlib.metadata.version("tft-cli")
|
|
45
45
|
|
|
46
46
|
TestingFarmRequestV1: Dict[str, Any] = {'test': {}, 'environments': None}
|
|
47
47
|
Environment: Dict[str, Any] = {'arch': None, 'os': None, 'pool': None, 'artifacts': None, 'variables': {}}
|
|
@@ -271,6 +271,13 @@ OPTION_RESERVE: bool = typer.Option(
|
|
|
271
271
|
help="Reserve machine after testing, similarly to the `reserve` command.",
|
|
272
272
|
rich_help_panel=REQUEST_PANEL_RESERVE,
|
|
273
273
|
)
|
|
274
|
+
OPTION_TMT_CONTEXT: Optional[List[str]] = typer.Option(
|
|
275
|
+
None,
|
|
276
|
+
"-c",
|
|
277
|
+
"--context",
|
|
278
|
+
metavar="key=value|@file",
|
|
279
|
+
help="Context variables to pass to `tmt`. The @ prefix marks a yaml file to load.",
|
|
280
|
+
)
|
|
274
281
|
|
|
275
282
|
|
|
276
283
|
def _option_autoconnect(panel: str) -> bool:
|
|
@@ -761,7 +768,7 @@ def watch(
|
|
|
761
768
|
_handle_reservation(session, api_url, request["id"], autoconnect)
|
|
762
769
|
return
|
|
763
770
|
|
|
764
|
-
time.sleep(
|
|
771
|
+
time.sleep(settings.WATCH_TICK)
|
|
765
772
|
continue
|
|
766
773
|
|
|
767
774
|
current_state = state
|
|
@@ -861,13 +868,7 @@ def request(
|
|
|
861
868
|
hardware: List[str] = OPTION_HARDWARE,
|
|
862
869
|
kickstart: Optional[List[str]] = OPTION_KICKSTART,
|
|
863
870
|
pool: Optional[str] = OPTION_POOL,
|
|
864
|
-
cli_tmt_context: Optional[List[str]] =
|
|
865
|
-
None,
|
|
866
|
-
"-c",
|
|
867
|
-
"--context",
|
|
868
|
-
metavar="key=value|@file",
|
|
869
|
-
help="Context variables to pass to `tmt`. The @ prefix marks a yaml file to load.",
|
|
870
|
-
),
|
|
871
|
+
cli_tmt_context: Optional[List[str]] = OPTION_TMT_CONTEXT,
|
|
871
872
|
variables: Optional[List[str]] = OPTION_VARIABLES,
|
|
872
873
|
secrets: Optional[List[str]] = OPTION_SECRETS,
|
|
873
874
|
tmt_environment: Optional[List[str]] = typer.Option(
|
|
@@ -1254,6 +1255,8 @@ def restart(
|
|
|
1254
1255
|
None,
|
|
1255
1256
|
help="Force pool to provision.",
|
|
1256
1257
|
),
|
|
1258
|
+
cli_tmt_context: Optional[List[str]] = OPTION_TMT_CONTEXT,
|
|
1259
|
+
variables: Optional[List[str]] = OPTION_VARIABLES,
|
|
1257
1260
|
git_url: Optional[str] = typer.Option(None, help="Force URL of the GIT repository to test."),
|
|
1258
1261
|
git_ref: Optional[str] = typer.Option(None, help="Force GIT ref or branch to test."),
|
|
1259
1262
|
git_merge_sha: Optional[str] = typer.Option(None, help="Force GIT ref or branch into which --ref will be merged."),
|
|
@@ -1332,9 +1335,9 @@ def restart(
|
|
|
1332
1335
|
# Transform to a request
|
|
1333
1336
|
request['environments'] = request['environments_requested']
|
|
1334
1337
|
|
|
1335
|
-
# Remove all keys except test and
|
|
1338
|
+
# Remove all keys except test, environments and settings
|
|
1336
1339
|
for key in list(request):
|
|
1337
|
-
if key not in ['test', 'environments']:
|
|
1340
|
+
if key not in ['test', 'environments', 'settings']:
|
|
1338
1341
|
del request[key]
|
|
1339
1342
|
|
|
1340
1343
|
test = request['test']
|
|
@@ -1406,6 +1409,14 @@ def restart(
|
|
|
1406
1409
|
for environment in request["environments"]:
|
|
1407
1410
|
environment["tmt"]["extra_args"]["finish"] = tmt_finish
|
|
1408
1411
|
|
|
1412
|
+
if cli_tmt_context:
|
|
1413
|
+
for environment in request["environments"]:
|
|
1414
|
+
environment["tmt"]["context"] = options_to_dict("tmt context", cli_tmt_context)
|
|
1415
|
+
|
|
1416
|
+
if variables:
|
|
1417
|
+
for environment in request["environments"]:
|
|
1418
|
+
environment["variables"] = options_to_dict("environment variables", variables)
|
|
1419
|
+
|
|
1409
1420
|
test_type = "fmf" if "fmf" in request["test"] else "sti"
|
|
1410
1421
|
|
|
1411
1422
|
if tmt_plan_name:
|
|
@@ -1630,7 +1641,7 @@ def run(
|
|
|
1630
1641
|
state = request["state"]
|
|
1631
1642
|
|
|
1632
1643
|
if state == current_state:
|
|
1633
|
-
time.sleep(
|
|
1644
|
+
time.sleep(settings.WATCH_TICK)
|
|
1634
1645
|
continue
|
|
1635
1646
|
|
|
1636
1647
|
current_state = state
|
|
@@ -1642,7 +1653,7 @@ def run(
|
|
|
1642
1653
|
progress.stop()
|
|
1643
1654
|
exit_error("Request canceled.")
|
|
1644
1655
|
|
|
1645
|
-
time.sleep(
|
|
1656
|
+
time.sleep(settings.WATCH_TICK)
|
|
1646
1657
|
|
|
1647
1658
|
# workaround TFT-1690
|
|
1648
1659
|
install_http_retries(session, status_forcelist_extend=[404], timeout=60, retry_backoff_factor=0.1)
|
|
@@ -1933,7 +1944,7 @@ def reserve(
|
|
|
1933
1944
|
state = request["state"]
|
|
1934
1945
|
|
|
1935
1946
|
if state == current_state:
|
|
1936
|
-
time.sleep(
|
|
1947
|
+
time.sleep(settings.WATCH_TICK)
|
|
1937
1948
|
continue
|
|
1938
1949
|
|
|
1939
1950
|
current_state = state
|
|
@@ -1948,7 +1959,7 @@ def reserve(
|
|
|
1948
1959
|
if not print_only_request_id and task_id is not None:
|
|
1949
1960
|
progress.update(task_id, description=f"Reservation job is [yellow]{current_state}[/yellow]")
|
|
1950
1961
|
|
|
1951
|
-
time.sleep(
|
|
1962
|
+
time.sleep(settings.WATCH_TICK)
|
|
1952
1963
|
|
|
1953
1964
|
while current_state != "ready":
|
|
1954
1965
|
if not print_only_request_id and task_id:
|
|
@@ -2015,7 +2026,7 @@ def reserve(
|
|
|
2015
2026
|
current_state = "ready"
|
|
2016
2027
|
guest = search.group(1)
|
|
2017
2028
|
|
|
2018
|
-
time.sleep(
|
|
2029
|
+
time.sleep(settings.WATCH_TICK)
|
|
2019
2030
|
|
|
2020
2031
|
console.print(f"🌎 ssh root@{guest}")
|
|
2021
2032
|
|
|
@@ -12,9 +12,9 @@ settings = LazySettings(
|
|
|
12
12
|
API_TOKEN=None,
|
|
13
13
|
ISSUE_TRACKER="https://gitlab.com/testing-farm/general/-/issues/new",
|
|
14
14
|
STATUS_PAGE="https://status.testing-farm.io",
|
|
15
|
-
ONBOARDING_DOCS="https://docs.testing-farm.io/
|
|
15
|
+
ONBOARDING_DOCS="https://docs.testing-farm.io/Testing%20Farm/0.1/onboarding.html",
|
|
16
16
|
CONTAINER_SIGN="/.testing-farm-container",
|
|
17
|
-
WATCH_TICK=
|
|
17
|
+
WATCH_TICK=30,
|
|
18
18
|
DEFAULT_API_TIMEOUT=10,
|
|
19
19
|
DEFAULT_API_RETRIES=7,
|
|
20
20
|
# default reservation duration in minutes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|