fix: remove private deployment metadata and retain release licenses
This commit is contained in:
@@ -13,10 +13,11 @@ import time
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
APP = Path("/srv/pigway/apps/pigway-frame-flow")
|
||||
RECOVERY = Path("/srv/pigway/recovery/frame-flow")
|
||||
ROOT = Path(os.getenv("FRAME_FLOW_ROOT", "/srv/frameflow"))
|
||||
APP = ROOT / "apps/pigway-frame-flow"
|
||||
RECOVERY = ROOT / "recovery/frame-flow"
|
||||
CONTAINER = "pigway-frame-flow"
|
||||
ORIGIN = "http://192.0.2.10:81"
|
||||
ORIGIN = os.getenv("FRAME_FLOW_ORIGIN", "http://127.0.0.1:6005").rstrip("/")
|
||||
|
||||
|
||||
def run(*args):
|
||||
@@ -112,11 +113,14 @@ def verify_runtime(commit):
|
||||
|
||||
def main():
|
||||
assert os.geteuid() == 0, "Run with sudo on the Ubuntu Server"
|
||||
expected_uuid = os.environ.get("FRAME_FLOW_MOUNT_UUID", "")
|
||||
assert expected_uuid, "Set FRAME_FLOW_MOUNT_UUID to the verified storage UUID"
|
||||
assert os.environ.get("FRAME_FLOW_ORIGIN"), (
|
||||
"Set FRAME_FLOW_ORIGIN to the verified listener"
|
||||
)
|
||||
os.umask(0o077)
|
||||
run("/usr/local/libexec/pigway-guard-mount")
|
||||
assert run("findmnt", "-n", "-o", "UUID", "/srv/pigway") == (
|
||||
"00000000-0000-4000-8000-000000000001"
|
||||
)
|
||||
assert run("findmnt", "-n", "-o", "UUID", str(ROOT)) == expected_uuid
|
||||
with (RECOVERY / ".release.lock").open("a") as lock:
|
||||
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
release(lock)
|
||||
@@ -124,7 +128,7 @@ def main():
|
||||
|
||||
def release(lock):
|
||||
ctx = Path(__file__).resolve().parent.parent
|
||||
assert ctx.parent == Path("/srv/pigway/migration-inbox")
|
||||
assert ctx.parent == ROOT / "migration-inbox"
|
||||
commit = (ctx / "RELEASE_COMMIT").read_text().strip()
|
||||
assert re.fullmatch("[0-9a-f]{40}", commit)
|
||||
hashes = json.loads((ctx / "RELEASE_HASHES.json").read_text())
|
||||
@@ -193,7 +197,7 @@ def release(lock):
|
||||
n: h
|
||||
for n, h in hashes.items()
|
||||
if n.startswith(("pigway_frame_flow/", "vendor/"))
|
||||
or n == "requirements.lock"
|
||||
or n in {"requirements.lock", "LICENSE", "NOTICE.md"}
|
||||
}
|
||||
code = 'import hashlib,json,pathlib,sys; h=json.load(sys.stdin); assert all(hashlib.sha256((pathlib.Path("/app")/n).read_bytes()).hexdigest()==v for n,v in h.items())'
|
||||
subprocess.run(
|
||||
|
||||
Reference in New Issue
Block a user