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
Generated Vendored
+35 -27
View File
@@ -106690,13 +106690,21 @@ async function uploadOCIImageManifest(token, registry, repository, manifest, blo
return uploadLayer(layer, blob, registry, repository, b64Token);
});
await Promise.all(layerUploads);
return await uploadManifest(JSON.stringify(manifest), manifest.mediaType, registry, repository, tag || manifestSHA, b64Token);
const publishedDigest = await uploadManifest(JSON.stringify(manifest), manifest.mediaType, registry, repository, tag || manifestSHA, b64Token);
if (publishedDigest !== manifestSHA) {
throw new Error(`Digest mismatch. Expected ${manifestSHA}, got ${publishedDigest}.`);
}
return manifestSHA;
}
async function uploadOCIIndexManifest(token, registry, repository, manifest, tag) {
const b64Token = Buffer.from(token).toString('base64');
const manifestSHA = ociContainer.sha256Digest(manifest);
core.info(`Uploading index manifest ${manifestSHA} with tag ${tag} to ${repository}.`);
return await uploadManifest(JSON.stringify(manifest), manifest.mediaType, registry, repository, tag, b64Token);
const publishedDigest = await uploadManifest(JSON.stringify(manifest), manifest.mediaType, registry, repository, tag, b64Token);
if (publishedDigest !== manifestSHA) {
throw new Error(`Digest mismatch. Expected ${manifestSHA}, got ${publishedDigest}.`);
}
return manifestSHA;
}
async function uploadLayer(layer, data, registryURL, repository, b64Token) {
const checkExistsResponse = await fetchWithDebug(checkBlobEndpoint(registryURL, repository, layer.digest), {
@@ -107008,22 +107016,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.emptyConfigSha = exports.emptyConfigSize = exports.ociEmptyMediaType = void 0;
exports.emptyConfigSha = exports.emptyConfigSize = exports.ociEmptyMediaType = exports.actionPackageReferrerTagAnnotationValue = exports.actionPackageAttestationAnnotationValue = exports.actionPackageAnnotationValue = exports.sigstoreBundleMediaType = exports.actionsPackageZipLayerMediaType = exports.actionsPackageTarLayerMediaType = exports.actionsPackageMediaType = exports.imageManifestMediaType = exports.imageIndexMediaType = void 0;
exports.createActionPackageManifest = createActionPackageManifest;
exports.createSigstoreAttestationManifest = createSigstoreAttestationManifest;
exports.createReferrerTagManifest = createReferrerTagManifest;
exports.sha256Digest = sha256Digest;
exports.sizeInBytes = sizeInBytes;
const crypto = __importStar(__nccwpck_require__(6113));
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 = 'application/vnd.github.actions.package.layer.v1.tar+gzip';
const actionsPackageZipLayerMediaType = 'application/vnd.github.actions.package.layer.v1.zip';
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';
exports.imageIndexMediaType = 'application/vnd.oci.image.index.v1+json';
exports.imageManifestMediaType = 'application/vnd.oci.image.manifest.v1+json';
exports.actionsPackageMediaType = 'application/vnd.github.actions.package.v1+json';
exports.actionsPackageTarLayerMediaType = 'application/vnd.github.actions.package.layer.v1.tar+gzip';
exports.actionsPackageZipLayerMediaType = 'application/vnd.github.actions.package.layer.v1.zip';
exports.sigstoreBundleMediaType = 'application/vnd.dev.sigstore.bundle.v0.3+json';
exports.actionPackageAnnotationValue = 'actions_oci_pkg';
exports.actionPackageAttestationAnnotationValue = 'actions_oci_pkg_attestation';
exports.actionPackageReferrerTagAnnotationValue = 'actions_oci_pkg_referrer_tag';
exports.ociEmptyMediaType = 'application/vnd.oci.empty.v1+json';
exports.emptyConfigSize = 2;
exports.emptyConfigSha = 'sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a';
@@ -107035,15 +107043,15 @@ function createActionPackageManifest(tarFile, zipFile, repository, repoId, owner
const zipLayer = createZipLayer(zipFile, sanitizedRepo, version);
const manifest = {
schemaVersion: 2,
mediaType: imageManifestMediaType,
artifactType: actionsPackageMediaType,
mediaType: exports.imageManifestMediaType,
artifactType: exports.actionsPackageMediaType,
config: configLayer,
layers: [configLayer, tarLayer, zipLayer],
annotations: {
'org.opencontainers.image.created': created.toISOString(),
'action.tar.gz.digest': tarFile.sha256,
'action.zip.digest': zipFile.sha256,
'com.github.package.type': actionPackageAnnotationValue,
'com.github.package.type': exports.actionPackageAnnotationValue,
'com.github.package.version': version,
'com.github.source.repo.id': repoId,
'com.github.source.repo.owner.id': ownerId,
@@ -107055,26 +107063,26 @@ function createActionPackageManifest(tarFile, zipFile, repository, repoId, owner
function createSigstoreAttestationManifest(bundleSize, bundleDigest, subjectSize, subjectDigest, created = new Date()) {
const configLayer = createConfigLayer();
const sigstoreAttestationLayer = {
mediaType: sigstoreBundleMediaType,
mediaType: exports.sigstoreBundleMediaType,
size: bundleSize,
digest: bundleDigest
};
const subject = {
mediaType: imageManifestMediaType,
mediaType: exports.imageManifestMediaType,
size: subjectSize,
digest: subjectDigest
};
const manifest = {
schemaVersion: 2,
mediaType: imageManifestMediaType,
artifactType: sigstoreBundleMediaType,
mediaType: exports.imageManifestMediaType,
artifactType: exports.sigstoreBundleMediaType,
config: configLayer,
layers: [sigstoreAttestationLayer],
subject,
annotations: {
'dev.sigstore.bundle.content': 'dsse-envelope',
'dev.sigstore.bundle.predicateType': 'https://slsa.dev/provenance/v1',
'com.github.package.type': actionPackageAttestationAnnotationValue,
'com.github.package.type': exports.actionPackageAttestationAnnotationValue,
'org.opencontainers.image.created': created.toISOString()
}
};
@@ -107083,15 +107091,15 @@ function createSigstoreAttestationManifest(bundleSize, bundleDigest, subjectSize
function createReferrerTagManifest(attestationDigest, attestationSize, attestationCreated, created = new Date()) {
const manifest = {
schemaVersion: 2,
mediaType: imageIndexMediaType,
mediaType: exports.imageIndexMediaType,
manifests: [
{
mediaType: imageManifestMediaType,
artifactType: sigstoreBundleMediaType,
mediaType: exports.imageManifestMediaType,
artifactType: exports.sigstoreBundleMediaType,
size: attestationSize,
digest: attestationDigest,
annotations: {
'com.github.package.type': actionPackageAttestationAnnotationValue,
'com.github.package.type': exports.actionPackageAttestationAnnotationValue,
'org.opencontainers.image.created': attestationCreated.toISOString(),
'dev.sigstore.bundle.content': 'dsse-envelope',
'dev.sigstore.bundle.predicateType': 'https://slsa.dev/provenance/v1'
@@ -107099,7 +107107,7 @@ function createReferrerTagManifest(attestationDigest, attestationSize, attestati
}
],
annotations: {
'com.github.package.type': actionPackageReferrerTagAnnotationValue,
'com.github.package.type': exports.actionPackageReferrerTagAnnotationValue,
'org.opencontainers.image.created': created.toISOString()
}
};
@@ -107129,7 +107137,7 @@ function createConfigLayer() {
}
function createZipLayer(zipFile, repository, version) {
const zipLayer = {
mediaType: actionsPackageZipLayerMediaType,
mediaType: exports.actionsPackageZipLayerMediaType,
size: zipFile.size,
digest: zipFile.sha256,
annotations: {
@@ -107140,7 +107148,7 @@ function createZipLayer(zipFile, repository, version) {
}
function createTarLayer(tarFile, repository, version) {
const tarLayer = {
mediaType: actionsPackageTarLayerMediaType,
mediaType: exports.actionsPackageTarLayerMediaType,
size: tarFile.size,
digest: tarFile.sha256,
annotations: {