""" Entry point: python -m e2e_framework [options] Usage: python -m e2e_framework ~/activity-core python -m e2e_framework ~/activity-core --host 92.205.130.254 python -m e2e_framework ~/activity-core --host railiance01 --keep make e2e REPO=activity-core (from the-custodian/) """ from __future__ import annotations import argparse import os import sys from pathlib import Path from .runner import run_e2e from .reporter import report def main() -> None: parser = argparse.ArgumentParser(description="Run e2e tests in a remote sandbox") parser.add_argument("repo_path", help="Path to the repo containing e2e/e2e.yml") parser.add_argument( "--host", default=os.environ.get("RAILIANCE01_HOST", ""), help="Sandbox host (SSH alias or IP). Env: RAILIANCE01_HOST", ) parser.add_argument( "--user", default=os.environ.get("RAILIANCE01_USER", "root"), help="SSH user (default: root). Env: RAILIANCE01_USER", ) parser.add_argument( "--key", default=os.environ.get("RAILIANCE01_KEY"), help="Path to SSH private key. Env: RAILIANCE01_KEY", ) parser.add_argument( "--keep", action="store_true", help="Keep sandbox after run (skip compose down + dir removal)", ) parser.add_argument( "--workstream-id", default=None, help="State-hub workstream ID to attach the progress event to", ) parser.add_argument( "--no-report", action="store_true", help="Skip posting results to state-hub", ) args = parser.parse_args() if not args.host: print("ERROR: sandbox host required. Set RAILIANCE01_HOST or pass --host.") sys.exit(1) repo_path = Path(args.repo_path).expanduser().resolve() if not repo_path.exists(): print(f"ERROR: repo path does not exist: {repo_path}") sys.exit(1) result = run_e2e( repo_path=repo_path, host=args.host, ssh_user=args.user, ssh_key=args.key, keep=args.keep, ) if not args.no_report: report(result, workstream_id=args.workstream_id) sys.exit(0 if result.passed else 1)