INNER CODE UNIT · Python
validate_config
1186258278/OpenClawChineseTranslation · scripts/verify-container-images.py:36
def validate_config(config, expected_version):
runtime = config.get('config', {})
if runtime.get('Cmd') != DEFAULT_COMMAND:
raise ValueError('Image does not start the gateway by default')
if '/healthz' not in ' '.join(runtime.get('Healthcheck', {}).get('Test', [])):
raise ValueError('Image is missing the gateway healthz healthcheck')
version = runtime.get('Labels', {}).get('org.opencontainers.image.version')
if version != expected_version:
raise ValueError(f'Image version label mismatch: {version} != {expected_version}')
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'