another take on an empty config

Signed-off-by: Brian DeHamer <[email protected]>
This commit is contained in:
Brian DeHamer
2025-04-10 08:47:16 -07:00
parent 6e1e49a5d4
commit 99cf707746
Generated Vendored
+15 -11
View File
@@ -95448,8 +95448,9 @@ exports.HTTPError = HTTPError;
const ensureStatus = (expectedStatus) => {
return (response) => {
if (response.status !== expectedStatus) {
const e = response.text();
throw new HTTPError({
message: `Error fetching ${response.url} - expected ${expectedStatus}, received ${response.status}`,
message: `Error fetching ${response.url} - expected ${expectedStatus}, received ${response.status}: ${e}`,
status: response.status,
});
}
@@ -95603,13 +95604,7 @@ const error_1 = __nccwpck_require__(34031);
const registry_1 = __nccwpck_require__(26198);
const DOCKER_DEFAULT_REGISTRY = 'registry-1.docker.io';
const EMPTY_BLOB = Buffer.from('{}');
const ALT_EMPTY_BLOB = Buffer.from('');
const EMPTY_DESCRIPTOR = {
mediaType: constants_1.CONTENT_TYPE_EMPTY_DESCRIPTOR,
digest: 'sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a',
size: 2,
data: 'e30=',
};
const ALT_EMPTY_BLOB = Buffer.from('{ }');
class OCIImage {
constructor(image, creds, opts) {
_OCIImage_instances.add(this);
@@ -95633,12 +95628,15 @@ class OCIImage {
// Upload the artifact blob
const artifactBlob = await __classPrivateFieldGet(this, _OCIImage_client, "f").uploadBlob(opts.artifact);
// Upload the empty blob (needed for the manifest config)
// const emptyBlob = await this.#client.uploadBlob(ALT_EMPTY_BLOB);
const emptyBlob = await __classPrivateFieldGet(this, _OCIImage_client, "f").uploadBlob(ALT_EMPTY_BLOB);
// Construct artifact manifest
const manifest = buildManifest({
artifactDescriptor: { ...artifactBlob, mediaType: opts.mediaType },
subjectDescriptor: imageDescriptor,
configDescriptor: EMPTY_DESCRIPTOR,
configDescriptor: {
...emptyBlob,
mediaType: constants_1.CONTENT_TYPE_EMPTY_DESCRIPTOR,
},
annotations,
});
// Upload artifact manifest
@@ -96023,7 +96021,13 @@ class RegistryClient {
if (options.etag) {
headers[constants_1.HEADER_IF_MATCH] = options.etag;
}
const response = await __classPrivateFieldGet(this, _RegistryClient_fetch, "f").call(this, `${__classPrivateFieldGet(this, _RegistryClient_baseURL, "f")}/v2/${__classPrivateFieldGet(this, _RegistryClient_repository, "f")}/manifests/${reference}`, { method: 'PUT', body: manifest, headers }).then((0, error_1.ensureStatus)(201));
const response = await __classPrivateFieldGet(this, _RegistryClient_fetch, "f").call(this, `${__classPrivateFieldGet(this, _RegistryClient_baseURL, "f")}/v2/${__classPrivateFieldGet(this, _RegistryClient_repository, "f")}/manifests/${reference}`, { method: 'PUT', body: manifest, headers })
.then(async (r) => {
const e = await r.text();
proc_log_1.log.http('message', e);
return r;
})
.then((0, error_1.ensureStatus)(201));
const subjectDigest = response.headers.get(constants_1.HEADER_OCI_SUBJECT) || undefined;
return {
mediaType: contentType,