INNER CODE UNIT · Python
gql_client
pluralsh/plural · bin/list_images.py:62
def gql_client():
token = get_token()
return GraphqlClient(endpoint="https://app.plural.sh/gql", headers={"Authorization": f"Bearer {token}"})
def copy_from_gcr(url):
parts = url.split("/")
gcr_url = "/".join(parts[2:])
os.system(f"skopeo copy --multi-arch all --dest-authfile config.json docker://gcr.io/pluralsh/{gcr_url} docker://{url}")
async def delete_missing(dkr_client, manifest, imgname, original, f):
for layer in manifest['layers']:
has_blob = await dkr_client.head_blob(imgname, FormattedSHA256.parse(layer['digest']))
# print(has_blob.client_response)
if not has_blob.result:
click.echo(f"deleting {original}")
await dkr_client.delete_manifest(imgname)
f.writelines(f"{original}\n")