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,65 @@
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from build_metadata import docker_args
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class BuildMetadataTests(unittest.TestCase):
|
||||
def test_clean_and_dirty_sources(self):
|
||||
for dirty in (False, True):
|
||||
def runner(command, **kwargs):
|
||||
out = "a" * 40 if command[1] == "rev-parse" else ("?? new.go" if dirty else "")
|
||||
return subprocess.CompletedProcess(command, 0, stdout=out)
|
||||
args = docker_args(".", runner)
|
||||
self.assertIn("PIPELINES_COMMIT=" + "a" * 40, args)
|
||||
self.assertIn("PIPELINES_VERSION=" + "a" * 12 + ("-dirty" if dirty else ""), args)
|
||||
self.assertIn("PIPELINES_DIRTY=" + str(dirty).lower(), args)
|
||||
|
||||
def test_missing_or_invalid_git_fails(self):
|
||||
for code, out in ((1, ""), (0, "bad revision")):
|
||||
def runner(command, **kwargs):
|
||||
return subprocess.CompletedProcess(command, code, stdout=out)
|
||||
with self.assertRaises(ValueError):
|
||||
docker_args(".", runner)
|
||||
|
||||
def test_generated_release_receipt_is_ignored_and_dirty_detection_intact(self):
|
||||
if shutil.which("git") is None:
|
||||
self.skipTest("git is required for the isolated source-hygiene fixture")
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
directory = Path(directory)
|
||||
shutil.copy(REPO_ROOT / ".gitignore", directory / ".gitignore")
|
||||
source = directory / "source.txt"
|
||||
source.write_text("tracked\n")
|
||||
|
||||
def git(*args):
|
||||
result = subprocess.run(["git", *args], cwd=directory, capture_output=True, text=True)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
return result.stdout
|
||||
|
||||
git("init", "-q")
|
||||
git("config", "user.name", "Fixture")
|
||||
git("config", "user.email", "fixture@example.invalid")
|
||||
git("config", "commit.gpgsign", "false")
|
||||
git("add", ".gitignore", "source.txt")
|
||||
git("commit", "-q", "-m", "fixture")
|
||||
|
||||
# Representative generated root artifacts the installer writes.
|
||||
(directory / ".pipelines-releases.json").write_text("{}\n")
|
||||
(directory / ".pipelines-releases-abc123").write_text("")
|
||||
|
||||
self.assertEqual(git("status", "--porcelain", "--untracked-files=normal"), "")
|
||||
clean = dict(arg.split("=", 1) for arg in docker_args(directory) if arg != "--build-arg")
|
||||
self.assertEqual(clean["PIPELINES_DIRTY"], "false")
|
||||
self.assertFalse(clean["PIPELINES_VERSION"].endswith("-dirty"))
|
||||
|
||||
source.write_text("modified\n")
|
||||
self.assertNotEqual(git("status", "--porcelain", "--untracked-files=normal"), "")
|
||||
dirty = dict(arg.split("=", 1) for arg in docker_args(directory) if arg != "--build-arg")
|
||||
self.assertEqual(dirty["PIPELINES_DIRTY"], "true")
|
||||
self.assertTrue(dirty["PIPELINES_VERSION"].endswith("-dirty"))
|
||||
Reference in New Issue
Block a user