Molecule и Docker-тесты: vendored create playbook и явная платформа образа
- Добавлен molecule docker create playbook (create.yml + tasks/create_network.yml) с правкой tmpfs: словарь из molecule-plugins приводится к списку строк для community.docker.docker_container; сценарии копируют playbook и задают provisioner.playbooks.create. - Для systemd-платформ tmpfs задаётся списком строк вместо mounts. - В опциях ОС — run_platform (каноническая архитектура после build); в TestHostSpec и hosts теста передаётся platform в molecule/docker_container, чтобы на ARM не падал /sbin/init из-за amd64 без --platform. - Страницы роли (просмотр и создание): одна dashboard-карточка на всю ширину, вкладки Role details / Role file catalog в
This commit is contained in:
@@ -73,6 +73,19 @@ DOCKERFILES_ROOT = Path(__file__).resolve().parents[2] / "dockerfiles"
|
||||
BUILDX_BUILDER_NAME = "roleforge-builder"
|
||||
|
||||
|
||||
def _run_platform_for_os_image(platform: str, build_platforms: str) -> str:
|
||||
"""Architectural platform for `docker run --platform` / molecule docker_container.platform.
|
||||
|
||||
Matches the canonical single-arch tag produced by build-all (first matrix entry when build allows multi-arch).
|
||||
Without this on Apple Silicon, an amd64-only layer triggers exec format error on /sbin/init.
|
||||
"""
|
||||
p = str(platform or "").strip()
|
||||
if p:
|
||||
return p
|
||||
parts = [x.strip() for x in str(build_platforms or "").split(",") if x.strip()]
|
||||
return parts[0] if parts else "linux/amd64"
|
||||
|
||||
|
||||
def _scan_os_options() -> list[dict[str, str]]:
|
||||
items: list[dict[str, str]] = []
|
||||
root = DOCKERFILES_ROOT
|
||||
@@ -94,6 +107,7 @@ def _scan_os_options() -> list[dict[str, str]]:
|
||||
else:
|
||||
platform = ""
|
||||
build_platforms = "linux/amd64,linux/arm64"
|
||||
run_platform = _run_platform_for_os_image(platform, build_platforms)
|
||||
items.append(
|
||||
{
|
||||
"id": f"{os_key}:{variant or 'default'}",
|
||||
@@ -104,6 +118,7 @@ def _scan_os_options() -> list[dict[str, str]]:
|
||||
"systemd": "true",
|
||||
"platform": platform,
|
||||
"build_platforms": build_platforms,
|
||||
"run_platform": run_platform,
|
||||
}
|
||||
)
|
||||
return items
|
||||
|
||||
Reference in New Issue
Block a user