Add repo-family metadata to Fabric registry
This commit is contained in:
parent
3240b78185
commit
0ea99a73d8
15 changed files with 189 additions and 32 deletions
|
|
@ -155,6 +155,11 @@ def build_parser() -> argparse.ArgumentParser:
|
|||
sync.add_argument("--remote-url", default=None)
|
||||
sync.add_argument("--default-branch", default="main")
|
||||
sync.add_argument("--state-hub-repo-id", default=None)
|
||||
sync.add_argument("--repo-family", default=None)
|
||||
sync.add_argument("--ownership-repo", default=None)
|
||||
sync.add_argument("--primary-rail", default=None)
|
||||
sync.add_argument("--supported-rail", action="append", default=[], help="Declare a supported rail. May be repeated.")
|
||||
sync.add_argument("--substrate-kind", default=None)
|
||||
sync.add_argument("--commit", default=None)
|
||||
sync.add_argument("--json", action="store_true", help="Print the raw snapshot response.")
|
||||
|
||||
|
|
@ -448,6 +453,11 @@ def _registry_sync(args: argparse.Namespace) -> int:
|
|||
"remote_url": args.remote_url or _git_value(repo_path, "config", "--get", "remote.origin.url"),
|
||||
"default_branch": args.default_branch,
|
||||
"state_hub_repo_id": args.state_hub_repo_id,
|
||||
"repo_family": args.repo_family,
|
||||
"ownership_repo": args.ownership_repo,
|
||||
"primary_rail": args.primary_rail,
|
||||
"supported_rails": args.supported_rail,
|
||||
"substrate_kind": args.substrate_kind,
|
||||
},
|
||||
)
|
||||
snapshot = _registry_post(
|
||||
|
|
@ -824,13 +834,7 @@ def _scan_manifest_repo(
|
|||
repository = _registry_post_checked(
|
||||
registry_url,
|
||||
"/repositories",
|
||||
{
|
||||
"slug": slug,
|
||||
"name": item.get("name") or repo_path.name,
|
||||
"remote_url": item.get("remote_url") or _git_value(repo_path, "config", "--get", "remote.origin.url"),
|
||||
"default_branch": item.get("default_branch") or "main",
|
||||
"state_hub_repo_id": item.get("state_hub_repo_id"),
|
||||
},
|
||||
_manifest_repository_payload(item, repo_path, slug),
|
||||
)
|
||||
stored = _registry_post_checked(
|
||||
registry_url,
|
||||
|
|
@ -1230,13 +1234,7 @@ def _sync_manifest_repo(registry_url: str, manifest_dir: Path, item: object) ->
|
|||
repository = _registry_post_checked(
|
||||
registry_url,
|
||||
"/repositories",
|
||||
{
|
||||
"slug": slug,
|
||||
"name": item.get("name") or (repo_path.name if repo_path else slug),
|
||||
"remote_url": item.get("remote_url") or _git_value(repo_path, "config", "--get", "remote.origin.url"),
|
||||
"default_branch": item.get("default_branch") or "main",
|
||||
"state_hub_repo_id": item.get("state_hub_repo_id"),
|
||||
},
|
||||
_manifest_repository_payload(item, repo_path, slug),
|
||||
)
|
||||
result["repository"] = repository
|
||||
except RegistryRequestError as exc:
|
||||
|
|
@ -1597,6 +1595,21 @@ def _manifest_optional_path(value: object, manifest_dir: Path) -> Path | None:
|
|||
return path if path.is_absolute() else (manifest_dir / path).resolve()
|
||||
|
||||
|
||||
def _manifest_repository_payload(item: dict[str, Any], repo_path: Path | None, slug: str) -> dict[str, Any]:
|
||||
return {
|
||||
"slug": slug,
|
||||
"name": item.get("name") or (repo_path.name if repo_path else slug),
|
||||
"remote_url": item.get("remote_url") or _git_value(repo_path, "config", "--get", "remote.origin.url"),
|
||||
"default_branch": item.get("default_branch") or "main",
|
||||
"state_hub_repo_id": item.get("state_hub_repo_id"),
|
||||
"repo_family": item.get("repo_family"),
|
||||
"ownership_repo": item.get("ownership_repo"),
|
||||
"primary_rail": item.get("primary_rail"),
|
||||
"supported_rails": item.get("supported_rails"),
|
||||
"substrate_kind": item.get("substrate_kind"),
|
||||
}
|
||||
|
||||
|
||||
def _manifest_paths(value: object, manifest_dir: Path) -> list[Path]:
|
||||
if value is None:
|
||||
return []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue