def find_credentials(image_reference, privileges, absent_ok): registry_cfg = model.container_registry.find_config( image_reference, privileges, ) if not registry_cfg: return None # fallback to docker-cfg creds = registry_cfg.credentials() return oa.OciBasicAuthCredentials( username=creds.username(), password=creds.passwd(), )
def find_credentials( image_reference: str, privileges: oa.Privileges = oa.Privileges.READONLY, absent_ok: bool = True, ): registry_cfg = model.container_registry.find_config( image_reference=image_reference, privileges=privileges, ) if not registry_cfg: return None # fallback to docker-cfg (or try w/o auth) creds = registry_cfg.credentials() return oa.OciBasicAuthCredentials( username=creds.username(), password=creds.passwd(), )