core: publish self-hosted weekly dashboard and Proxmox deployment #20

Merged
schmidt.florian merged 7 commits from 19-web-dashboard into master 2026-11-15 11:24:57 +01:00
3 changed files with 58 additions and 1 deletions
Showing only changes of commit e1488243e1 - Show all commits
+5
View File
@@ -232,6 +232,11 @@ of configuration/keys, partial setup, stopped services and activation rollback.
a real Proxmox create/update, Linux build, certificate issuance or provider login. No Proxmox a real Proxmox create/update, Linux build, certificate issuance or provider login. No Proxmox
host/container was changed while developing this script. host/container was changed while developing this script.
One installer regression uses real Node.js/npm with an offline synthetic package to check the
configured Codex launcher and repeat installation. It skips explicitly when Node.js/npm are
unavailable. On Windows its fixture adapts npm's global-prefix layout to the guest's Linux `bin`
path; that checks npm install mode and actual files without claiming Linux execution.
Updater tests use real local Git repositories and Bash with a synthetic installer. They verify Updater tests use real local Git repositories and Bash with a synthetic installer. They verify
two-version fast-forward deployment, no-change retry, dirty/diverged/ahead/detached refusal, two-version fast-forward deployment, no-change retry, dirty/diverged/ahead/detached refusal,
fetch failure, dry-run, exit status, ignored-state retention and ignored-file collisions. Advisory lock command results fetch failure, dry-run, exit status, ignored-state retention and ignored-file collisions. Advisory lock command results
+1 -1
View File
@@ -121,7 +121,7 @@ def official_clis(providers):
script.chmod(0o644) script.chmod(0o644)
as_user("finaltoken", WORKER_HOME, ["bash", str(script), "stable"]) as_user("finaltoken", WORKER_HOME, ["bash", str(script), "stable"])
if "codex" in providers and not (WORKER_HOME / ".local/bin/codex").exists(): if "codex" in providers and not (WORKER_HOME / ".local/bin/codex").exists():
as_user("finaltoken", WORKER_HOME, ["npm", "install", "--prefix", str(WORKER_HOME / ".local"), "@openai/codex@latest"]) as_user("finaltoken", WORKER_HOME, ["npm", "install", "--global", "--prefix", str(WORKER_HOME / ".local"), "@openai/codex@latest"])
for provider in providers: for provider in providers:
as_user("finaltoken", WORKER_HOME, [str(WORKER_HOME / ".local/bin" / provider), "--version"]) as_user("finaltoken", WORKER_HOME, [str(WORKER_HOME / ".local/bin" / provider), "--version"])
+52
View File
@@ -6,6 +6,7 @@ import io
import json import json
import os import os
from pathlib import Path, PurePosixPath from pathlib import Path, PurePosixPath
import shutil
import subprocess import subprocess
import sys import sys
import tarfile import tarfile
@@ -208,6 +209,57 @@ class HostTests(unittest.TestCase):
class GuestTests(unittest.TestCase): class GuestTests(unittest.TestCase):
def test_codex_npm_install_creates_the_configured_launcher(self):
node, npm = shutil.which("node"), shutil.which("npm")
if not node or not npm:
self.skipTest("Offline npm launcher integration requires Node.js and npm")
npm_path = Path(npm).resolve()
npm_cli = npm_path if npm_path.suffix == ".js" else npm_path.parent / "node_modules/npm/bin/npm-cli.js"
self.assertTrue(npm_cli.is_file(), "Cannot locate the installed npm CLI")
with tempfile.TemporaryDirectory(prefix="finaltoken-npm-fixture-") as tmp:
root = Path(tmp)
package = root / "codex-fixture.tgz"
with tarfile.open(package, "w:gz") as archive:
files = {"package/package.json": json.dumps({"name": "@finaltoken/offline-codex-fixture", "version": "1.0.0",
"bin": {"codex": "cli.js"}}), "package/cli.js": "#!/usr/bin/env node\nconsole.log('synthetic codex fixture');\n"}
for name, value in files.items():
content = value.encode("utf-8")
item = tarfile.TarInfo(name)
item.size, item.mode = len(content), 0o755
archive.addfile(item, io.BytesIO(content))
user_config, global_config = root / "user.npmrc", root / "global.npmrc"
user_config.write_text(""); global_config.write_text("")
env = {name: os.environ[name] for name in ("PATH", "SystemRoot", "TEMP", "TMP", "ComSpec", "PATHEXT") if name in os.environ}
env.update(NPM_CONFIG_USERCONFIG=str(user_config), NPM_CONFIG_GLOBALCONFIG=str(global_config))
home = root / "worker"
home.mkdir()
versions = []
def local_user(name, directory, command, **kwargs):
self.assertEqual("finaltoken", name)
self.assertEqual(home, directory)
if command[0] == "npm":
arguments = list(command[1:-1])
prefix_index = arguments.index("--prefix") + 1
prefix = Path(arguments[prefix_index])
# npm puts global launchers directly in the prefix on Windows;
# adapt that platform boundary to exercise the guest's Linux bin path.
if os.name == "nt":
arguments[prefix_index] = str(prefix / "bin")
return subprocess.run([node, str(npm_cli), *arguments, str(package), "--offline", "--ignore-scripts",
"--no-audit", "--no-fund", "--cache", str(root / "cache")], env=env, cwd=root,
text=True, capture_output=True, check=True, timeout=30)
launcher = home / ".local/bin/codex"
self.assertEqual([str(launcher), "--version"], command)
self.assertTrue(launcher.is_file(), "npm did not install the configured Codex launcher")
installed = home / (".local/bin/node_modules" if os.name == "nt" else ".local/lib/node_modules")
result = subprocess.run([node, str(installed / "@finaltoken/offline-codex-fixture/cli.js"), "--version"],
env=env, cwd=root, text=True, capture_output=True, check=True, timeout=10)
versions.append(result.stdout.strip())
with patch.object(guest, "WORKER_HOME", home), patch.object(guest, "as_user", side_effect=local_user):
guest.official_clis(["codex"])
guest.official_clis(["codex"]) # Existing launcher is used on subsequent runs.
self.assertEqual(["synthetic codex fixture"] * 2, versions)
def test_server_update_uses_persisted_identity_and_preserves_config_and_history(self): def test_server_update_uses_persisted_identity_and_preserves_config_and_history(self):
with tempfile.TemporaryDirectory() as tmp: with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp) root = Path(tmp)