Make Pipelines Docker-only with OpenCode and Pi
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers. Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent. Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Developer-only source lifecycle check; not an alternative installer. No inference."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import socket
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--temp-dir", help="Parent directory for disposable test files")
|
||||
args = parser.parse_args()
|
||||
repo = Path(__file__).resolve().parent.parent
|
||||
with tempfile.TemporaryDirectory(prefix="pipelines-first-install-", dir=args.temp_dir) as temporary:
|
||||
root = Path(temporary)
|
||||
env = {k: v for k, v in os.environ.items() if not k.startswith("PIPELINES_")}
|
||||
env.update(GOBIN=str(root / "bin"), XDG_CONFIG_HOME=str(root / "config"),
|
||||
XDG_DATA_HOME=str(root / "data"), PIPELINES_DRAFT_DIR=str(root / "drafts"))
|
||||
subprocess.run(["go", "install", "-trimpath", "./cmd/..."], cwd=repo, env=env, check=True, timeout=180)
|
||||
subprocess.run([str(root / "bin/pipelines"), "skill", "install"], cwd=repo, env=env, check=True, timeout=30)
|
||||
cli = root / "bin/pipelines"
|
||||
assert (root / "bin/pipelines-tui").is_file(), "TUI binary missing"
|
||||
assert (root / "config/opencode/skills/pipelines/references/operations.md").is_file(), "Skill not installed"
|
||||
workspace = root / "workspace"
|
||||
workspace.mkdir()
|
||||
|
||||
def local(*command):
|
||||
return subprocess.run([str(cli), *command], cwd=workspace, env=env,
|
||||
capture_output=True, text=True, check=True, timeout=30).stdout
|
||||
|
||||
version = json.loads(local("version", "--json"))
|
||||
assert version == json.loads(local("--version", "--json"))
|
||||
assert "import [FILE.zip]" in local("help")
|
||||
with socket.socket() as sock:
|
||||
sock.bind(("127.0.0.1", 0))
|
||||
port = sock.getsockname()[1]
|
||||
endpoint = f"ws://127.0.0.1:{port}/connect"
|
||||
database = root / "runs.db"
|
||||
|
||||
def rpc(*command):
|
||||
return json.loads(local("--url", endpoint, *command, "--json"))
|
||||
|
||||
def start(log):
|
||||
process = subprocess.Popen([str(root / "bin/pipelines-server"), "-addr", f"127.0.0.1:{port}",
|
||||
"-db", str(database)], cwd=workspace, env=env, stdout=log, stderr=log)
|
||||
try:
|
||||
deadline = time.monotonic() + 15
|
||||
while time.monotonic() < deadline:
|
||||
if process.poll() is not None:
|
||||
raise RuntimeError("Test server exited; see " + str(root / "server.log"))
|
||||
try:
|
||||
with socket.create_connection(("127.0.0.1", port), timeout=.1):
|
||||
return process
|
||||
except OSError:
|
||||
time.sleep(.05)
|
||||
raise RuntimeError("Test server did not become ready")
|
||||
except BaseException:
|
||||
stop(process)
|
||||
raise
|
||||
|
||||
def stop(process):
|
||||
process.terminate()
|
||||
try:
|
||||
process.wait(timeout=10)
|
||||
except subprocess.TimeoutExpired:
|
||||
process.kill()
|
||||
process.wait()
|
||||
raise
|
||||
|
||||
with (root / "server.log").open("w") as log:
|
||||
process = start(log)
|
||||
try:
|
||||
pong = rpc("ping")
|
||||
assert pong["build"] == version, "Client/server build mismatch"
|
||||
assert not rpc("list").get("pipelines"), "Fresh database must be empty"
|
||||
assert not rpc("runs").get("runs"), "Fresh database must have no runs"
|
||||
assert len(rpc("templates")["templates"]) == 5
|
||||
draft = rpc("new", "First test", "Summarize input", "--template", "summary", "--no-open", "--yes")
|
||||
assert not rpc("list").get("pipelines"), "Draft creation must not publish"
|
||||
rpc("validate", draft["path"])
|
||||
rpc("submit", draft["path"], "--yes")
|
||||
published = rpc("show", "First test")
|
||||
assert published["version"] == 1
|
||||
archive = root / "definitions.zip"
|
||||
rpc("export", "First test", "--output", str(archive))
|
||||
result = rpc("import", str(archive), "--all", "--yes")
|
||||
assert not result["imported"], "Identical import must not republish"
|
||||
assert rpc("show", "First test")["version"] == 1
|
||||
assert Path(draft["path"]).is_file(), "Published draft must remain"
|
||||
finally:
|
||||
stop(process)
|
||||
process = start(log)
|
||||
try:
|
||||
assert rpc("show", "First test")["source"] == published["source"], "Definition lost on restart"
|
||||
assert rpc("ping")["build"] == version
|
||||
assert not rpc("runs").get("runs"), "Smoke check must not execute a workflow"
|
||||
finally:
|
||||
stop(process)
|
||||
print("PASS developer lifecycle fixture: isolated source binaries/skill, offline version, empty DB, five templates, draft/validate/publish, ZIP identical import, restart persistence. Not an installation option; no inference or notifications.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user