in appengine/reconciletags/tag_reconciler.py [0:0]
def get_digest_from_prefix(self, repo, prefix):
name = docker_name.Repository(repo)
creds = docker_creds.DefaultKeychain.Resolve(name)
transport = transport_pool.Http(httplib2.Http)
with docker_image.FromRegistry(name, creds, transport) as img:
digests = [d[len('sha256:'):] for d in img.manifests()]
matches = [d for d in digests if d.startswith(prefix)]
if len(matches) == 1:
return matches[0]
if len(matches) == 0:
raise AssertionError('{0} is not a valid prefix'.format(
prefix))
raise AssertionError('{0} is not a unique digest prefix'.format(
prefix))