Stage ntfy output on installation filesystem before atomic replacement

This commit is contained in:
2026-11-08 19:02:26 +00:00
parent 323faef686
commit b67ae34ca1
2 changed files with 32 additions and 2 deletions
+5 -2
View File
@@ -571,7 +571,10 @@ class Setup:
source = Path(cache.stdout.strip()) / f"{module}@{version}"
if not source.is_dir():
raise ValueError(f"the Go module cache has no source for {pinned}")
with tempfile.TemporaryDirectory(prefix="pipelines-ntfy-") as temporary:
# Keep source work in the system temp directory, but stage the output
# beside the destination: /tmp may be a different filesystem on Linux.
with tempfile.TemporaryDirectory(prefix="pipelines-ntfy-") as temporary, \
tempfile.TemporaryDirectory(prefix=".ntfy-", dir=path.parent) as staging:
checkout = Path(temporary) / "src"
shutil.copytree(source, checkout, symlinks=True)
# The module cache is read-only and carries no built web assets; the
@@ -581,7 +584,7 @@ class Setup:
(checkout / "server/site").mkdir(parents=True, exist_ok=True)
(checkout / "server/docs/index.html").touch()
(checkout / "server/site/app.html").touch()
built = Path(temporary) / "ntfy"
built = Path(staging) / "ntfy"
env = dict(self.environ)
env["CGO_ENABLED"] = "1"
build = self.runner(