feat: xxbb

This commit is contained in:
hashbro
2026-08-13 07:08:02 +08:00
parent c6e386e069
commit dbe6358a3c
11 changed files with 311 additions and 159 deletions
+16 -19
View File
@@ -1,12 +1,14 @@
#!/usr/bin/env python3
"""Delete one channel's {channel_name}/ tree; leave shared details/ and lab_seeds.json intact."""
"""No-op delete for shared /weifile + /details layout.
New-builder assets are deployment-wide. Removing one DB channel must not wipe
shared weifile/details used by the active campaign.
"""
from __future__ import annotations
import argparse
import json
import shutil
import sys
from pathlib import Path
import build as xxbb_build
@@ -15,8 +17,10 @@ RESULT_MARKER = "CORUNA_BUILD_RESULT "
def main() -> int:
parser = argparse.ArgumentParser(description="Remove {channel_name}/ from artifact root")
parser.add_argument("--channel-name", required=True)
parser = argparse.ArgumentParser(
description="Shared weifile/details are not deleted per channel (noop)."
)
parser.add_argument("--channel-name", default="", help="ignored (legacy)")
parser.add_argument(
"--artifact-root",
type=Path,
@@ -24,24 +28,17 @@ def main() -> int:
help="shared artifact root (default: coruna-lab/public)",
)
args = parser.parse_args()
channel_name = xxbb_build.validate_channel_name(args.channel_name)
artifact_root = args.artifact_root.resolve()
channel_dir = artifact_root / xxbb_build.CHANNEL_ROOT / channel_name
removed = False
if channel_dir.is_dir():
shutil.rmtree(channel_dir)
removed = True
print(f"removed {channel_dir}")
else:
print(f"missing {channel_dir} (noop)")
result = {
"status": "deleted" if removed else "absent",
"channel_name": channel_name,
"status": "skipped",
"reason": "shared_weifile_details",
"channel_name": (args.channel_name or "").strip().lower() or None,
"artifact_root": str(artifact_root),
"removed": removed,
"removed": False,
"weifile": str(artifact_root / xxbb_build.WEIFILE_ROOT),
"details": str(artifact_root / xxbb_build.DETAILS_ROOT),
}
print("shared /weifile and /details left intact (noop)")
print(RESULT_MARKER + json.dumps(result, separators=(",", ":")), flush=True)
return 0