Files
scriptc/scripts/oci-manifest.mjs
T
Chris Tate 177d025452 Harden sandbox gate across host platforms
- Retain representative Darwin kqueue coverage in the default gate.
- Schedule native runtime tests by host and make Linux clang invocations portable.
- Resolve canonical OCI manifest digests for direct and indexed images.
2026-07-28 17:48:17 -05:00

32 lines
1.1 KiB
JavaScript

const IMAGE_MANIFEST_MEDIA_TYPES = new Set([
"application/vnd.oci.image.manifest.v1+json",
"application/vnd.docker.distribution.manifest.v2+json",
]);
/**
* Resolve the descriptor digest VCR reports for a linux/amd64 image.
*
* `docker buildx imagetools inspect --format "{{json .}}"` includes the
* canonical descriptor digest even when the tag points directly at a
* single-platform manifest. Raw manifest JSON does not: its `config.digest`
* names the image configuration blob, which is a different registry object.
*/
export function linuxAmd64ManifestDigest(inspection) {
const manifest = inspection?.manifest;
const platformManifest = manifest?.manifests?.find(
(candidate) =>
candidate.platform?.os === "linux" &&
candidate.platform?.architecture === "amd64",
);
if (typeof platformManifest?.digest === "string") return platformManifest.digest;
if (
IMAGE_MANIFEST_MEDIA_TYPES.has(manifest?.mediaType) &&
typeof manifest?.digest === "string"
) {
return manifest.digest;
}
throw new Error("could not find a linux/amd64 image manifest descriptor");
}