INNER CODE UNIT · Python
find_images_for_repo
pluralsh/plural · bin/list_images.py:135
async def find_images_for_repo(dkr_client, repo, f):
api = gql_client()
dkr_repos = api.execute(query=dkr_repos_q, variables={"id": repo["id"]})
for dkr in dkr_repos['data']['dockerRepositories']['edges']:
dkr = dkr['node']
dkr_imgs = api.execute(query=dkr_imgs_q, variables={"id": dkr['id']})['data']['dockerImages']['edges']
await ensure_tokens_present(dkr_client, f"{repo['name']}/{dkr['name']}")
for i in range(0, len(dkr_imgs), SUBSTEP):
await asyncio.wait([maybe_prune_img(dkr_client, img, repo, dkr, f) for img in dkr_imgs[i:i+SUBSTEP]])
STEP = 8
async def _list_imgs():
with Path('./.deleted-imgs').open('a') as f:
async with DockerRegistryClientAsync(credentials_store=Path("./config.json")) as dkr_client:
api = gql_client()
repos = api.execute(query=repos_q)['data']['repositories']['edges']