Report pending Registry activation accurately
This commit is contained in:
@@ -5,15 +5,22 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import getpass
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tomllib
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
from tools.verify_manager_install import verify_manager_install
|
||||
|
||||
|
||||
REGISTRY_VERSIONS_URL = "https://api.comfy.org/versions"
|
||||
|
||||
|
||||
def publish_release(
|
||||
source: Path,
|
||||
*,
|
||||
@@ -35,6 +42,41 @@ def publish_release(
|
||||
)
|
||||
|
||||
|
||||
def registry_release_status(source: Path) -> tuple[str, str, str]:
|
||||
with (source / "pyproject.toml").open("rb") as stream:
|
||||
project = tomllib.load(stream)["project"]
|
||||
node_id = str(project["name"])
|
||||
version = str(project["version"])
|
||||
query = urllib.parse.urlencode(
|
||||
{
|
||||
"nodeId": node_id,
|
||||
"include_status_reason": "true",
|
||||
"pageSize": "100",
|
||||
}
|
||||
)
|
||||
with urllib.request.urlopen(
|
||||
f"{REGISTRY_VERSIONS_URL}?{query}", timeout=30
|
||||
) as response:
|
||||
versions = json.load(response)["versions"]
|
||||
release = next((item for item in versions if item.get("version") == version), None)
|
||||
if release is None:
|
||||
raise RuntimeError(f"Registry upload is not visible: {node_id}@{version}")
|
||||
return node_id, version, str(release.get("status", "unknown"))
|
||||
|
||||
|
||||
def print_registry_install_status(source: Path) -> None:
|
||||
node_id, version, status = registry_release_status(source)
|
||||
print(f"REGISTRY VERSION STATUS: {node_id}@{version} {status}")
|
||||
print(f"EXACT CNR INSTALL: comfy node install {node_id}@{version}")
|
||||
if status != "NodeVersionStatusActive":
|
||||
print(
|
||||
"LATEST CNR ALIAS: unavailable until the Registry security scan "
|
||||
"activates this version"
|
||||
)
|
||||
else:
|
||||
print(f"LATEST CNR INSTALL: comfy node install {node_id}@latest")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
@@ -57,6 +99,7 @@ def main() -> int:
|
||||
token=token,
|
||||
changelog=args.changelog,
|
||||
)
|
||||
print_registry_install_status(args.source.resolve())
|
||||
except (OSError, subprocess.CalledProcessError, RuntimeError) as exc:
|
||||
print(f"REGISTRY RELEASE FAILED: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user