Restrict launches to prepared runtimes (Refs #93)
CI / checks (push) Successful in 4m53s

This commit is contained in:
2026-10-09 17:15:15 -04:00
parent f0afd6de67
commit 596b160be3
36 changed files with 347 additions and 116 deletions
+11 -9
View File
@@ -140,7 +140,7 @@ function hostFromRow(row: HostRow): Host {
)
reasons.push('Insufficient available game storage.');
const infrastructureReady = reasons.length === 0;
const runtimeReady = !!inventory.runtimeImages?.length;
const runtimeReady = !!inventory.preparedRuntimeImages?.length;
const libraryReady = !!inventory.libraries?.some((library) => library.state === 'ready');
if (!runtimeReady) reasons.push('The Plutainer runtime image is not ready yet.');
if (!libraryReady) reasons.push('No verified game-file library is available yet.');
@@ -676,12 +676,14 @@ export function validateInventory(value: unknown): HostInventory {
for (const key of ['dockerRunning', 'directoriesWritable'])
if (inventory[key] !== undefined && typeof inventory[key] !== 'boolean')
throw new Error(`Invalid inventory ${key}.`);
if (
inventory.runtimeImages !== undefined &&
(!Array.isArray(inventory.runtimeImages) ||
inventory.runtimeImages.some((image) => typeof image !== 'string'))
)
throw new Error('Invalid runtime image inventory.');
for (const key of ['runtimeImages', 'preparedRuntimeImages'] as const) {
const images = inventory[key];
if (
images !== undefined &&
(!Array.isArray(images) || images.some((image) => typeof image !== 'string'))
)
throw new Error('Invalid runtime image inventory.');
}
if (
inventory.capabilities !== undefined &&
(!Array.isArray(inventory.capabilities) ||
@@ -952,8 +954,8 @@ export function requireReadyHost(
)
)
reasons.push('The selected game library is not ready on this host.');
if (options.image && !host.inventory.runtimeImages?.includes(options.image))
reasons.push('The selected runtime image is not cached on this host.');
if (options.image && !host.inventory.preparedRuntimeImages?.includes(options.image))
reasons.push('The selected runtime image is not prepared on this host.');
if (
options.port !== undefined &&
!hostPortAvailable(hostId, options.port, options.bindAddress, options.protocol)