faas-gitops 0.4.0__tar.gz → 0.4.1__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.
- {faas_gitops-0.4.0/src/faas_gitops.egg-info → faas_gitops-0.4.1}/PKG-INFO +1 -1
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/pyproject.toml +1 -1
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/cli/app.py +1 -1
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/render_definitions.py +4 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1/src/faas_gitops.egg-info}/PKG-INFO +1 -1
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_render_definitions.py +34 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/MANIFEST.in +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/setup.cfg +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/__init__.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/adapters/__init__.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/adapters/bizy_function_provider.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/adapters/bizy_template_provider.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/adapters/git_cli_gateway.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/cli/__init__.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/cli/parser.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/config.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/filtering.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/infra/__init__.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/infra/yaml_utils.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/layout.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/models.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/protocols/__init__.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/protocols/faas_function.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/protocols/faas_template.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/protocols/git_gateway.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/result.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/__init__.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/apply_function_changes.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/apply_plan.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/apply_template_changes.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/deploy_functions.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/detect_drift.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/detect_function_drift.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/detect_template_drift.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/plan.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/snapshot.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/sync_functions.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops/usecases/sync_templates.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops.egg-info/SOURCES.txt +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops.egg-info/dependency_links.txt +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops.egg-info/entry_points.txt +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops.egg-info/requires.txt +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/src/faas_gitops.egg-info/top_level.txt +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_apply_function_changes.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_apply_plan.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_apply_template_changes.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_deploy_functions.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_detect_drift.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_detect_function_drift.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_git_cli_gateway.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_plan.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_result_contract.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_scope_args.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_snapshot.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_sync_functions.py +0 -0
- {faas_gitops-0.4.0 → faas_gitops-0.4.1}/tests/test_sync_templates.py +0 -0
|
@@ -133,7 +133,7 @@ async def async_main() -> int:
|
|
|
133
133
|
tpl_provider = BizyTemplateProvider(faas)
|
|
134
134
|
git = _make_git()
|
|
135
135
|
repo_path = await git.clone_repo(repo_slug)
|
|
136
|
-
n = await render_definitions(tpl_provider, repo_path, branch=args.branch, git=git, max_workers=settings.max_workers)
|
|
136
|
+
n = await render_definitions(tpl_provider, repo_path, branch=args.branch, git=git, max_workers=settings.max_workers, scope=settings)
|
|
137
137
|
logger.info(f"render-definitions: {n} file(s) written")
|
|
138
138
|
return 0
|
|
139
139
|
|
|
@@ -9,6 +9,7 @@ import yaml
|
|
|
9
9
|
from loguru import logger
|
|
10
10
|
from tqdm.asyncio import tqdm_asyncio
|
|
11
11
|
|
|
12
|
+
from faas_gitops.config import Settings
|
|
12
13
|
from faas_gitops.infra.yaml_utils import dump_faas_yaml, load_yaml
|
|
13
14
|
from faas_gitops.layout import FUNCTION_BASE, FUNCTION_DEFINITION, FUNCTION_DIR, FUNCTION_RENDERED, TEMPLATE_DIR
|
|
14
15
|
from faas_gitops.protocols.faas_template import FaaSTemplateProvider
|
|
@@ -73,6 +74,7 @@ async def render_definitions(
|
|
|
73
74
|
branch: str,
|
|
74
75
|
git: GitWriter,
|
|
75
76
|
max_workers: int = 16,
|
|
77
|
+
scope: Settings | None = None,
|
|
76
78
|
) -> int:
|
|
77
79
|
assert branch is not None
|
|
78
80
|
await git.prepare_branch(repo_path=repo_path, branch=branch, force=False)
|
|
@@ -80,6 +82,8 @@ async def render_definitions(
|
|
|
80
82
|
|
|
81
83
|
func_dir = repo_path / FUNCTION_DIR
|
|
82
84
|
dirs = _function_dirs(func_dir)
|
|
85
|
+
if scope is not None and scope.scoped_functions:
|
|
86
|
+
dirs = [d for d in dirs if d.name in scope.scoped_functions]
|
|
83
87
|
sem = asyncio.Semaphore(max_workers)
|
|
84
88
|
|
|
85
89
|
with _quiet_logger():
|
|
@@ -6,6 +6,7 @@ from unittest.mock import AsyncMock, MagicMock, call
|
|
|
6
6
|
|
|
7
7
|
import pytest
|
|
8
8
|
|
|
9
|
+
from faas_gitops.config import Settings
|
|
9
10
|
from faas_gitops.infra.yaml_utils import dump_faas_yaml
|
|
10
11
|
from faas_gitops.usecases.render_definitions import render_definitions
|
|
11
12
|
|
|
@@ -113,3 +114,36 @@ class TestRenderDefinitions:
|
|
|
113
114
|
git = _make_git()
|
|
114
115
|
n = await render_definitions(provider, tmp_path, branch="sync/faas-templates", git=git)
|
|
115
116
|
assert n == 0
|
|
117
|
+
|
|
118
|
+
@pytest.mark.asyncio
|
|
119
|
+
async def test_scope_renders_only_matching_function(self, tmp_path: Path) -> None:
|
|
120
|
+
_setup_repo(tmp_path) # fn1
|
|
121
|
+
func_dir = tmp_path / "functions" / "fn2"
|
|
122
|
+
func_dir.mkdir(parents=True)
|
|
123
|
+
(func_dir / "meta.yaml").write_text("functionName: f2\ntags: []\n")
|
|
124
|
+
(func_dir / "base.yaml").write_text("templateName: org/tpl\n")
|
|
125
|
+
(func_dir / "definition.yaml").write_text("key: other\n")
|
|
126
|
+
provider = _make_provider()
|
|
127
|
+
git = _make_git()
|
|
128
|
+
n = await render_definitions(
|
|
129
|
+
provider, tmp_path, branch="main", git=git,
|
|
130
|
+
scope=Settings(scoped_functions={"fn1"}),
|
|
131
|
+
)
|
|
132
|
+
assert n == 1
|
|
133
|
+
assert (tmp_path / "functions" / "fn1" / "rendered.yaml").exists()
|
|
134
|
+
assert not (tmp_path / "functions" / "fn2" / "rendered.yaml").exists()
|
|
135
|
+
|
|
136
|
+
@pytest.mark.asyncio
|
|
137
|
+
async def test_scope_none_renders_all(self, tmp_path: Path) -> None:
|
|
138
|
+
_setup_repo(tmp_path) # fn1
|
|
139
|
+
func_dir = tmp_path / "functions" / "fn2"
|
|
140
|
+
func_dir.mkdir(parents=True)
|
|
141
|
+
(func_dir / "meta.yaml").write_text("functionName: f2\ntags: []\n")
|
|
142
|
+
(func_dir / "base.yaml").write_text("templateName: org/tpl\n")
|
|
143
|
+
(func_dir / "definition.yaml").write_text("key: other\n")
|
|
144
|
+
provider = _make_provider()
|
|
145
|
+
git = _make_git()
|
|
146
|
+
n = await render_definitions(
|
|
147
|
+
provider, tmp_path, branch="main", git=git, scope=Settings(),
|
|
148
|
+
)
|
|
149
|
+
assert n == 2
|
|
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
|
|
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
|