feat(base-images): add managed base image bundles with cache retention, hosted manifests, and opt-in integration boot testing
This commit is contained in:
+123
-2
@@ -16,6 +16,127 @@ export interface ISmartVMOptions {
|
||||
bridgeName?: string;
|
||||
/** Network subnet in CIDR notation. Defaults to '172.30.0.0/24'. */
|
||||
subnet?: string;
|
||||
/** Directory for cached base images. Defaults to /tmp/.smartvm/base-images. */
|
||||
baseImageCacheDir?: string;
|
||||
/** Maximum number of cached base image bundles. Defaults to 2. */
|
||||
maxStoredBaseImages?: number;
|
||||
/** Hosted/project-owned base image manifest URL. */
|
||||
baseImageManifestUrl?: string;
|
||||
/** Local hosted/project-owned base image manifest path for development and tests. */
|
||||
baseImageManifestPath?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Predefined base image sources for integration testing and quick starts.
|
||||
*/
|
||||
export type TBaseImagePreset = 'latest' | 'lts' | 'hosted';
|
||||
|
||||
/**
|
||||
* Root filesystem image type used by a base image bundle.
|
||||
*/
|
||||
export type TBaseImageRootfsType = 'ext4' | 'squashfs';
|
||||
|
||||
/**
|
||||
* Options for the BaseImageManager.
|
||||
*/
|
||||
export interface IBaseImageManagerOptions {
|
||||
/** Architecture to resolve. Defaults to x86_64. */
|
||||
arch?: TFirecrackerArch;
|
||||
/** Directory for cached base image bundles. Defaults to /tmp/.smartvm/base-images. */
|
||||
cacheDir?: string;
|
||||
/** Maximum number of cached base image bundles. Defaults to 2. */
|
||||
maxStoredBaseImages?: number;
|
||||
/** Hosted base image manifest URL for project-owned bundles. */
|
||||
hostedManifestUrl?: string;
|
||||
/** Local hosted base image manifest path for development and tests. */
|
||||
hostedManifestPath?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when resolving or downloading a base image bundle.
|
||||
*/
|
||||
export interface IEnsureBaseImageOptions {
|
||||
/** Preset to use. Defaults to latest. */
|
||||
preset?: TBaseImagePreset;
|
||||
/** Architecture to resolve. Defaults to manager architecture. */
|
||||
arch?: TFirecrackerArch;
|
||||
/** Redownload even if the bundle already exists locally. */
|
||||
forceDownload?: boolean;
|
||||
/** Hosted base image manifest URL. Overrides preset resolution. */
|
||||
manifestUrl?: string;
|
||||
/** Local hosted base image manifest path. Overrides preset resolution. */
|
||||
manifestPath?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Single hosted base image artifact in a manifest.
|
||||
*/
|
||||
export interface IBaseImageArtifactManifest {
|
||||
/** Public URL for hosted artifacts. */
|
||||
url?: string;
|
||||
/** Local path for development/tests. */
|
||||
path?: string;
|
||||
/** Optional plain output filename. Defaults to basename of url/path. */
|
||||
fileName?: string;
|
||||
/** Expected SHA256 for verification. Required when url is used. */
|
||||
sha256?: string;
|
||||
/** Expected file size in bytes. */
|
||||
sizeBytes?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hosted/project-owned base image manifest format.
|
||||
*/
|
||||
export interface IBaseImageHostedManifest {
|
||||
schemaVersion: 1;
|
||||
bundleId: string;
|
||||
name?: string;
|
||||
arch: TFirecrackerArch;
|
||||
firecrackerVersion: string;
|
||||
rootfsType: TBaseImageRootfsType;
|
||||
rootfsIsReadOnly?: boolean;
|
||||
bootArgs?: string;
|
||||
kernel: IBaseImageArtifactManifest;
|
||||
rootfs: IBaseImageArtifactManifest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cached base image bundle metadata.
|
||||
*/
|
||||
export interface IBaseImageBundle {
|
||||
preset: TBaseImagePreset;
|
||||
arch: TFirecrackerArch;
|
||||
ciVersion: string;
|
||||
firecrackerVersion: string;
|
||||
bundleId: string;
|
||||
bundleDir: string;
|
||||
kernelImagePath: string;
|
||||
rootfsPath: string;
|
||||
rootfsType: TBaseImageRootfsType;
|
||||
rootfsIsReadOnly: boolean;
|
||||
bootArgs: string;
|
||||
source: {
|
||||
type?: 'firecracker-ci' | 'hosted-manifest';
|
||||
bucketUrl?: string;
|
||||
kernelKey?: string;
|
||||
rootfsKey?: string;
|
||||
manifestUrl?: string;
|
||||
manifestPath?: string;
|
||||
kernelUrl?: string;
|
||||
rootfsUrl?: string;
|
||||
kernelSourcePath?: string;
|
||||
rootfsSourcePath?: string;
|
||||
};
|
||||
checksums?: {
|
||||
kernelSha256?: string;
|
||||
rootfsSha256?: string;
|
||||
};
|
||||
sizes?: {
|
||||
kernelBytes?: number;
|
||||
rootfsBytes?: number;
|
||||
};
|
||||
createdAt: string;
|
||||
lastAccessedAt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,9 +263,9 @@ export interface ILoggerConfig {
|
||||
logPath: string;
|
||||
/** Log level. */
|
||||
level?: TLogLevel;
|
||||
/** Whether to show log origin (file, line). */
|
||||
showLevel?: boolean;
|
||||
/** Whether to show log level. */
|
||||
showLevel?: boolean;
|
||||
/** Whether to show log origin (file, line). */
|
||||
showLogOrigin?: boolean;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user