Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(release): reconcile runner with published daemon identity repair

pulse-triage[bot]de09f27d29d5
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 4cf5315ccb..acdbbb0ed8 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -1041,6 +1041,14 @@ artifact-selection behaviour.
status on that port, and hand Playwright the same base URL, because a
worker may also host long-running Pulse instances on `7655` and `17655`
and a port collision fails the smoke only after every other stage passed.
+ Browser smoke must preserve private workspace ownership across the Docker
+ user-namespace boundary. On rootless Docker, container `0:0` maps to the
+ daemon owner; on rootful Docker, the browser uses the worker's host UID/GID.
+ The worker must read the daemon's security options, reject unreadable or
+ malformed identity information, and probe the mounted, lockfile-installed
+ Playwright CLI before the expensive suites and image build. It must not
+ download a replacement CLI or broaden checkout permissions to hide a mount
+ identity failure.
Race-instrumented Go builds must place `GOTMPDIR` under the worker's
persistent run directory and remove that bounded scratch directory on exit;
a small WSL `/tmp` tmpfs must not turn release qualification into a false
@@ -2145,27 +2153,6 @@ artifact-selection behaviour.
secrets, and seed hosted approvals through a single explicit tenant runtime
restart when a release proof needs transactionally visible approval state.
- Browser execution must invoke the npm-ci-installed
- `/work/node_modules/@playwright/test/cli.js` directly with Node inside the
- selected Playwright image. Missing or inaccessible mounted dependencies
- must fail admission rather than trigger an npx registry download of a
- substitute runner. Preserve the existing container UID/GID, mount, image
- version selection and exit status. The executed-shell fixture in
- `scripts/release_control/internal/release_preflight_test.py` verifies the
- runner path, argument quoting, container identity and failure propagation
- with mocked Docker; it is not browser qualification.
-
- After npm ci and image selection, the worker reads the selected non-root
- container's UID map. When that UID maps to a different host identity,
- POSIX ACLs grant only that mapped UID read/write/search access within the
- disposable `tests/integration` bind mount, without following symlinks.
- Default directory ACLs retain the host worker's access to generated evidence.
- No checkout-wide chmod, world access, root container, or gate bypass is
- permitted. Missing mapping/ACL support fails preparation closed. Identity
- mappings need no ACL change. A bounded real-container CLI startup and
- evidence read/cleanup probe is prerequisite evidence, not a browser pass
- or exact-candidate admission; the original failed admission remains retained.
-
## Forbidden Paths
1. Leaving deployment bootstrap, installer, or update-runtime files unowned under broad monitoring or generic API ownership
diff --git a/scripts/release-preflight-worker.sh b/scripts/release-preflight-worker.sh
index 7a1d84ccc6..07b9a1e963 100755
--- a/scripts/release-preflight-worker.sh
+++ b/scripts/release-preflight-worker.sh
@@ -96,6 +96,23 @@ if [ "$(node -p "process.versions.node.split('.')[0]")" != "24" ]; then
exit 3
fi
+playwright_container_user() {
+ local security_options
+ security_options="$(docker info --format '{{json .SecurityOptions}}')" || return
+ python3 - "$security_options" "$(id -u):$(id -g)" <<'PY'
+import json
+import sys
+
+options = json.loads(sys.argv[1])
+if not isinstance(options, list) or not all(isinstance(value, str) for value in options):
+ raise SystemExit("Docker security options must be a JSON list of strings.")
+# Container root maps to the daemon owner on rootless Docker. Reusing that
+# owner's host UID instead selects an unrelated subordinate host identity.
+print("0:0" if "name=rootless" in options else sys.argv[2])
+PY
+}
+PLAYWRIGHT_CONTAINER_USER="$(playwright_container_user)"
+
mkdir -p \
"$CACHE_DIR/go-build" \
"$CACHE_DIR/go-mod" \
@@ -204,33 +221,19 @@ run_backend() {
fi
}
-# Rootless Docker maps the selected non-root UID to a subordinate host UID.
-# Grant only that identity access to the disposable integration bind mount;
-# never make the checkout world-readable/writable or change container identity.
-prepare_playwright_mount() {
- local host_uid mapped_uid uid_map integration_dir
- host_uid="$(id -u)"
- integration_dir="$REPOSITORY_DIR/tests/integration"
- uid_map="$(docker run --rm --user "$(id -u):$(id -g)" \
- "$PLAYWRIGHT_IMAGE" cat /proc/self/uid_map)"
- mapped_uid="$(printf '%s\n' "$uid_map" | awk -v uid="$host_uid" '
- NF == 3 && uid >= $1 && uid < $1 + $3 { print $2 + uid - $1; found++ }
- END { if (found != 1) exit 1 }
- ')"
- if [[ ! "$mapped_uid" =~ ^[0-9]+$ ]] || [ "$mapped_uid" = 0 ]; then
- echo "Error: invalid non-root browser UID mapping." >&2
- return 3
- fi
- [ "$mapped_uid" != "$host_uid" ] || return 0
- command -v setfacl >/dev/null || {
- echo "Error: setfacl is required for the rootless browser mount." >&2
- return 3
- }
- # -P avoids following dependency symlinks outside this disposable tree.
- setfacl -R -P -m "u:${mapped_uid}:rwX" "$integration_dir"
- # Retain host access to evidence subsequently created by the mapped UID.
- find "$integration_dir" -type d -exec setfacl -m \
- "d:u:${host_uid}:rwx,d:u:${mapped_uid}:rwx" {} +
+run_playwright() {
+ docker run --rm \
+ --network host \
+ --ipc host \
+ --user "$PLAYWRIGHT_CONTAINER_USER" \
+ --env CI=true \
+ --env HOME=/tmp \
+ --env "PULSE_E2E_DIAGNOSTIC=${PULSE_E2E_DIAGNOSTIC:-}" \
+ --env "PLAYWRIGHT_BASE_URL=${PULSE_E2E_BASE_URL}" \
+ --volume "$REPOSITORY_DIR/tests/integration:/work" \
+ --workdir /work \
+ "$PLAYWRIGHT_IMAGE" \
+ node /work/node_modules/@playwright/test/cli.js "$@"
}
run_integration_prep() {
@@ -238,7 +241,9 @@ run_integration_prep() {
PLAYWRIGHT_VERSION="$(node -p "require('./tests/integration/node_modules/@playwright/test/package.json').version")"
PLAYWRIGHT_IMAGE="mcr.microsoft.com/playwright:v${PLAYWRIGHT_VERSION}-noble"
phase playwright-image docker pull "$PLAYWRIGHT_IMAGE"
- phase playwright-mount prepare_playwright_mount
+ # Check the real mount and locked CLI before the expensive test suites and
+ # image build. Never let npx download a different browser test version.
+ phase playwright-runtime run_playwright --version
phase mock-github-image docker build --tag pulse-mock-github:test tests/integration/mock-github-server
}
@@ -287,24 +292,6 @@ else
--tag pulse:test \
.
fi
-# Use only the npm-ci-installed runner. npx may fetch a different version when
-# the mounted dependency tree is missing or inaccessible, masking the actual
-# admission failure and breaking parity with the selected browser image.
-run_playwright() {
- docker run --rm \
- --network host \
- --ipc host \
- --user "$(id -u):$(id -g)" \
- --env CI=true \
- --env HOME=/tmp \
- --env "PULSE_E2E_DIAGNOSTIC=${PULSE_E2E_DIAGNOSTIC:-}" \
- --env "PLAYWRIGHT_BASE_URL=${PULSE_E2E_BASE_URL}" \
- --volume "$REPOSITORY_DIR/tests/integration:/work" \
- --workdir /work \
- "$PLAYWRIGHT_IMAGE" \
- node /work/node_modules/@playwright/test/cli.js test "$@"
-}
-
run_rehearsal_smoke() {
cd tests/integration
export MOCK_CHECKSUM_ERROR=false
@@ -314,7 +301,7 @@ run_rehearsal_smoke() {
export PULSE_E2E_DIAGNOSTIC=1
docker compose -f docker-compose.test.yml up -d --wait
timeout 60 sh -c 'until curl -fsS ${PULSE_E2E_BASE_URL}/api/health >/dev/null; do sleep 2; done'
- run_playwright tests/00-diagnostic.spec.ts --project=chromium --reporter=list
+ run_playwright test tests/00-diagnostic.spec.ts --project=chromium --reporter=list
local status
status="$(curl -s -o "$RUN_DIR/update-status.json" -w '%{http_code}' ${PULSE_E2E_BASE_URL}/api/updates/status || true)"
case "$status" in
@@ -339,7 +326,7 @@ run_release_smoke() {
timeout 60 sh -c 'until docker inspect --format="{{json .State.Health.Status}}" pulse-mock-github | grep -q healthy; do sleep 2; done'
timeout 60 sh -c 'until docker inspect --format="{{json .State.Health.Status}}" pulse-test-server | grep -q healthy; do sleep 2; done'
timeout 60 sh -c 'until curl -fsS ${PULSE_E2E_BASE_URL}/api/health >/dev/null; do sleep 2; done'
- run_playwright tests/95-release-smoke.spec.ts --project=chromium --reporter=list
+ run_playwright test tests/95-release-smoke.spec.ts --project=chromium --reporter=list
docker compose -f docker-compose.test.yml down -v
}
diff --git a/scripts/release_control/internal/release_preflight_test.py b/scripts/release_control/internal/release_preflight_test.py
index 21aa2eae0d..3a3de052e8 100755
--- a/scripts/release_control/internal/release_preflight_test.py
+++ b/scripts/release_control/internal/release_preflight_test.py
@@ -2,6 +2,7 @@
from __future__ import annotations
import os
+import json
import pathlib
import re
import subprocess
@@ -264,94 +265,6 @@ class ReleasePreflightTest(unittest.TestCase):
self.assertIn('--env "PLAYWRIGHT_BASE_URL=${PULSE_E2E_BASE_URL}"', worker)
self.assertNotIn("localhost:7655", worker)
- def test_browser_uses_installed_runner_and_preserves_failure(self) -> None:
- worker = (ROOT / "scripts/release-preflight-worker.sh").read_text()
- function = re.search(
- r"run_playwright\(\) \{.*?\n\}", worker, flags=re.DOTALL
- ).group(0)
- # Exercise the real shell function without starting Docker or a browser.
- # A failed container must propagate, not become a successful admission.
- for status in (0, 13):
- with self.subTest(status=status):
- result = subprocess.run(
- ["bash", "-c", """
-docker() { printf '%s\n' "$@"; return """ + str(status) + """; }
-REPOSITORY_DIR='/tmp/worker with spaces/repo'
-PLAYWRIGHT_IMAGE='mcr.microsoft.com/playwright:v1.61.1-noble'
-PULSE_E2E_BASE_URL='http://localhost:27655'
-""" + function + """
-run_playwright 'tests/a test.spec.ts' --project=chromium
-"""],
- text=True, capture_output=True, check=False,
- )
- self.assertEqual(result.returncode, status, result.stderr)
- args = result.stdout.splitlines()
- self.assertEqual(args[-5:], [
- "node", "/work/node_modules/@playwright/test/cli.js",
- "test", "tests/a test.spec.ts", "--project=chromium",
- ])
- self.assertNotIn("npx", args)
- self.assertEqual(args[args.index("--volume") + 1],
- "/tmp/worker with spaces/repo/tests/integration:/work")
- self.assertEqual(args[args.index("--user") + 1],
- f"{os.getuid()}:{os.getgid()}")
- self.assertIn("mcr.microsoft.com/playwright:v1.61.1-noble", args)
-
- def test_browser_mount_mapping_and_fail_closed(self) -> None:
- worker = (ROOT / "scripts/release-preflight-worker.sh").read_text()
- function = re.search(
- r"prepare_playwright_mount\(\) \{.*?\n\}", worker, flags=re.DOTALL
- ).group(0)
- for mapping, status, acl in (
- ("0 1001 1\n1 165536 65536", 0, "u:166536:rwX"),
- ("0 0 4294967295", 0, None),
- ("0 1001 1", 1, None),
- ("garbage", 1, None),
- ):
- with self.subTest(mapping=mapping):
- result = subprocess.run(["bash", "-c", r'''
-set -euo pipefail
-id() { echo 1001; }
-docker() { printf '%s\n' "$MAPPING"; }
-setfacl() { printf 'ACL %s\n' "$*"; }
-find() { printf 'FIND %s\n' "$*"; }
-REPOSITORY_DIR='/tmp/worker with spaces/repo'
-PLAYWRIGHT_IMAGE='selected-image'
-''' + function + "\nprepare_playwright_mount"],
- env={**os.environ, "MAPPING": mapping},
- text=True, capture_output=True, check=False)
- self.assertEqual(result.returncode, status, result.stderr)
- if acl:
- self.assertIn(acl, result.stdout)
- self.assertIn("-R -P", result.stdout)
- self.assertIn("d:u:1001:rwx,d:u:166536:rwx", result.stdout)
- self.assertIn("/tmp/worker with spaces/repo/tests/integration", result.stdout)
- else:
- self.assertNotIn("ACL", result.stdout)
- prep = re.search(r"run_integration_prep\(\) \{.*?\n\}", worker,
- flags=re.DOTALL).group(0)
- self.assertLess(prep.index("integration-dependencies"), prep.index("playwright-mount"))
- self.assertLess(prep.index("playwright-image"), prep.index("playwright-mount"))
-
- def test_browser_mount_acl_errors_propagate(self) -> None:
- worker = (ROOT / "scripts/release-preflight-worker.sh").read_text()
- function = re.search(r"prepare_playwright_mount\(\) \{.*?\n\}", worker,
- flags=re.DOTALL).group(0)
- for failing in ("docker", "setfacl", "find"):
- with self.subTest(failing=failing):
- script = r'''
-set -euo pipefail
-id() { echo 1001; }
-docker() { printf '0 1001 1\n1 165536 65536\n'; }
-setfacl() { :; }
-find() { :; }
-REPOSITORY_DIR=/unused
-PLAYWRIGHT_IMAGE=selected-image
-''' + f"\n{failing}() {{ return 19; }}\n" + function + "\nprepare_playwright_mount"
- result = subprocess.run(["bash", "-c", script],
- text=True, capture_output=True, check=False)
- self.assertEqual(result.returncode, 19, result.stderr)
-
def test_worker_serializes_resource_intensive_test_suites(self) -> None:
worker = (ROOT / "scripts/release-preflight-worker.sh").read_text()
scheduling_block = re.search(
@@ -369,6 +282,66 @@ PLAYWRIGHT_IMAGE=selected-image
self.assertLess(block.index("done\n"), block.index("run_frontend_tests\n"))
self.assertLess(block.index("run_frontend_tests\n"), block.index("run_backend\n"))
+ def test_browser_mount_identity_and_locked_cli_follow_the_docker_daemon(self) -> None:
+ worker = (ROOT / "scripts/release-preflight-worker.sh").read_text()
+ functions = []
+ for name in ("playwright_container_user", "run_playwright"):
+ match = re.search(rf"^{name}\(\) \{{\n.*?^\}}", worker, re.MULTILINE | re.DOTALL)
+ self.assertIsNotNone(match, name)
+ functions.append(match.group(0))
+ for options, info_rc, valid, expected_user in (
+ (["name=seccomp,profile=builtin", "name=rootless"], 0, True, "0:0"),
+ (["name=seccomp,profile=builtin"], 0, True, f"{os.getuid()}:{os.getgid()}"),
+ ([], 42, False, None),
+ ({"rootless": True}, 0, False, None),
+ (None, 0, False, None),
+ ):
+ with self.subTest(options=options, info_rc=info_rc), tempfile.TemporaryDirectory() as raw:
+ temp = pathlib.Path(raw)
+ docker = temp / "docker"
+ docker.write_text(
+ f"#!{sys.executable}\n"
+ "import json,os,pathlib,sys\n"
+ "if sys.argv[1] == 'info':\n"
+ " print(os.environ['TEST_SECURITY_OPTIONS'])\n"
+ " raise SystemExit(int(os.environ['TEST_INFO_RC']))\n"
+ "pathlib.Path(os.environ['TEST_CONTAINER_STARTED']).touch()\n"
+ "print(json.dumps(sys.argv[1:]))\n"
+ )
+ docker.chmod(0o755)
+ started = temp / "started"
+ script = "set -euo pipefail\n" + "\n".join(functions) + "\n"
+ script += 'PLAYWRIGHT_CONTAINER_USER="$(playwright_container_user)"\n'
+ script += "run_playwright --version\n"
+ script += "run_playwright test tests/00-diagnostic.spec.ts --project=chromium\n"
+ result = subprocess.run(
+ ["bash", "-c", script], capture_output=True, text=True, check=False,
+ env={**os.environ, "PATH": f"{temp}:{os.environ['PATH']}",
+ "TEST_SECURITY_OPTIONS": json.dumps(options), "TEST_INFO_RC": str(info_rc),
+ "TEST_CONTAINER_STARTED": str(started),
+ "REPOSITORY_DIR": str(temp / "private workspace"),
+ "PLAYWRIGHT_IMAGE": "locked-playwright-image",
+ "PULSE_E2E_BASE_URL": "http://127.0.0.1:27655"},
+ )
+ self.assertEqual(valid, result.returncode == 0, result.stderr)
+ self.assertEqual(valid, started.exists())
+ if not valid:
+ continue
+ calls = [json.loads(line) for line in result.stdout.splitlines()]
+ self.assertEqual(2, len(calls))
+ for args in calls:
+ self.assertEqual(expected_user, args[args.index("--user") + 1])
+ self.assertEqual(f"{temp}/private workspace/tests/integration:/work",
+ args[args.index("--volume") + 1])
+ self.assertIn("node", args)
+ self.assertIn("/work/node_modules/@playwright/test/cli.js", args)
+ self.assertNotIn("npx", args)
+ self.assertEqual("--version", calls[0][-1])
+ self.assertEqual(["test", "tests/00-diagnostic.spec.ts", "--project=chromium"], calls[1][-3:])
+ prep = worker[worker.index("run_integration_prep() {"):worker.index("# Static frontend checks")]
+ self.assertLess(prep.index("phase playwright-image"), prep.index("phase playwright-runtime"))
+ self.assertIn("phase playwright-runtime run_playwright --version", prep)
+
def test_api_shard_plan_is_deterministic_complete_and_disjoint(self) -> None:
test_names = [
f"TestReleaseCase{index:04d}"