mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-22 19:06:09 +08:00
oci: loadArchive to import an index from a tar archive image bundle
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
2941f52b66
commit
6fb52d2a23
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,2 +1,3 @@
|
||||
/.yarn/releases/** binary
|
||||
/.yarn/plugins/** binary
|
||||
/__tests__/fixtures/oci-archive/** binary
|
||||
|
@ -14,7 +14,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM busybox
|
||||
FROM busybox AS build
|
||||
ARG NAME=foo
|
||||
ARG TARGETPLATFORM
|
||||
RUN echo "Hello $NAME from $TARGETPLATFORM"
|
||||
RUN echo "Hello $NAME from $TARGETPLATFORM" > foo
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /foo /
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
__tests__/fixtures/oci-archive/hello-oci-gzip.tar
Normal file
BIN
__tests__/fixtures/oci-archive/hello-oci-gzip.tar
Normal file
Binary file not shown.
BIN
__tests__/fixtures/oci-archive/hello-oci-multiplatform-gzip.tar
Normal file
BIN
__tests__/fixtures/oci-archive/hello-oci-multiplatform-gzip.tar
Normal file
Binary file not shown.
BIN
__tests__/fixtures/oci-archive/hello-oci-uncompressed.tar
Normal file
BIN
__tests__/fixtures/oci-archive/hello-oci-uncompressed.tar
Normal file
Binary file not shown.
BIN
__tests__/fixtures/oci-archive/hello-oci-zstd.tar
Normal file
BIN
__tests__/fixtures/oci-archive/hello-oci-zstd.tar
Normal file
Binary file not shown.
BIN
__tests__/fixtures/oci-archive/moby~buildkit~LWDOW6.dockerbuild
Normal file
BIN
__tests__/fixtures/oci-archive/moby~buildkit~LWDOW6.dockerbuild
Normal file
Binary file not shown.
50
__tests__/oci/oci.test.ts
Normal file
50
__tests__/oci/oci.test.ts
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {afterEach, beforeEach, describe, expect, jest, test} from '@jest/globals';
|
||||
import * as fs from 'fs';
|
||||
import path from 'path';
|
||||
import * as rimraf from 'rimraf';
|
||||
|
||||
import {OCI} from '../../src/oci/oci';
|
||||
|
||||
const fixturesDir = path.join(__dirname, '..', 'fixtures');
|
||||
|
||||
// prettier-ignore
|
||||
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-jest');
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
rimraf.sync(tmpDir);
|
||||
});
|
||||
|
||||
describe('loadArchive', () => {
|
||||
// prettier-ignore
|
||||
test.each(fs.readdirSync(path.join(fixturesDir, 'oci-archive')).filter(file => {
|
||||
return fs.statSync(path.join(path.join(fixturesDir, 'oci-archive'), file)).isFile();
|
||||
}).map(filename => [filename]))('extracting %p', async (filename) => {
|
||||
const res = await OCI.loadArchive({
|
||||
file: path.join(fixturesDir, 'oci-archive', filename)
|
||||
});
|
||||
expect(res).toBeDefined();
|
||||
expect(res?.root.index).toBeDefined();
|
||||
expect(res?.root.layout).toBeDefined();
|
||||
// console.log(JSON.stringify(res, null, 2));
|
||||
});
|
||||
});
|
@ -58,17 +58,21 @@
|
||||
"@octokit/plugin-rest-endpoint-methods": "^10.4.0",
|
||||
"async-retry": "^1.3.3",
|
||||
"csv-parse": "^5.5.6",
|
||||
"gunzip-maybe": "^1.4.2",
|
||||
"handlebars": "^4.7.8",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jwt-decode": "^4.0.0",
|
||||
"semver": "^7.6.2",
|
||||
"tar-stream": "^3.1.7",
|
||||
"tmp": "^0.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/csv-parse": "^1.2.2",
|
||||
"@types/gunzip-maybe": "^1.4.2",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^20.12.10",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/tar-stream": "^3.1.3",
|
||||
"@types/tmp": "^0.2.6",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
|
163
src/oci/oci.ts
Normal file
163
src/oci/oci.ts
Normal file
@ -0,0 +1,163 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import fs from 'fs';
|
||||
import gunzip from 'gunzip-maybe';
|
||||
import * as path from 'path';
|
||||
import {Readable} from 'stream';
|
||||
import * as tar from 'tar-stream';
|
||||
|
||||
import {Archive, LoadArchiveOpts} from '../types/oci/oci';
|
||||
import {Index} from '../types/oci';
|
||||
import {Manifest} from '../types/oci/manifest';
|
||||
import {Image} from '../types/oci/config';
|
||||
import {IMAGE_BLOBS_DIR_V1, IMAGE_INDEX_FILE_V1, IMAGE_LAYOUT_FILE_V1, ImageLayout} from '../types/oci/layout';
|
||||
import {MEDIATYPE_IMAGE_INDEX_V1, MEDIATYPE_IMAGE_MANIFEST_V1} from '../types/oci/mediatype';
|
||||
|
||||
export class OCI {
|
||||
public static loadArchive(opts: LoadArchiveOpts): Promise<Archive> {
|
||||
return new Promise<Archive>((resolve, reject) => {
|
||||
const tarex: tar.Extract = tar.extract();
|
||||
|
||||
let rootIndex: Index;
|
||||
let rootLayout: ImageLayout;
|
||||
const indexes: Record<string, Index> = {};
|
||||
const manifests: Record<string, Manifest> = {};
|
||||
const images: Record<string, Image> = {};
|
||||
const blobs: Record<string, unknown> = {};
|
||||
|
||||
tarex.on('entry', async (header, stream, next) => {
|
||||
if (header.type === 'file') {
|
||||
const filename = path.normalize(header.name);
|
||||
if (filename === IMAGE_INDEX_FILE_V1) {
|
||||
rootIndex = await OCI.streamToJson<Index>(stream);
|
||||
} else if (filename === IMAGE_LAYOUT_FILE_V1) {
|
||||
rootLayout = await OCI.streamToJson<ImageLayout>(stream);
|
||||
} else if (filename.startsWith(path.join(IMAGE_BLOBS_DIR_V1, path.sep))) {
|
||||
const blob = await OCI.extractBlob(stream);
|
||||
const digest = `${filename.split(path.sep)[1]}:${filename.split(path.sep)[filename.split(path.sep).length - 1]}`;
|
||||
if (OCI.isIndex(blob)) {
|
||||
indexes[digest] = <Index>JSON.parse(blob);
|
||||
} else if (OCI.isManifest(blob)) {
|
||||
manifests[digest] = <Manifest>JSON.parse(blob);
|
||||
} else if (OCI.isImage(blob)) {
|
||||
images[digest] = <Image>JSON.parse(blob);
|
||||
} else {
|
||||
blobs[digest] = blob;
|
||||
}
|
||||
} else {
|
||||
reject(new Error(`Invalid OCI archive: unexpected file ${filename}`));
|
||||
}
|
||||
}
|
||||
stream.resume();
|
||||
next();
|
||||
});
|
||||
|
||||
tarex.on('finish', () => {
|
||||
if (!rootIndex || !rootLayout) {
|
||||
reject(new Error('Invalid OCI archive: missing index or layout'));
|
||||
}
|
||||
resolve({
|
||||
root: {
|
||||
index: rootIndex,
|
||||
layout: rootLayout
|
||||
},
|
||||
indexes: indexes,
|
||||
manifests: manifests,
|
||||
images: images,
|
||||
blobs: blobs
|
||||
} as Archive);
|
||||
});
|
||||
|
||||
tarex.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
|
||||
fs.createReadStream(opts.file).pipe(gunzip()).pipe(tarex);
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private static isIndex(blob: any): boolean {
|
||||
try {
|
||||
const index = <Index>JSON.parse(blob);
|
||||
return index.mediaType === MEDIATYPE_IMAGE_INDEX_V1;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private static isManifest(blob: any): boolean {
|
||||
try {
|
||||
const manifest = <Manifest>JSON.parse(blob);
|
||||
return manifest.mediaType === MEDIATYPE_IMAGE_MANIFEST_V1 && manifest.layers.length > 0;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private static isImage(blob: any): boolean {
|
||||
try {
|
||||
const image = <Image>JSON.parse(blob);
|
||||
return image.rootfs.type !== '';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private static extractBlob(stream: Readable): Promise<any> {
|
||||
return new Promise<unknown>((resolve, reject) => {
|
||||
const chunks: Buffer[] = [];
|
||||
const dstream = stream.pipe(gunzip());
|
||||
dstream.on('data', chunk => {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
dstream.on('end', () => {
|
||||
resolve(Buffer.concat(chunks).toString('utf8'));
|
||||
});
|
||||
dstream.on('error', async error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static async streamToJson<T>(stream: Readable): Promise<T> {
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
const chunks: string[] = [];
|
||||
let bytes = 0;
|
||||
stream.on('data', chunk => {
|
||||
bytes += chunk.length;
|
||||
if (bytes <= 2 * 1024 * 1024) {
|
||||
chunks.push(chunk.toString('utf8'));
|
||||
} else {
|
||||
reject(new Error('The data stream exceeds the size limit for JSON parsing.'));
|
||||
}
|
||||
});
|
||||
stream.on('end', () => {
|
||||
try {
|
||||
resolve(JSON.parse(chunks.join('')));
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
stream.on('error', async error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
52
src/types/oci/config.ts
Normal file
52
src/types/oci/config.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {Digest} from './digest';
|
||||
import {Platform} from './descriptor';
|
||||
|
||||
export interface ImageConfig {
|
||||
User?: string;
|
||||
ExposedPorts?: Record<string, unknown>;
|
||||
Env?: string[];
|
||||
Entrypoint?: string[];
|
||||
Cmd?: string[];
|
||||
Volumes?: Record<string, unknown>;
|
||||
WorkingDir?: string;
|
||||
Labels?: Record<string, string>;
|
||||
StopSignal?: string;
|
||||
ArgsEscaped?: boolean;
|
||||
}
|
||||
|
||||
export interface RootFS {
|
||||
type: string;
|
||||
diff_ids: Digest[];
|
||||
}
|
||||
|
||||
export interface History {
|
||||
created?: string; // assuming RFC 3339 formatted string
|
||||
created_by?: string;
|
||||
author?: string;
|
||||
comment?: string;
|
||||
empty_layer?: boolean;
|
||||
}
|
||||
|
||||
export interface Image extends Platform {
|
||||
created?: string; // assuming RFC 3339 formatted string
|
||||
author?: string;
|
||||
config?: ImageConfig;
|
||||
rootfs: RootFS;
|
||||
history?: History[];
|
||||
}
|
45
src/types/oci/descriptor.ts
Normal file
45
src/types/oci/descriptor.ts
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {Digest} from './digest';
|
||||
|
||||
import {MEDIATYPE_EMPTY_JSON_V1} from './mediatype';
|
||||
|
||||
export interface Descriptor {
|
||||
mediaType: string;
|
||||
digest: Digest;
|
||||
size: number;
|
||||
urls?: string[];
|
||||
annotations?: Record<string, string>;
|
||||
data?: string;
|
||||
platform?: Platform;
|
||||
artifactType?: string;
|
||||
}
|
||||
|
||||
export interface Platform {
|
||||
architecture: string;
|
||||
os: string;
|
||||
'os.version'?: string;
|
||||
'os.features'?: string[];
|
||||
variant?: string;
|
||||
}
|
||||
|
||||
export const DescriptorEmptyJSON: Descriptor = {
|
||||
mediaType: MEDIATYPE_EMPTY_JSON_V1,
|
||||
digest: 'sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a',
|
||||
size: 2,
|
||||
data: '{}'
|
||||
};
|
17
src/types/oci/digest.ts
Normal file
17
src/types/oci/digest.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export type Digest = string;
|
26
src/types/oci/index.ts
Normal file
26
src/types/oci/index.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {Versioned} from './versioned';
|
||||
import {Descriptor} from './descriptor';
|
||||
|
||||
export interface Index extends Versioned {
|
||||
mediaType?: string;
|
||||
artifactType?: string;
|
||||
manifests: Descriptor[];
|
||||
subject?: Descriptor;
|
||||
annotations?: Record<string, string>;
|
||||
}
|
27
src/types/oci/layout.ts
Normal file
27
src/types/oci/layout.ts
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const IMAGE_LAYOUT_FILE_V1 = 'oci-layout';
|
||||
|
||||
export const IMAGE_LAYOUT_VERSION_V1 = '1.0.0';
|
||||
|
||||
export const IMAGE_INDEX_FILE_V1 = 'index.json';
|
||||
|
||||
export const IMAGE_BLOBS_DIR_V1 = 'blobs';
|
||||
|
||||
export interface ImageLayout {
|
||||
version: string;
|
||||
}
|
27
src/types/oci/manifest.ts
Normal file
27
src/types/oci/manifest.ts
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {Descriptor} from './descriptor';
|
||||
import {Versioned} from './versioned';
|
||||
|
||||
export interface Manifest extends Versioned {
|
||||
mediaType?: string;
|
||||
artifactType?: string;
|
||||
config: Descriptor;
|
||||
layers: Descriptor[];
|
||||
subject?: Descriptor;
|
||||
annotations?: Record<string, string>;
|
||||
}
|
25
src/types/oci/mediatype.ts
Normal file
25
src/types/oci/mediatype.ts
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const MEDIATYPE_DESCRIPTOR_V1 = 'application/vnd.oci.descriptor.v1+json';
|
||||
|
||||
export const MEDIATYPE_IMAGE_MANIFEST_V1 = 'application/vnd.oci.image.manifest.v1+json';
|
||||
|
||||
export const MEDIATYPE_IMAGE_INDEX_V1 = 'application/vnd.oci.image.index.v1+json';
|
||||
|
||||
export const MEDIATYPE_IMAGE_LAYER_V1 = 'application/vnd.oci.image.layer.v1.tar';
|
||||
|
||||
export const MEDIATYPE_EMPTY_JSON_V1 = 'application/vnd.oci.empty.v1+json';
|
36
src/types/oci/oci.ts
Normal file
36
src/types/oci/oci.ts
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {Index} from './index';
|
||||
import {ImageLayout} from './layout';
|
||||
import {Manifest} from './manifest';
|
||||
import {Image} from './config';
|
||||
|
||||
export interface LoadArchiveOpts {
|
||||
file: string;
|
||||
}
|
||||
|
||||
export interface Archive {
|
||||
root: {
|
||||
index: Index;
|
||||
layout: ImageLayout;
|
||||
};
|
||||
indexes: Record<string, Index>;
|
||||
manifests: Record<string, Manifest>;
|
||||
images: Record<string, Image>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
blobs: Record<string, any>;
|
||||
}
|
19
src/types/oci/versioned.ts
Normal file
19
src/types/oci/versioned.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright 2024 actions-toolkit authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export interface Versioned {
|
||||
schemaVersion: number;
|
||||
}
|
153
yarn.lock
153
yarn.lock
@ -1111,9 +1111,11 @@ __metadata:
|
||||
"@octokit/core": ^5.1.0
|
||||
"@octokit/plugin-rest-endpoint-methods": ^10.4.0
|
||||
"@types/csv-parse": ^1.2.2
|
||||
"@types/gunzip-maybe": ^1.4.2
|
||||
"@types/js-yaml": ^4.0.9
|
||||
"@types/node": ^20.12.10
|
||||
"@types/semver": ^7.5.8
|
||||
"@types/tar-stream": ^3.1.3
|
||||
"@types/tmp": ^0.2.6
|
||||
"@typescript-eslint/eslint-plugin": ^7.8.0
|
||||
"@typescript-eslint/parser": ^7.8.0
|
||||
@ -1125,6 +1127,7 @@ __metadata:
|
||||
eslint-plugin-import: ^2.29.1
|
||||
eslint-plugin-jest: ^28.5.0
|
||||
eslint-plugin-prettier: ^5.1.3
|
||||
gunzip-maybe: ^1.4.2
|
||||
handlebars: ^4.7.8
|
||||
jest: ^29.7.0
|
||||
js-yaml: ^4.1.0
|
||||
@ -1132,6 +1135,7 @@ __metadata:
|
||||
prettier: ^3.2.5
|
||||
rimraf: ^5.0.5
|
||||
semver: ^7.6.2
|
||||
tar-stream: ^3.1.7
|
||||
tmp: ^0.2.3
|
||||
ts-jest: ^29.1.2
|
||||
ts-node: ^10.9.2
|
||||
@ -2162,6 +2166,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/gunzip-maybe@npm:^1.4.2":
|
||||
version: 1.4.2
|
||||
resolution: "@types/gunzip-maybe@npm:1.4.2"
|
||||
dependencies:
|
||||
"@types/node": "*"
|
||||
checksum: 9be931d6b74ea4e28f2682e3aac6c242448128c6e06bee2e5758e8747ef51f231c46f11e27783092530f81c51f0a5ce6f87217e92e7e80b55e7132c7538e5f3e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/istanbul-lib-coverage@npm:*, @types/istanbul-lib-coverage@npm:^2.0.0, @types/istanbul-lib-coverage@npm:^2.0.1":
|
||||
version: 2.0.3
|
||||
resolution: "@types/istanbul-lib-coverage@npm:2.0.3"
|
||||
@ -2248,6 +2261,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/tar-stream@npm:^3.1.3":
|
||||
version: 3.1.3
|
||||
resolution: "@types/tar-stream@npm:3.1.3"
|
||||
dependencies:
|
||||
"@types/node": "*"
|
||||
checksum: 187387748288b35924284afc26cf36b6b966377f5131398bf484c475f7191c50f5e5903c94a7391049b6cdfce174ae2e63f776dea9425d94ddc6bd31ebe386ee
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/tmp@npm:^0.2.6":
|
||||
version: 0.2.6
|
||||
resolution: "@types/tmp@npm:0.2.6"
|
||||
@ -2942,6 +2964,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"browserify-zlib@npm:^0.1.4":
|
||||
version: 0.1.4
|
||||
resolution: "browserify-zlib@npm:0.1.4"
|
||||
dependencies:
|
||||
pako: ~0.2.0
|
||||
checksum: abee4cb4349e8a21391fd874564f41b113fe691372913980e6fa06a777e4ea2aad4e942af14ab99bce190d5ac8f5328201432f4ef0eae48c6d02208bc212976f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"browserslist@npm:^4.17.5":
|
||||
version: 4.19.3
|
||||
resolution: "browserslist@npm:4.19.3"
|
||||
@ -3627,6 +3658,18 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"duplexify@npm:^3.5.0, duplexify@npm:^3.6.0":
|
||||
version: 3.7.1
|
||||
resolution: "duplexify@npm:3.7.1"
|
||||
dependencies:
|
||||
end-of-stream: ^1.0.0
|
||||
inherits: ^2.0.1
|
||||
readable-stream: ^2.0.0
|
||||
stream-shift: ^1.0.0
|
||||
checksum: 3c2ed2223d956a5da713dae12ba8295acb61d9acd966ccbba938090d04f4574ca4dca75cca089b5077c2d7e66101f32e6ea9b36a78ca213eff574e7a8b8accf2
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eastasianwidth@npm:^0.2.0":
|
||||
version: 0.2.0
|
||||
resolution: "eastasianwidth@npm:0.2.0"
|
||||
@ -3678,6 +3721,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"end-of-stream@npm:^1.0.0, end-of-stream@npm:^1.1.0":
|
||||
version: 1.4.4
|
||||
resolution: "end-of-stream@npm:1.4.4"
|
||||
dependencies:
|
||||
once: ^1.4.0
|
||||
checksum: 530a5a5a1e517e962854a31693dbb5c0b2fc40b46dad2a56a2deec656ca040631124f4795823acc68238147805f8b021abbe221f4afed5ef3c8e8efc2024908b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"env-paths@npm:^2.2.0":
|
||||
version: 2.2.1
|
||||
resolution: "env-paths@npm:2.2.1"
|
||||
@ -4734,6 +4786,22 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"gunzip-maybe@npm:^1.4.2":
|
||||
version: 1.4.2
|
||||
resolution: "gunzip-maybe@npm:1.4.2"
|
||||
dependencies:
|
||||
browserify-zlib: ^0.1.4
|
||||
is-deflate: ^1.0.0
|
||||
is-gzip: ^1.0.0
|
||||
peek-stream: ^1.1.0
|
||||
pumpify: ^1.3.3
|
||||
through2: ^2.0.3
|
||||
bin:
|
||||
gunzip-maybe: bin.js
|
||||
checksum: bc4d4977c24a2860238df271de75d53dd72a359d19f1248d1c613807dc221d3b8ae09624e3085c8106663e3e1b59db62a85b261d1138c2cc24efad9df577d4e1
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"handlebars@npm:^4.7.8":
|
||||
version: 4.7.8
|
||||
resolution: "handlebars@npm:4.7.8"
|
||||
@ -4989,7 +5057,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"inherits@npm:2, inherits@npm:^2.0.3, inherits@npm:~2.0.3":
|
||||
"inherits@npm:2, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:~2.0.3":
|
||||
version: 2.0.4
|
||||
resolution: "inherits@npm:2.0.4"
|
||||
checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1
|
||||
@ -5153,6 +5221,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"is-deflate@npm:^1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "is-deflate@npm:1.0.0"
|
||||
checksum: c2f9f2d3db79ac50c5586697d1e69a55282a2b0cc5e437b3c470dd47f24e40b6216dcd7e024511e21381607bf57afa019343e3bd0e08a119032818b596004262
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"is-extglob@npm:^2.1.1":
|
||||
version: 2.1.1
|
||||
resolution: "is-extglob@npm:2.1.1"
|
||||
@ -5183,6 +5258,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"is-gzip@npm:^1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "is-gzip@npm:1.0.0"
|
||||
checksum: 0d28931c1f445fa29c900cf9f48e06e9d1d477a3bf7bd7332e7ce68f1333ccd8cb381de2f0f62a9a262d9c0912608a9a71b4a40e788e201b3dbd67072bb20d86
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"is-lambda@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "is-lambda@npm:1.0.1"
|
||||
@ -6591,7 +6673,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"once@npm:^1.3.0, once@npm:^1.4.0":
|
||||
"once@npm:^1.3.0, once@npm:^1.3.1, once@npm:^1.4.0":
|
||||
version: 1.4.0
|
||||
resolution: "once@npm:1.4.0"
|
||||
dependencies:
|
||||
@ -6675,6 +6757,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"pako@npm:~0.2.0":
|
||||
version: 0.2.9
|
||||
resolution: "pako@npm:0.2.9"
|
||||
checksum: 055f9487cd57fbb78df84315873bbdd089ba286f3499daed47d2effdc6253e981f5db6898c23486de76d4a781559f890d643bd3a49f70f1b4a18019c98aa5125
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"parent-module@npm:^1.0.0":
|
||||
version: 1.0.1
|
||||
resolution: "parent-module@npm:1.0.1"
|
||||
@ -6758,6 +6847,17 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"peek-stream@npm:^1.1.0":
|
||||
version: 1.1.3
|
||||
resolution: "peek-stream@npm:1.1.3"
|
||||
dependencies:
|
||||
buffer-from: ^1.0.0
|
||||
duplexify: ^3.5.0
|
||||
through2: ^2.0.3
|
||||
checksum: a0e09d6d1a8a01158a3334f20d6b1cdd91747eba24eb06a1d742eefb620385593121a76d4378cc81f77cdce6a66df0575a41041b1189c510254aec91878afc99
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"picocolors@npm:^1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "picocolors@npm:1.0.0"
|
||||
@ -6888,6 +6988,27 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"pump@npm:^2.0.0":
|
||||
version: 2.0.1
|
||||
resolution: "pump@npm:2.0.1"
|
||||
dependencies:
|
||||
end-of-stream: ^1.1.0
|
||||
once: ^1.3.1
|
||||
checksum: e9f26a17be00810bff37ad0171edb35f58b242487b0444f92fb7d78bc7d61442fa9b9c5bd93a43fd8fd8ddd3cc75f1221f5e04c790f42907e5baab7cf5e2b931
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"pumpify@npm:^1.3.3":
|
||||
version: 1.5.1
|
||||
resolution: "pumpify@npm:1.5.1"
|
||||
dependencies:
|
||||
duplexify: ^3.6.0
|
||||
inherits: ^2.0.3
|
||||
pump: ^2.0.0
|
||||
checksum: 26ca412ec8d665bd0d5e185c1b8f627728eff603440d75d22a58e421e3c66eaf86ec6fc6a6efc54808ecef65979279fa8e99b109a23ec1fa8d79f37e6978c9bd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"punycode@npm:^2.1.0":
|
||||
version: 2.1.1
|
||||
resolution: "punycode@npm:2.1.1"
|
||||
@ -6930,7 +7051,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"readable-stream@npm:^2.0.5":
|
||||
"readable-stream@npm:^2.0.0, readable-stream@npm:^2.0.5, readable-stream@npm:~2.3.6":
|
||||
version: 2.3.8
|
||||
resolution: "readable-stream@npm:2.3.8"
|
||||
dependencies:
|
||||
@ -7441,6 +7562,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"stream-shift@npm:^1.0.0":
|
||||
version: 1.0.3
|
||||
resolution: "stream-shift@npm:1.0.3"
|
||||
checksum: a24c0a3f66a8f9024bd1d579a533a53be283b4475d4e6b4b3211b964031447bdf6532dd1f3c2b0ad66752554391b7c62bd7ca4559193381f766534e723d50242
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"streamx@npm:^2.15.0":
|
||||
version: 2.16.1
|
||||
resolution: "streamx@npm:2.16.1"
|
||||
@ -7682,7 +7810,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tar-stream@npm:^3.0.0":
|
||||
"tar-stream@npm:^3.0.0, tar-stream@npm:^3.1.7":
|
||||
version: 3.1.7
|
||||
resolution: "tar-stream@npm:3.1.7"
|
||||
dependencies:
|
||||
@ -7725,6 +7853,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"through2@npm:^2.0.3":
|
||||
version: 2.0.5
|
||||
resolution: "through2@npm:2.0.5"
|
||||
dependencies:
|
||||
readable-stream: ~2.3.6
|
||||
xtend: ~4.0.1
|
||||
checksum: beb0f338aa2931e5660ec7bf3ad949e6d2e068c31f4737b9525e5201b824ac40cac6a337224856b56bd1ddd866334bbfb92a9f57cd6f66bc3f18d3d86fc0fe50
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tmp@npm:^0.2.3":
|
||||
version: 0.2.3
|
||||
resolution: "tmp@npm:0.2.3"
|
||||
@ -8403,6 +8541,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"xtend@npm:~4.0.1":
|
||||
version: 4.0.2
|
||||
resolution: "xtend@npm:4.0.2"
|
||||
checksum: ac5dfa738b21f6e7f0dd6e65e1b3155036d68104e67e5d5d1bde74892e327d7e5636a076f625599dc394330a731861e87343ff184b0047fef1360a7ec0a5a36a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"y18n@npm:^5.0.5":
|
||||
version: 5.0.8
|
||||
resolution: "y18n@npm:5.0.8"
|
||||
|
Loading…
Reference in New Issue
Block a user