refactor: delegate SBOM scans to Nexus
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a028f0-a42f-7582-89a8-ebaad7343834
This commit is contained in:
parent
6d57d1c1b2
commit
ad0ba6f2ba
8 changed files with 277 additions and 428 deletions
|
|
@ -342,7 +342,10 @@ def main(argv: list[str] | None = None) -> int:
|
|||
help="Write files; without this flag only validate and report",
|
||||
)
|
||||
|
||||
p_sbom = sub.add_parser("sbom", help="Derive SBOM snapshots and licence reports from repository files")
|
||||
p_sbom = sub.add_parser(
|
||||
"sbom",
|
||||
help="Deprecated compatibility commands delegated to SBOM Nexus",
|
||||
)
|
||||
sbom_sub = p_sbom.add_subparsers(dest="sbom_command")
|
||||
p_sbom_scan = sbom_sub.add_parser("scan", help="Scan recognised lockfiles and tool manifests")
|
||||
p_sbom_scan.add_argument("--path", default=".")
|
||||
|
|
@ -802,18 +805,17 @@ def main(argv: list[str] | None = None) -> int:
|
|||
if not args.sbom_command:
|
||||
p_sbom.print_help()
|
||||
return 2
|
||||
from repo_manager.sbom import scan_repository
|
||||
from repo_manager.sbom_client import (
|
||||
licence_report_from_snapshot,
|
||||
scan_repository_via_nexus,
|
||||
)
|
||||
|
||||
snapshot = scan_repository(Path(args.path), slug=args.slug)
|
||||
result = snapshot if args.sbom_command == "scan" else {
|
||||
"ok": snapshot["ok"],
|
||||
"repo_slug": snapshot["repo_slug"],
|
||||
"source_revision": snapshot["source_revision"],
|
||||
"generated_at": snapshot["generated_at"],
|
||||
"entry_count": snapshot["entry_count"],
|
||||
"licence_report": snapshot["licence_report"],
|
||||
"errors": snapshot["errors"],
|
||||
}
|
||||
snapshot = scan_repository_via_nexus(Path(args.path), slug=args.slug)
|
||||
result = (
|
||||
snapshot
|
||||
if args.sbom_command == "scan"
|
||||
else licence_report_from_snapshot(snapshot)
|
||||
)
|
||||
if args.sbom_command == "scan" and args.output:
|
||||
output = Path(args.output)
|
||||
if output.exists() and not args.force:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue