reinstate main tests

This commit is contained in:
Conor Sloan
2024-08-23 10:00:06 +01:00
parent da1f4d6352
commit e53d6ca2a2
5 changed files with 735 additions and 673 deletions
+18 -2
View File
@@ -30,7 +30,7 @@ export async function uploadOCIImageManifest(
await Promise.all(layerUploads)
return await uploadManifest(
const publishedDigest = await uploadManifest(
JSON.stringify(manifest),
manifest.mediaType,
registry,
@@ -38,6 +38,14 @@ export async function uploadOCIImageManifest(
tag || manifestSHA,
b64Token
)
if (publishedDigest !== manifestSHA) {
throw new Error(
`Digest mismatch. Expected ${manifestSHA}, got ${publishedDigest}.`
)
}
return manifestSHA
}
export async function uploadOCIIndexManifest(
@@ -54,7 +62,7 @@ export async function uploadOCIIndexManifest(
`Uploading index manifest ${manifestSHA} with tag ${tag} to ${repository}.`
)
return await uploadManifest(
const publishedDigest = await uploadManifest(
JSON.stringify(manifest),
manifest.mediaType,
registry,
@@ -62,6 +70,14 @@ export async function uploadOCIIndexManifest(
tag,
b64Token
)
if (publishedDigest !== manifestSHA) {
throw new Error(
`Digest mismatch. Expected ${manifestSHA}, got ${publishedDigest}.`
)
}
return manifestSHA
}
async function uploadLayer(
+14 -9
View File
@@ -1,18 +1,23 @@
import { FileMetadata } from './fs-helper'
import * as crypto from 'crypto'
const imageIndexMediaType = 'application/vnd.oci.image.index.v1+json'
const imageManifestMediaType = 'application/vnd.oci.image.manifest.v1+json'
const actionsPackageMediaType = 'application/vnd.github.actions.package.v1+json'
const actionsPackageTarLayerMediaType =
export const imageIndexMediaType = 'application/vnd.oci.image.index.v1+json'
export const imageManifestMediaType =
'application/vnd.oci.image.manifest.v1+json'
export const actionsPackageMediaType =
'application/vnd.github.actions.package.v1+json'
export const actionsPackageTarLayerMediaType =
'application/vnd.github.actions.package.layer.v1.tar+gzip'
const actionsPackageZipLayerMediaType =
export const actionsPackageZipLayerMediaType =
'application/vnd.github.actions.package.layer.v1.zip'
const sigstoreBundleMediaType = 'application/vnd.dev.sigstore.bundle.v0.3+json'
export const sigstoreBundleMediaType =
'application/vnd.dev.sigstore.bundle.v0.3+json'
const actionPackageAnnotationValue = 'actions_oci_pkg'
const actionPackageAttestationAnnotationValue = 'actions_oci_pkg_attestation'
const actionPackageReferrerTagAnnotationValue = 'actions_oci_pkg_referrer_tag'
export const actionPackageAnnotationValue = 'actions_oci_pkg'
export const actionPackageAttestationAnnotationValue =
'actions_oci_pkg_attestation'
export const actionPackageReferrerTagAnnotationValue =
'actions_oci_pkg_referrer_tag'
export const ociEmptyMediaType = 'application/vnd.oci.empty.v1+json'
export const emptyConfigSize = 2