fix(chv-muse-r12fix-2): P6 worker 接进镜像(build.sh + BUILDINFO + lockfile)
R12 真机:chv-gitea-worker / chv-sync-worker-client / privsep.py / safety.py / chv-gitea-worker.service 5 文件全不在 镜像内,build.sh 从未有 P6 拷入行,全链路无法跑。按 gap 文档 §2 接入说明落地:worker 三件硬校验 + 拷入 /usr/local/bin/ 与 /etc/systemd/system/(mv 去后缀 + chmod +x + systemctl enable);privsep/safety 叶子模块条件拷入 /usr/local/lib/chv-gitea/(与 P3 同款口径,缺失只警告); 叶子树 __init__ 用 stub(绝不拷真实 cloud/chv/__init__.py, round-11 层 1 教训),stub 需 errors.py 故一并拷入;runcmd 在 chv-sync boot 前加 systemctl start chv-gitea-worker。 BUILDINFO contents 列入 worker 三件(无条件)与 privsep/ safety(条件,extra_contents);两处 lockfile 登记补齐 P6 五项,另补 P4 三件自 P4 起缺失的登记。
This commit is contained in:
1 parent
b923d0291b
commit
33ca6c75ed
7 files changed
+125
-5
No files matched your search
@@ -629,7 +629,11 @@ class BuildDryRunTest(unittest.TestCase):
|
||||
# round-12 P4:build.sh 缺一即 fail-fast,夹具
|
||||
# 须一并拷入(合入时补:R11 夹具本无此四件)。
|
||||
"chv-cdp-broker.py", "chv_browser_guard.py",
|
||||
"browser-blocklist.txt", "chv-memory.py"):
|
||||
"browser-blocklist.txt", "chv-memory.py",
|
||||
# round-12 修复轮(项 2,P6):worker 三件亦
|
||||
# 是 build.sh 硬校验,夹具须一并拷入。
|
||||
"chv-gitea-worker.py", "chv-sync-worker-client.py",
|
||||
"chv-gitea-worker.service"):
|
||||
shutil.copy2(ROOT / "chv-guest" / name,
|
||||
os.path.join(guest, name))
|
||||
shutil.copy2(ROOT / "host.py", os.path.join(repo, "host.py"))
|
||||
@@ -700,7 +704,12 @@ class BuildDryRunTest(unittest.TestCase):
|
||||
# round-11 真机修复(层 1):叶子树含
|
||||
# errors.py + stub __init__,不拷真实的
|
||||
# cloud/chv/__init__.py。
|
||||
"errors.py", "authd_init_stub.py"):
|
||||
"errors.py", "authd_init_stub.py",
|
||||
# round-12 修复轮(项 2,P6):worker
|
||||
# 三件进镜像,干跑输出须含拷入与 enable。
|
||||
"chv-gitea-worker",
|
||||
"chv-gitea-worker.service",
|
||||
"systemctl enable chv-gitea-worker"):
|
||||
self.assertIn(needle, out, needle)
|
||||
# P1 文件不在本分支:干跑只警告、不失败。
|
||||
self.assertIn("vsock_notify.py 不在仓库里", out)
|
||||
|
||||
@@ -802,7 +802,12 @@ class BuildDryRunTest(unittest.TestCase):
|
||||
# 合入 round-11 时补:build.sh 的 P3 预检硬要求
|
||||
# authd_init_stub.py 在仓(缺一即 exit 1)。
|
||||
"chv-authd.service", "authd_init_stub.py",
|
||||
"chv-memory.py"):
|
||||
"chv-memory.py",
|
||||
# round-12 修复轮(项 2,P6):worker 三件亦
|
||||
# 是 build.sh 硬校验,夹具须一并拷入。
|
||||
"chv-gitea-worker.py",
|
||||
"chv-sync-worker-client.py",
|
||||
"chv-gitea-worker.service"):
|
||||
shutil.copy2(ROOT / "chv-guest" / name,
|
||||
os.path.join(guest, name))
|
||||
shutil.copy2(ROOT / "host.py", os.path.join(repo, "host.py"))
|
||||
@@ -852,7 +857,12 @@ class BuildDryRunTest(unittest.TestCase):
|
||||
"chv-cdp-broker.service",
|
||||
"systemctl enable chv-broker chv-browser "
|
||||
"chv-cdp-broker",
|
||||
"ask-queue"):
|
||||
"ask-queue",
|
||||
# round-12 修复轮(项 2,P6):worker
|
||||
# 三件进镜像,干跑输出须含拷入与 enable。
|
||||
"chv-gitea-worker",
|
||||
"chv-gitea-worker.service",
|
||||
"systemctl enable chv-gitea-worker"):
|
||||
self.assertIn(needle, out, needle)
|
||||
# P1 文件不在本分支:干跑只警告、不失败。
|
||||
self.assertIn("vsock_notify.py 不在仓库里", out)
|
||||
|
||||
@@ -756,5 +756,39 @@ class ExecutorAuditHookTest(unittest.TestCase):
|
||||
safety_mod.DEFAULT_AUDIT_LOGGER = old
|
||||
|
||||
|
||||
class BuildInfoContentsTest(unittest.TestCase):
|
||||
"""round-12 修复轮(项 2,P6):worker 三件须进 BUILDINFO
|
||||
contents(无条件拷入,与 P2/P4 同款钉法)。"""
|
||||
|
||||
def test_contents_include_p6_items(self):
|
||||
root = Path(__file__).resolve().parents[2]
|
||||
path = root / "chv-guest" / "buildinfo.py"
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"chv_guest_p6_buildinfo", str(path))
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
out = os.path.join(tmp, "out")
|
||||
os.makedirs(out)
|
||||
for name, content in (("disk.raw", b"D"),
|
||||
("vmlinux", b"K")):
|
||||
with open(os.path.join(out, name), "wb") as fh:
|
||||
fh.write(content)
|
||||
for name, lines in (
|
||||
("guest-versions-dpkg.txt", ["git 9.9.9-9ubuntu9"]),
|
||||
("guest-versions-pip.txt", ["playwright==9.9.9"]),
|
||||
("guest-versions-gt.txt", ["gt version 1.0.0"]),
|
||||
("guest-versions-chromium.txt",
|
||||
["chromium_headless_shell-1248"])):
|
||||
with open(os.path.join(out, name), "w") as fh:
|
||||
fh.write("\n".join(lines) + "\n")
|
||||
info = module.build(
|
||||
out, "chv-guest-24.04-0.164.0-alpha.9-abc1234", "24.04",
|
||||
"0.164.0-alpha.9", "abc1234", "0" * 64, True, "1248")
|
||||
for item in ("chv-gitea-worker", "chv-sync-worker-client",
|
||||
"chv-gitea-worker.service"):
|
||||
self.assertIn(item, info["contents"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user