Release: cut over Echoion 2.0 components
Modular container CI / release-build (push) Has been cancelled
Modular container CI / release-build (push) Has been cancelled
This commit is contained in:
169 files changed
+3069
-32261
No files matched your search
+31
-29
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Clone the independently versioned Echoion component repositories."""
|
||||
"""Create or synchronize permanent Echoion component working copies."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -19,60 +19,62 @@ def output(*args: str, cwd: Path) -> str:
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--workspace",
|
||||
type=Path,
|
||||
help="component checkout directory (default: parent of Echoion root)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--update",
|
||||
action="store_true",
|
||||
help="fetch and check out locked revisions in existing clean repositories",
|
||||
help="fetch and check out exact revisions from components.lock.json",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--record",
|
||||
action="store_true",
|
||||
help="record the current clean component HEADs in components.lock.json",
|
||||
help="prepare and record a complete canonical release lock",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
if args.update and args.record:
|
||||
parser.error("--update and --record are mutually exclusive")
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
lock_path = root / "components.lock.json"
|
||||
lock = json.loads(lock_path.read_text())
|
||||
if lock.get("schemaVersion") != 1:
|
||||
workspace = (args.workspace or root.parent).resolve()
|
||||
registry = json.loads((root / "components.json").read_text())
|
||||
lock = json.loads((root / "components.lock.json").read_text())
|
||||
if registry.get("schemaVersion") != 1:
|
||||
raise SystemExit("unsupported components.json schema")
|
||||
if lock.get("schemaVersion") != 2:
|
||||
raise SystemExit("unsupported components.lock.json schema")
|
||||
|
||||
if args.record:
|
||||
for name, component in lock["components"].items():
|
||||
destination = root / name
|
||||
if not (destination / ".git").exists():
|
||||
raise SystemExit(f"component repository is missing: {destination}")
|
||||
if output("git", "status", "--porcelain", cwd=destination):
|
||||
raise SystemExit(
|
||||
f"refusing to record dirty repository: {destination}"
|
||||
)
|
||||
component["revision"] = output(
|
||||
"git", "rev-parse", "HEAD", cwd=destination
|
||||
)
|
||||
temporary = lock_path.with_suffix(".json.tmp")
|
||||
temporary.write_text(json.dumps(lock, indent=2) + "\n")
|
||||
temporary.replace(lock_path)
|
||||
run(
|
||||
str(root / "scripts" / "prepare-release.sh"),
|
||||
"--workspace",
|
||||
str(workspace),
|
||||
cwd=root,
|
||||
)
|
||||
return 0
|
||||
|
||||
for name, component in lock["components"].items():
|
||||
destination = root / name
|
||||
revision = component["revision"]
|
||||
for name, component in registry["components"].items():
|
||||
destination = workspace / name
|
||||
revision = (
|
||||
lock["components"][name]["revision"]
|
||||
if args.update
|
||||
else component.get("branch", "main")
|
||||
)
|
||||
if not destination.exists():
|
||||
run(
|
||||
"git",
|
||||
"clone",
|
||||
"--no-checkout",
|
||||
"--branch",
|
||||
component.get("branch", "main"),
|
||||
component["url"],
|
||||
str(destination),
|
||||
)
|
||||
run("git", "fetch", "--depth=1", "origin", revision, cwd=destination)
|
||||
run("git", "checkout", "--detach", "FETCH_HEAD", cwd=destination)
|
||||
continue
|
||||
|
||||
if not (destination / ".git").exists():
|
||||
elif not (destination / ".git").exists():
|
||||
raise SystemExit(f"{destination} exists but is not a Git repository")
|
||||
|
||||
if not args.update:
|
||||
continue
|
||||
if output("git", "status", "--porcelain", cwd=destination):
|
||||
|
||||
Reference in new issue
Block a user