Skip to content

Instantly share code, notes, and snippets.

@northtyphoon
Last active December 23, 2022 20:46
Show Gist options
  • Save northtyphoon/7aa607455b408eb4853de0071a7d133c to your computer and use it in GitHub Desktop.
Save northtyphoon/7aa607455b408eb4853de0071a7d133c to your computer and use it in GitHub Desktop.
# Prerequisite
# 1) Install curl, jq, oras (0.15.0 and older version)

registry="mcr.microsoft.com"
repo="oss/fluent/fluent-bit"
tag="v1.9.6"
artifact_type="application/vnd.cncf.notary.v2.signature"
accept_header="Accept: application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.cncf.oras.artifact.manifest.v1+json, */*"

image_digest=$(curl -I -H "$accept_header" https://$registry/v2/$repo/manifests/$tag | awk -v FS=": " 'BEGIN{RS="\r\n";} /^docker-content-digest/{print $2}')

curl "https://$registry/v2/$repo/_oras/artifacts/referrers?digest=$image_digest" | jq

oras discover -o tree $registry/$repo:$tag

curl "https://$registry/v2/$repo/_oras/artifacts/referrers?digest=$image_digest&artifactType=$artifact_type" | jq

oras discover --artifact-type $artifact_type -o tree $registry/$repo:$tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment