Install Pipelines natively by default on macOS and Linux

Add scripts/setup-native.py and make ./install (and --native) build the server, the CLI
and ntfy from source into ~/.local/share/pipelines, detect an existing host OpenCode
and Pi instead of installing them, install the packaged authoring skill, migrate an
existing Docker database and ntfy auth store, save the host client default and start
both services. ./install --docker keeps the previous Docker server + ntfy
installation unchanged.

ntfy is compiled from its pinned Go module on every host because upstream publishes
no macOS server binary (its darwin asset is built with -tags noserver); its cgo
SQLite driver is why a C compiler is now required natively. The ntfy credential
bootstrap and the client default writer are shared by both installers,
installation.Load resolves symlinked prefixes, the Docker migration copies the
SQLite write-ahead log so the newest definitions and runs are not lost, and the
account subcommands read the generated configuration through NTFY_CONFIG_FILE.

Verified on macOS: 115 Python tests, go build/vet/test, and scratch installs that
migrate 9 pipelines and 31 runs, build ntfy v2.30.0 and start both services healthy
on spare ports before stopping them.
This commit is contained in:
2026-10-13 17:20:14 +01:00
parent 9b305df725
commit a70e3aef4b
21 changed files with 1474 additions and 153 deletions
+54
View File
@@ -147,6 +147,14 @@ class ReleaseResolutionTests(unittest.TestCase):
with self.assertRaisesRegex(resolve_releases.ReleaseError, "non-registry host"):
resolve_releases._default_fetch("https://evil.example.com/tags/list")
def test_shared_allowlist_guard_requires_https_allowlisted_host(self):
self.assertTrue(resolve_releases.is_allowlisted("https://api.github.com/x"))
self.assertTrue(resolve_releases.is_allowlisted("https://ghcr.io/x"))
self.assertTrue(resolve_releases.is_allowlisted("https://registry.npmjs.org/x"))
self.assertFalse(resolve_releases.is_allowlisted("http://api.github.com/x"))
self.assertFalse(resolve_releases.is_allowlisted("https://evil.example.com/x"))
self.assertFalse(resolve_releases.is_allowlisted("https://api.github.com.evil.example/x"))
def test_malformed_pi_metadata_is_rejected(self):
for pi in ({"version": "not-semver"}, {"version": "1.1.0", "engines": "node"}, 42):
with self.assertRaises(resolve_releases.ReleaseError):
@@ -178,5 +186,51 @@ class ReleaseResolutionTests(unittest.TestCase):
resolve_releases.load_fixture(path)
class FakeNtfy:
"""Deterministic ntfy tag fixture served through the same fetch seam."""
VERSION = "2.11.0"
def __init__(self, tags=None, tags_response=None):
self.tags = tags if tags is not None else ["v" + self.VERSION]
self.tags_response = tags_response
self.calls = []
def __call__(self, url, headers=None):
self.calls.append(url)
if "/git/matching-refs/" in url:
if self.tags_response is not None:
return 200, {}, json.dumps(self.tags_response).encode()
return 200, {}, json.dumps([{"ref": "refs/tags/" + tag} for tag in self.tags]).encode()
return 404, {}, b""
class NtfyResolutionTests(unittest.TestCase):
def test_resolves_exact_version_from_official_tags_only(self):
registry = FakeNtfy(tags=["v2.10.0", "v2.11.0"])
result = resolve_releases.resolve_ntfy(registry)
self.assertEqual(result["version"], "2.11.0")
self.assertEqual(result["tag"], "v2.11.0")
self.assertEqual(result["module"], resolve_releases.NTFY_MODULE)
self.assertEqual(result["repository"], resolve_releases.NTFY_REPOSITORY)
# No release assets or checksums are fetched: the native installer builds
# the server from the pinned module instead.
self.assertNotIn("assets", result)
self.assertEqual(len(registry.calls), 1)
self.assertTrue(registry.calls[0].startswith(
"https://api.github.com/repos/binwiederhier/ntfy/git/matching-refs/"))
self.assertFalse(any("releases/latest" in url for url in registry.calls))
def test_malformed_tag_metadata_is_rejected(self):
for tags in ([42], [{"ref": "refs/heads/main"}], [{"ref": "refs/tags/not-a-version"}],
[{"noref": "refs/tags/v2.11.0"}]):
with self.assertRaises(resolve_releases.ReleaseError):
resolve_releases.resolve_ntfy(FakeNtfy(tags_response=tags))
def test_no_stable_release_fails_closed(self):
with self.assertRaisesRegex(resolve_releases.ReleaseError, "no stable ntfy release"):
resolve_releases.resolve_ntfy(FakeNtfy(tags=[]))
if __name__ == "__main__":
unittest.main()