INNER CODE UNIT · Python

inspect_registry

1186258278/OpenClawChineseTranslation · scripts/verify-container-images.py:47

def inspect_registry(registry, owner, tags, expected_version=None):
    repo = f'{owner}/openclaw-zh'
    if registry == 'ghcr.io':
        auth_url = f'https://ghcr.io/token?service=ghcr.io&scope=repository:{repo}:pull'
        base = f'https://ghcr.io/v2/{repo}'
    else:
        auth_url = f'https://auth.docker.io/token?service=registry.docker.io&scope=repository:{repo}:pull'
        base = f'https://registry-1.docker.io/v2/{repo}'
    auth, _ = request_json(auth_url)
    token = auth.get('token') or auth['access_token']
    rows = []
    for tag in tags:
        index, digest = request_json(f'{base}/manifests/{tag}', token)
        descriptors = [m for m in index.get('manifests', []) if m.get('platform', {}).get('os') == 'linux']
        arches = [m['platform']['architecture'] for m in descriptors]
        if sorted(arches) != ['amd64', 'arm64']:
            raise ValueError(f'{registry}:{tag}: wrong platforms {arches}')
        platforms = {}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…