feat(roles): pull custom roles from inventory-declared sources

An inventory group web-app-cst-<name> with applications.<id>.custom: true and
a pinned source {url, version, path} is pulled into roles/ before the play,
read raw (Jinja, Ansible tags and credential URLs refused), placed through a
staging directory under an exclusive lock, and owned by a marker that names
its own directory, so a pull or roles-clean never replaces or removes a
directory it did not place and a failed pull leaves roles/ as it was.
Directory inventories, host lists and non-UTF-8 files behave as Ansible
reads them; generated test deploys pass --skip-pull. make roles-pull,
roles-clean and roles list, INFINITO_EXTRA_MOUNTS for local sources, the
web-app-cst category, the reserved prefix lint and a central
repository_files() that also yields the gitignored custom roles let every
lint scan them like in-tree roles. Supersedes the uncommitted 045 External
Roles draft and reuses its fetch, sync and mount design.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-29 00:02:58 +01:00
1 parent cb4d340de9
commit d92375922d
101 files changed
+3731 -248

No files matched your search

@@ -82,6 +82,35 @@ class TestEnsureImage(unittest.TestCase):
)
class TestRunInContainer(unittest.TestCase):
@unittest.mock.patch("subprocess.run")
@unittest.mock.patch(
"cli.administration.deploy.container.command.docker_exec",
return_value=subprocess.CompletedProcess(args=[], returncode=0),
)
@unittest.mock.patch(
"cli.administration.deploy.container.command.start_ci_container",
return_value="infinito-ci-test",
)
def test_generated_inventory_keeps_the_placed_custom_roles(
self, _start, mock_docker_exec, _run
):
deploy_container.run_in_container(
image="infinito:latest",
build=False,
rebuild=False,
no_cache=False,
inventory_dir="/tmp/inventory",
inventory_args=[],
deploy_args=["--debug"],
)
deploy_cmd = mock_docker_exec.call_args_list[-1].args[1]
self.assertIn("cli.administration.deploy.dedicated", deploy_cmd)
self.assertIn("--skip-pull", deploy_cmd)
self.assertEqual("--debug", deploy_cmd[-1])
class TestMain(unittest.TestCase):
@unittest.mock.patch("cli.administration.deploy.container.command.run_in_container")
def test_main_requires_forwarded_args(self, mock_run_in_container):