uber-compose 3.0.0a25__tar.gz → 3.1.0__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.
- {uber_compose-3.0.0a25/uber_compose.egg-info → uber_compose-3.1.0}/PKG-INFO +3 -1
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/PARALLELISM.md +33 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/requirements.txt +2 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/__init__.py +4 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/constants.py +8 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/system_docker_compose.py +5 -1
- uber_compose-3.1.0/uber_compose/helpers/live_env.py +93 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/uber_compose.py +43 -0
- uber_compose-3.1.0/uber_compose/utils/search_docker_compose_files.py +25 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/__init__.py +1 -3
- uber_compose-3.1.0/uber_compose/version +1 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0/uber_compose.egg-info}/PKG-INFO +3 -1
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose.egg-info/SOURCES.txt +1 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose.egg-info/requires.txt +2 -0
- uber_compose-3.0.0a25/uber_compose/utils/search_docker_compose_files.py +0 -17
- uber_compose-3.0.0a25/uber_compose/version +0 -1
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/LICENSE +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/MANIFEST.in +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/README.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/CLI_USAGE.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/E2E_CONTAINER_SETUP.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/ENV_LOCKS_FEATURE_REQUEST.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/EXEC_STRATEGIES.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/HOOKS.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/LLM_RULES.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/PLAN_CONSISTENCY.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/README.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/RELEASE_TAGS.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/UBER_COMPOSE_VEDRO_CONFIG.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/X_MIGRATION.md +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/docs/common.puml +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/setup.cfg +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/setup.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/docker_compose.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/docker_compose_shell/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/docker_compose_shell/exec_strategies.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/docker_compose_shell/interface.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/docker_compose_shell/types.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/sequence_run_types.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/utils/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/utils/compose_files.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/utils/compose_instance_cfg.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/utils/env_files.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/utils/process_command_output.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/utils/shell_process.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/utils/state_waiting.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/env_description/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/env_description/env_tools.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/env_description/env_types.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/errors/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/errors/migrations.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/errors/mounted_files.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/errors/up.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/broken_services.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/bytes_pickle.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/countdown_counter.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/current_env.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/env_id.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/exec_record.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/exec_result.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/health_policy.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/hooks.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/jobs_result.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/labels.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/parameterization.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/singleton.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/state_keeper.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/helpers/workers_per_env.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/output/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/output/console.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/output/styles.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/details.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/grouper.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/grouping.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/planner.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/plugin.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/runner.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/types.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/worker_api.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/parallel_plugin/worker_filter.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/utils/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/utils/docker_compose_files_path.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/utils/docker_compose_service_deps.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/utils/services_construction.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/base_structures/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/base_structures/common_json_cli.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/helpers/__init__.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/helpers/scenario_ordering.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/helpers/scenario_tag_processing.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/helpers/test_env_vars_setter.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/plugin.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/version.py +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose.egg-info/dependency_links.txt +0 -0
- {uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uber-compose
|
|
3
|
-
Version: 3.0
|
|
3
|
+
Version: 3.1.0
|
|
4
4
|
Summary: docker compose testing env orchestrator
|
|
5
5
|
Home-page: https://github.com/ko10ok/uber-compose
|
|
6
6
|
Author: Yuriy Sagitov
|
|
@@ -16,6 +16,8 @@ Requires-Python: >=3.10.0
|
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: vedro<2.0,>=1.15
|
|
19
|
+
Requires-Dist: cabina<2.0,>=1.1.2
|
|
20
|
+
Requires-Dist: niltype<2.0,>=1.0.2
|
|
19
21
|
Requires-Dist: PyYAML<6.1,>=6.0.1
|
|
20
22
|
Requires-Dist: rtry<2.0,>=1.4.0
|
|
21
23
|
Requires-Dist: rich<16.0,>=11.0
|
|
@@ -511,6 +511,39 @@ cassandra:
|
|
|
511
511
|
host: "[[cassandra]]"
|
|
512
512
|
```
|
|
513
513
|
|
|
514
|
+
## Live config values
|
|
515
|
+
|
|
516
|
+
Config values are resolved once, at import time — before the current env is
|
|
517
|
+
known. `live_env` (based on Cabina's `LazyEnvironment` / `FutureValue`) resolves
|
|
518
|
+
them on every access instead:
|
|
519
|
+
|
|
520
|
+
```python
|
|
521
|
+
import cabina
|
|
522
|
+
|
|
523
|
+
from uber_compose import live_env
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
class Config(cabina.Config, cabina.Section):
|
|
527
|
+
class Database(cabina.Section):
|
|
528
|
+
dsn: str = live_env.literal("postgres://db-[[namespace]]:5432/app")
|
|
529
|
+
|
|
530
|
+
class Api(cabina.Section):
|
|
531
|
+
url: str = live_env.raw("API_URL")
|
|
532
|
+
port: int = live_env.int("API_PORT")
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
Values are read through the sections, e.g. `Config.Api.port`.
|
|
536
|
+
|
|
537
|
+
- `raw` / `str` / `int` and other Cabina accessors read an env var;
|
|
538
|
+
- `literal` substitutes placeholders in an explicit value;
|
|
539
|
+
- placeholders are taken from the current env context (env id, namespace, worker
|
|
540
|
+
id, run id, service names) on every read, without caching.
|
|
541
|
+
|
|
542
|
+
Supported placeholders are the same as for `Service.env`: `[[env_id]]`,
|
|
543
|
+
`[[namespace]]`, `[[worker_id]]`, `[[worker_id_alpha_numeric]]`,
|
|
544
|
+
`[[namespace_alpha_numeric]]`, `[[worker_id_alpha_numeric_6]]`,
|
|
545
|
+
`[[namespace_alpha_numeric_6]]`, `[[test_run_id]]`, and `[[<service>]]`.
|
|
546
|
+
|
|
514
547
|
## Reporting details
|
|
515
548
|
|
|
516
549
|
Workers emit JSON events that the parent turns back into regular vedro events,
|
|
@@ -19,6 +19,9 @@ from uber_compose.helpers.exec_result import ExecResult
|
|
|
19
19
|
from uber_compose.helpers.exec_result import ExecTimeout
|
|
20
20
|
from uber_compose.helpers.health_policy import UpHealthPolicy
|
|
21
21
|
from uber_compose.helpers.hooks import UberComposeEvent
|
|
22
|
+
from uber_compose.helpers.live_env import LiveEnvironment
|
|
23
|
+
from uber_compose.helpers.live_env import LiveValue
|
|
24
|
+
from uber_compose.helpers.live_env import live_env
|
|
22
25
|
from uber_compose.output.console import LogEvents
|
|
23
26
|
from uber_compose.output.console import LogPolicy
|
|
24
27
|
from uber_compose.output.console import LogPolicySet
|
|
@@ -63,4 +66,5 @@ __all__ = (
|
|
|
63
66
|
'get_run_depth', 'is_child_project',
|
|
64
67
|
'is_parallel_worker', 'is_parallel_worker_process', 'reset_execution_plan', 'set_execution_plan',
|
|
65
68
|
'VedroUberComposeParallel', 'build_execution_plan', 'build_execution_plan_from_scheduler',
|
|
69
|
+
'LiveEnvironment', 'LiveValue', 'live_env',
|
|
66
70
|
)
|
|
@@ -30,9 +30,13 @@ def cleanup_log_files(log_file_path: str | Path, limit: int,
|
|
|
30
30
|
file.unlink(missing_ok=True)
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
DEFAULT_DOCKER_COMPOSE_FILES_AUTO_SCAN_PATTERN = r'(?:.*/)?docker-compose[^/]*\.(yaml|yml)$'
|
|
34
|
+
|
|
35
|
+
|
|
33
36
|
class Constants:
|
|
34
37
|
def __init__(self,
|
|
35
38
|
docker_compose_files_scan_depth: int = 2,
|
|
39
|
+
docker_compose_files_auto_scan_pattern: str = DEFAULT_DOCKER_COMPOSE_FILES_AUTO_SCAN_PATTERN,
|
|
36
40
|
cli_compose_util_override: str = None,
|
|
37
41
|
compose_project_name: str = None,
|
|
38
42
|
tmp_envs_path: str | Path = None,
|
|
@@ -103,6 +107,10 @@ class Constants:
|
|
|
103
107
|
self.docker_compose_files_scan_depth: int = int(
|
|
104
108
|
os.environ.get('DOCKER_COMPOSE_FILES_SCAN_DEPTH', docker_compose_files_scan_depth)
|
|
105
109
|
)
|
|
110
|
+
self.docker_compose_files_auto_scan_pattern: str = os.environ.get(
|
|
111
|
+
'DOCKER_COMPOSE_FILES_AUTO_SCAN_PATTERN',
|
|
112
|
+
docker_compose_files_auto_scan_pattern,
|
|
113
|
+
)
|
|
106
114
|
|
|
107
115
|
self.ignore_pidof_unexistance: bool = bool(os.environ.get('IGNORE_PIDOF_UNEXISTANCE', 'True') == 'True')
|
|
108
116
|
|
|
@@ -25,7 +25,11 @@ class SystemDockerCompose:
|
|
|
25
25
|
|
|
26
26
|
# TODO get path from Constants. Could be used in cases dc yaml not in root directory
|
|
27
27
|
self.default_compose_files = ':'.join(
|
|
28
|
-
scan_for_compose_files(
|
|
28
|
+
scan_for_compose_files(
|
|
29
|
+
inner_project_root,
|
|
30
|
+
self.cfg_constants.docker_compose_files_scan_depth,
|
|
31
|
+
self.cfg_constants.docker_compose_files_auto_scan_pattern,
|
|
32
|
+
)
|
|
29
33
|
)
|
|
30
34
|
self.logger.commands(f'All found compose files: {self.default_compose_files}')
|
|
31
35
|
assert self.default_compose_files, (
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Cabina-based live environment values resolved for the current uber-compose env."""
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
from typing import Callable
|
|
5
|
+
|
|
6
|
+
from cabina import FutureValue
|
|
7
|
+
from cabina import LazyEnvironment
|
|
8
|
+
from cabina.parsers import parse_as_is
|
|
9
|
+
from niltype import Nil
|
|
10
|
+
|
|
11
|
+
from uber_compose.core.sequence_run_types import DEFAULT_ENV_ID
|
|
12
|
+
from uber_compose.env_description.env_types import ServiceMode
|
|
13
|
+
from uber_compose.helpers.current_env import get_current_env_context
|
|
14
|
+
from uber_compose.helpers.parameterization import build_parameterization_placeholders
|
|
15
|
+
from uber_compose.helpers.parameterization import substitute_parameterization_placeholders
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def current_environment_placeholders() -> dict[str, str]:
|
|
19
|
+
"""Build parameterization placeholders for the environment of the current thread."""
|
|
20
|
+
context = get_current_env_context()
|
|
21
|
+
namespace = context.namespace or context.env_id
|
|
22
|
+
|
|
23
|
+
services_map = {}
|
|
24
|
+
if context.env is not None:
|
|
25
|
+
for service_name, service in context.env.get_services().items():
|
|
26
|
+
if service.mode == ServiceMode.OFF:
|
|
27
|
+
continue
|
|
28
|
+
if service.mode == ServiceMode.SINGLETON or namespace == DEFAULT_ENV_ID:
|
|
29
|
+
services_map[service_name] = service_name
|
|
30
|
+
else:
|
|
31
|
+
services_map[service_name] = f'{service_name}-{namespace}'
|
|
32
|
+
|
|
33
|
+
return build_parameterization_placeholders(
|
|
34
|
+
env_id=context.env_id,
|
|
35
|
+
services_map=services_map,
|
|
36
|
+
run_id=context.run_id,
|
|
37
|
+
worker_id=context.worker_id,
|
|
38
|
+
namespace=namespace,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def resolve_current_placeholders(value: Any) -> Any:
|
|
43
|
+
"""Replace ``[[...]]`` placeholders in a value using the current environment context."""
|
|
44
|
+
if not isinstance(value, str):
|
|
45
|
+
return value
|
|
46
|
+
return substitute_parameterization_placeholders(value, current_environment_placeholders())
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class LiveValue(FutureValue):
|
|
50
|
+
"""A future value that is resolved on every access instead of being cached."""
|
|
51
|
+
|
|
52
|
+
def get(self) -> Any:
|
|
53
|
+
return self._accessor(*self._args, **self._kwargs)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class LiveEnvironment(LazyEnvironment):
|
|
57
|
+
"""Environment accessor whose values are re-read and re-substituted on every access."""
|
|
58
|
+
|
|
59
|
+
def get(
|
|
60
|
+
self,
|
|
61
|
+
name: str,
|
|
62
|
+
default: Any = Nil,
|
|
63
|
+
parser: Callable[[str], Any] = parse_as_is,
|
|
64
|
+
) -> Any:
|
|
65
|
+
raw_name = f'{self._prefix}{name}'
|
|
66
|
+
if raw_name in self._environ:
|
|
67
|
+
value = self._environ[raw_name]
|
|
68
|
+
return parser(resolve_current_placeholders(value))
|
|
69
|
+
|
|
70
|
+
if default is Nil:
|
|
71
|
+
return super().get(name, default, parser)
|
|
72
|
+
return resolve_current_placeholders(default)
|
|
73
|
+
|
|
74
|
+
def raw(
|
|
75
|
+
self,
|
|
76
|
+
name: str,
|
|
77
|
+
default: Any = Nil,
|
|
78
|
+
parser: Callable[[str], Any] = parse_as_is,
|
|
79
|
+
) -> LiveValue:
|
|
80
|
+
return LiveValue(self.get, name, default=default, parser=parser)
|
|
81
|
+
|
|
82
|
+
def literal(self, value: Any) -> LiveValue:
|
|
83
|
+
"""Return a live value with placeholders substituted from the current environment."""
|
|
84
|
+
return LiveValue(resolve_current_placeholders, value)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
live_env = LiveEnvironment()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
__all__ = (
|
|
91
|
+
'LiveEnvironment', 'LiveValue', 'current_environment_placeholders', 'live_env',
|
|
92
|
+
'resolve_current_placeholders',
|
|
93
|
+
)
|
|
@@ -19,6 +19,7 @@ from uber_compose.core.docker_compose_shell.types import ExecLifeCyclePolicy
|
|
|
19
19
|
from uber_compose.core.docker_compose_shell.types import ServicesComposeState
|
|
20
20
|
from uber_compose.core.sequence_run_types import DEFAULT_ENV_ID
|
|
21
21
|
from uber_compose.core.system_docker_compose import SystemDockerCompose
|
|
22
|
+
from uber_compose.core.utils.compose_files import get_compose_services
|
|
22
23
|
from uber_compose.core.utils.compose_instance_cfg import get_new_env_id
|
|
23
24
|
from uber_compose.core.utils.compose_instance_cfg import get_stable_env_id
|
|
24
25
|
from uber_compose.core.utils.state_waiting import is_service_not_running_or_not_healthy
|
|
@@ -27,6 +28,7 @@ from uber_compose.env_description.env_types import Environment
|
|
|
27
28
|
from uber_compose.env_description.env_types import OverridenService
|
|
28
29
|
from uber_compose.env_description.env_types import ServiceMode
|
|
29
30
|
from uber_compose.errors.mounted_files import MountedFileNotFoundError
|
|
31
|
+
from uber_compose.errors.up import ServicesUpError
|
|
30
32
|
from uber_compose.errors.up import SingletonConfigChangedError
|
|
31
33
|
from uber_compose.helpers.broken_services import calc_broken_services
|
|
32
34
|
from uber_compose.helpers.bytes_pickle import base64_pickled
|
|
@@ -223,6 +225,17 @@ class SystemUberCompose:
|
|
|
223
225
|
config_template = self._resolve_config_template(config_template, compose_files, services_override)
|
|
224
226
|
|
|
225
227
|
requested_env_id = env_id if parallelism_limit > 1 else None
|
|
228
|
+
|
|
229
|
+
if not config_template.get_services():
|
|
230
|
+
self.logger.stage(Text(
|
|
231
|
+
'Environment has no services. Nothing to start.', style=Style.suspicious
|
|
232
|
+
))
|
|
233
|
+
return ReadyEnv(
|
|
234
|
+
requested_env_id or DEFAULT_ENV_ID,
|
|
235
|
+
config_template,
|
|
236
|
+
release_id or self.last_release_id or str(uuid4()),
|
|
237
|
+
)
|
|
238
|
+
|
|
226
239
|
services_state = await self._get_current_state(config_template, compose_files)
|
|
227
240
|
if requested_env_id is not None:
|
|
228
241
|
services_state = services_state.get_all_for(
|
|
@@ -242,6 +255,8 @@ class SystemUberCompose:
|
|
|
242
255
|
await self._hooks.run(UberComposeEvent.AFTER_UP)
|
|
243
256
|
return reusable_env
|
|
244
257
|
|
|
258
|
+
self._validate_env_services_against_compose_files(config_template, compose_files)
|
|
259
|
+
|
|
245
260
|
self._log_inflight_and_restart_info(services_state, force_restart)
|
|
246
261
|
|
|
247
262
|
_for = f' {config_template.description}' if config_template.description else ''
|
|
@@ -380,6 +395,34 @@ class SystemUberCompose:
|
|
|
380
395
|
|
|
381
396
|
return config_template
|
|
382
397
|
|
|
398
|
+
def _validate_env_services_against_compose_files(
|
|
399
|
+
self,
|
|
400
|
+
config_template: Environment,
|
|
401
|
+
compose_files: str,
|
|
402
|
+
) -> None:
|
|
403
|
+
compose_services = set(get_compose_services(
|
|
404
|
+
get_absolute_compose_files(
|
|
405
|
+
compose_files,
|
|
406
|
+
self.cfg_constants.in_docker_project_root_path,
|
|
407
|
+
)
|
|
408
|
+
))
|
|
409
|
+
ignored_services = set(config_template.get_overridden_services_names())
|
|
410
|
+
ignored_services |= {
|
|
411
|
+
service_name
|
|
412
|
+
for service_name, service in config_template.get_services().items()
|
|
413
|
+
if service.mode == ServiceMode.OFF
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
missing_services = sorted(
|
|
417
|
+
set(config_template.get_services_names()) - compose_services - ignored_services
|
|
418
|
+
)
|
|
419
|
+
if missing_services:
|
|
420
|
+
raise ServicesUpError(
|
|
421
|
+
f'Environment declares services missing in docker-compose files {compose_files!r}: '
|
|
422
|
+
f'{missing_services}. '
|
|
423
|
+
f'Define them in compose files, override them, or remove them from the environment.'
|
|
424
|
+
)
|
|
425
|
+
|
|
383
426
|
async def _get_current_state(self, config_template: Environment, compose_files: str) -> ServicesComposeState:
|
|
384
427
|
self.logger.stage_debug(
|
|
385
428
|
f'Searching for environment {config_template} with template: {base64_pickled(config_template)}'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
from uber_compose.core.constants import DEFAULT_DOCKER_COMPOSE_FILES_AUTO_SCAN_PATTERN
|
|
6
|
+
from uber_compose.core.utils.compose_files import read_dc_file
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def scan_for_compose_files(
|
|
10
|
+
path: Path,
|
|
11
|
+
dc_files_scan_depth: int = 1,
|
|
12
|
+
files_pattern: str = DEFAULT_DOCKER_COMPOSE_FILES_AUTO_SCAN_PATTERN,
|
|
13
|
+
) -> list[str]:
|
|
14
|
+
# TODO exclude paths with ENV
|
|
15
|
+
compose_files = []
|
|
16
|
+
for root, dirs, files in os.walk(path):
|
|
17
|
+
if root.startswith(str(path)) and root.count('/') - str(path).count('/') < dc_files_scan_depth:
|
|
18
|
+
for file in files:
|
|
19
|
+
relative_path = str(Path(root) / file)[len(str(path)) + 1:]
|
|
20
|
+
if not re.fullmatch(files_pattern, relative_path):
|
|
21
|
+
continue
|
|
22
|
+
dc_file = read_dc_file(Path(root) / file)
|
|
23
|
+
if 'services' in dc_file:
|
|
24
|
+
compose_files.append(relative_path)
|
|
25
|
+
return list(sorted(compose_files))
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
Vedro plugin integration for uber-compose.
|
|
3
3
|
|
|
4
4
|
Enabled plugin (in vedro.cfg) catches stage before tests run (StartupEvent) and before each test run (ScenarioRunEvent).
|
|
5
5
|
|
|
6
6
|
On each stage it starts testing environment required by selected tests.
|
|
7
|
-
|
|
8
|
-
Plugin communicate with maxwelld service container via http client - maxwelld/client
|
|
9
7
|
"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.1.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uber-compose
|
|
3
|
-
Version: 3.0
|
|
3
|
+
Version: 3.1.0
|
|
4
4
|
Summary: docker compose testing env orchestrator
|
|
5
5
|
Home-page: https://github.com/ko10ok/uber-compose
|
|
6
6
|
Author: Yuriy Sagitov
|
|
@@ -16,6 +16,8 @@ Requires-Python: >=3.10.0
|
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: vedro<2.0,>=1.15
|
|
19
|
+
Requires-Dist: cabina<2.0,>=1.1.2
|
|
20
|
+
Requires-Dist: niltype<2.0,>=1.0.2
|
|
19
21
|
Requires-Dist: PyYAML<6.1,>=6.0.1
|
|
20
22
|
Requires-Dist: rtry<2.0,>=1.4.0
|
|
21
23
|
Requires-Dist: rich<16.0,>=11.0
|
|
@@ -61,6 +61,7 @@ uber_compose/helpers/health_policy.py
|
|
|
61
61
|
uber_compose/helpers/hooks.py
|
|
62
62
|
uber_compose/helpers/jobs_result.py
|
|
63
63
|
uber_compose/helpers/labels.py
|
|
64
|
+
uber_compose/helpers/live_env.py
|
|
64
65
|
uber_compose/helpers/parameterization.py
|
|
65
66
|
uber_compose/helpers/singleton.py
|
|
66
67
|
uber_compose/helpers/state_keeper.py
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
from uber_compose.core.utils.compose_files import read_dc_file
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def scan_for_compose_files(path: Path, dc_files_scan_depth: int = 1) -> list[str]:
|
|
8
|
-
# TODO exclude paths with ENV
|
|
9
|
-
compose_files = []
|
|
10
|
-
for root, dirs, files in os.walk(path):
|
|
11
|
-
if root.startswith(str(path)) and root.count('/') - str(path).count('/') < dc_files_scan_depth:
|
|
12
|
-
for file in files:
|
|
13
|
-
if file.endswith('.yml') or file.endswith('.yaml'):
|
|
14
|
-
dc_file = read_dc_file(Path(root) / file)
|
|
15
|
-
if 'services' in dc_file:
|
|
16
|
-
compose_files.append(str(Path(root) / file)[len(str(path)) + 1:])
|
|
17
|
-
return list(sorted(compose_files))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.0.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/docker_compose_shell/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/docker_compose_shell/interface.py
RENAMED
|
File without changes
|
{uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/docker_compose_shell/types.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/utils/compose_instance_cfg.py
RENAMED
|
File without changes
|
|
File without changes
|
{uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/core/utils/process_command_output.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/utils/docker_compose_files_path.py
RENAMED
|
File without changes
|
{uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/utils/docker_compose_service_deps.py
RENAMED
|
File without changes
|
|
File without changes
|
{uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/base_structures/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{uber_compose-3.0.0a25 → uber_compose-3.1.0}/uber_compose/vedro_plugin/helpers/scenario_ordering.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|