mirror of
https://github.com/quay/quay.git
synced 2026-01-26 06:21:37 +03:00
Add new endpoint for clients to query registry sparse manifest support: - GET /api/v1/registry/capabilities returns JSON with sparse_manifests capability info (supported, required_architectures, optional allowed) - V2 base endpoint now includes X-Sparse-Manifest-Support and X-Required-Architectures headers for OCI compliance - Endpoint accessible without authentication for client discovery This enables oc-mirror and skopeo to detect sparse manifest support before attempting filtered multi-architecture mirroring. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
"""
|
|
Registry capabilities API endpoint.
|
|
"""
|
|
|
|
import features
|
|
from app import app
|
|
from endpoints.api import ApiResource, define_json_response, nickname, resource
|
|
from endpoints.decorators import anon_allowed
|
|
|
|
|
|
@resource("/v1/registry/capabilities")
|
|
class RegistryCapabilities(ApiResource):
|
|
"""
|
|
Resource for querying registry capabilities.
|
|
"""
|
|
|
|
schemas = {
|
|
"RegistryCapabilitiesResponse": {
|
|
"type": "object",
|
|
"description": "Registry capabilities information",
|
|
"properties": {
|
|
"sparse_manifests": {
|
|
"type": "object",
|
|
"properties": {
|
|
"supported": {"type": "boolean"},
|
|
"required_architectures": {
|
|
"type": "array",
|
|
"items": {"type": "string"},
|
|
},
|
|
"optional_architectures_allowed": {"type": "boolean"},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
@nickname("getRegistryCapabilities")
|
|
@define_json_response("RegistryCapabilitiesResponse")
|
|
@anon_allowed
|
|
def get(self):
|
|
"""
|
|
Get registry capabilities.
|
|
|
|
Returns information about supported registry features including
|
|
sparse manifest support and required architectures.
|
|
"""
|
|
sparse_enabled = bool(features.SPARSE_INDEX) if hasattr(features, "SPARSE_INDEX") else False
|
|
required_archs = app.config.get("SPARSE_INDEX_REQUIRED_ARCHS", [])
|
|
|
|
return {
|
|
"sparse_manifests": {
|
|
"supported": sparse_enabled,
|
|
"required_architectures": required_archs if sparse_enabled else [],
|
|
"optional_architectures_allowed": sparse_enabled and len(required_archs) > 0,
|
|
},
|
|
}
|