From 2cf18790facb4d4703e337c03f2e574dfdd1debb Mon Sep 17 00:00:00 2001 From: frostebite Date: Sun, 15 Nov 2026 15:46:38 +0000 Subject: [PATCH 1/2] feat(steam-deploy): support explicit depot IDs --- plugins/steam-deploy/README.md | 14 ++++ .../steam-deploy/src/parse-steamcmd-output.ts | 11 +++- .../steam-deploy/src/steam-deploy-command.ts | 64 +++++++++++++++---- 3 files changed, 76 insertions(+), 13 deletions(-) diff --git a/plugins/steam-deploy/README.md b/plugins/steam-deploy/README.md index b8d7b52c..19c48001 100644 --- a/plugins/steam-deploy/README.md +++ b/plugins/steam-deploy/README.md @@ -9,3 +9,17 @@ either locally or in Docker. Credentials are read from the environment (never passed as CLI arguments, since argv can leak through process listings and command logging). + +For apps with non-consecutive depot IDs, set `--depotId` for the primary depot +and `--depotNId` alongside each extra `--depotNPath`. For example: + +```sh +game-ci deploy steam steam-build \ + --appId 1136510 --depotId 1136514 --depotPath windows \ + --depot1Id 1136517 --depot1Path macos \ + --depot2Id 1136518 --depot2Path linux --branch beta +``` + +If the primary depot is not part of the build, pass `--skipPrimaryDepot` and +configure at least one extra depot path. Extra depot IDs default to the primary +ID plus their slot number; empty slots do not renumber later depots. diff --git a/plugins/steam-deploy/src/parse-steamcmd-output.ts b/plugins/steam-deploy/src/parse-steamcmd-output.ts index 869ff8bf..b39d8df4 100644 --- a/plugins/steam-deploy/src/parse-steamcmd-output.ts +++ b/plugins/steam-deploy/src/parse-steamcmd-output.ts @@ -31,7 +31,8 @@ export function parseSteamCmdOutput(output: string, exitCode: number): SteamCmdP const successConfirmed = /Successfully finished/.test(output); const disconnected = /disconnected from steam/i.test(output); - const errorBuild = /ERROR!.*Build for depot.*failed/.test(output); + const errorBuildMatch = /ERROR!.*Build for depot\s+(\d+).*failed/i.exec(output); + const errorBuild = /ERROR!.*Build for depot.*failed/i.test(output); const errorChunks = /ERROR!.*Failed to get list of missing chunks/.test(output); const loginFailed = /Logging in.*FAILED|Login Failure/i.exec(output); @@ -46,7 +47,13 @@ export function parseSteamCmdOutput(output: string, exitCode: number): SteamCmdP const reasons: string[] = []; if (disconnected) reasons.push("Steam connection dropped (request revoked)"); if (errorChunks) reasons.push("failed to get list of missing chunks (lost connection)"); - if (errorBuild) reasons.push("depot build reported failure"); + if (errorBuild) { + reasons.push( + errorBuildMatch + ? `depot build reported failure for depot ${errorBuildMatch[1]}` + : "depot build reported failure", + ); + } if (loginFailed) reasons.push("login failed"); if (reasons.length === 0) { // No known failure signature matched - surface the tail of the actual diff --git a/plugins/steam-deploy/src/steam-deploy-command.ts b/plugins/steam-deploy/src/steam-deploy-command.ts index b74c4092..3f4c1a82 100644 --- a/plugins/steam-deploy/src/steam-deploy-command.ts +++ b/plugins/steam-deploy/src/steam-deploy-command.ts @@ -22,6 +22,8 @@ export interface SteamDeployOptions { * sequence starts - matches steam-deploy's own firstDepotIdOverride input. */ firstDepotIdOverride?: string; + /** Do not build the primary --depotId depot; useful when only extra depots are configured. */ + skipPrimaryDepot?: boolean; depotPath?: string; depotInstallScriptPath?: string; /** Each entry "localPath=depotPath" - replaces the primary depot's single depotPath mapping with explicit FileMapping blocks. */ @@ -89,6 +91,11 @@ export class SteamDeployCommand { "Depot ID to start numbering extra depots (depot1Path..depot9Path) from. Defaults to depotId+1, depotId+2, ...", type: "string", }) + .option("skipPrimaryDepot", { + describe: "Do not include the primary --depotId depot in this app build.", + type: "boolean", + default: false, + }) .option("depotPath", { describe: "Path (relative to the build) mapped by the primary --depotId depot. Defaults to the whole build.", type: "string", @@ -112,6 +119,10 @@ export class SteamDeployCommand { for (let index = 1; index <= MAX_EXTRA_DEPOTS; index++) { yargs + .option(`depot${index}Id`, { + describe: `Explicit Steam depot ID for extra depot #${index}. Defaults to depotId+${index} (or firstDepotIdOverride+${index - 1}).`, + type: "string", + }) .option(`depot${index}Path`, { describe: `Path (relative to the build) mapped by extra depot #${index}, beyond the primary --depotId depot.`, type: "string", @@ -161,6 +172,16 @@ export class SteamDeployCommand { const includeDebugSymbols = options.debugBranch ?? false; const fileMappings = this.parseFileMappings(options.fileMapping); const fileProperties = this.parseFileProperties(options.fileProperty); + const skipPrimaryDepot = options.skipPrimaryDepot ?? false; + + if ( + skipPrimaryDepot && + (options.depotPath || options.depotInstallScriptPath || fileMappings || fileProperties || extraExclusions) + ) { + throw new Error( + "--skipPrimaryDepot cannot be combined with --depotPath, --depotInstallScriptPath, --fileMapping, --fileProperty, or --extraExclusions.", + ); + } const absoluteBuildPath = path.resolve(buildPath); const contentRoot = resolveUseDocker(mode, options.steamCmdPath) ? "/build" : absoluteBuildPath.replace(/\\/g, "/"); @@ -168,24 +189,40 @@ export class SteamDeployCommand { const extraDepots = this.collectExtraDepots(options, depotId); const primaryLocalPath = options.depotPath ? `./${options.depotPath.replace(/^\.?\/*/, "")}/*` : undefined; const allDepots = [ - { depotId, localPath: primaryLocalPath, installScript: options.depotInstallScriptPath }, - ...extraDepots, + ...(skipPrimaryDepot + ? [] + : [{ depotId, localPath: primaryLocalPath, installScript: options.depotInstallScriptPath, isPrimary: true }]), + ...extraDepots.map((depot) => ({ ...depot, isPrimary: false })), ]; + if (allDepots.length === 0) { + throw new Error("At least one depot path must be configured when --skipPrimaryDepot is set."); + } + + const configuredDepotIds = new Set(); + for (const depot of allDepots) { + if (!/^\d+$/.test(depot.depotId)) { + throw new Error(`Invalid Steam depot ID "${depot.depotId}": depot IDs must contain digits only.`); + } + if (configuredDepotIds.has(depot.depotId)) { + throw new Error(`Duplicate Steam depot ID "${depot.depotId}" in this app build.`); + } + configuredDepotIds.add(depot.depotId); + } + const depotEntries = allDepots.map((depot) => ({ depotId: depot.depotId, vdfFileName: `depot_build_${depot.depotId}.vdf`, })); for (const depot of allDepots) { - const isPrimaryDepot = depot.depotId === depotId; const depotVdf = generateDepotVdf({ depotId: depot.depotId, localPath: depot.localPath, - fileMappings: isPrimaryDepot ? fileMappings : undefined, - fileProperties: isPrimaryDepot ? fileProperties : undefined, + fileMappings: depot.isPrimary ? fileMappings : undefined, + fileProperties: depot.isPrimary ? fileProperties : undefined, installScript: depot.installScript, - extraExclusions: isPrimaryDepot ? extraExclusions : undefined, + extraExclusions: depot.isPrimary ? extraExclusions : undefined, includeDebugSymbols, }); fs.writeFileSync(path.join(absoluteBuildPath, `depot_build_${depot.depotId}.vdf`), depotVdf, "utf8"); @@ -264,9 +301,8 @@ export class SteamDeployCommand { /** * Reads depot1Path..depot9Path (+ matching depot{n}InstallScriptPath) and - * assigns each a sequential depot ID after the primary --depotId, starting - * from --firstDepotIdOverride if given - matches steam-deploy's own - * up-to-9-extra-depots convention. + * assigns each its explicit depotNId when supplied, otherwise deriving its + * ID from its slot (so unset slots do not renumber later depots). */ private collectExtraDepots( options: SteamDeployOptions, @@ -279,10 +315,16 @@ export class SteamDeployCommand { const extras: Array<{ depotId: string; localPath: string; installScript?: string }> = []; for (let index = 1; index <= MAX_EXTRA_DEPOTS; index++) { const localPath = options[`depot${index}Path`] as string | undefined; - if (!localPath) continue; + const explicitDepotId = options[`depot${index}Id`] as string | undefined; + if (!localPath) { + if (explicitDepotId) { + throw new Error(`--depot${index}Id requires --depot${index}Path.`); + } + continue; + } extras.push({ - depotId: String(firstExtraId + extras.length), + depotId: explicitDepotId ?? String(firstExtraId + index - 1), localPath: `./${localPath.replace(/^\.?\/*/, "")}/*`, installScript: options[`depot${index}InstallScriptPath`] as string | undefined, }); From 35e28e91a4134160dd26132cfb63a0b37f23ee75 Mon Sep 17 00:00:00 2001 From: frostebite Date: Sun, 15 Nov 2026 22:08:06 +0000 Subject: [PATCH 2/2] Validate derived Steam depot IDs --- plugins/steam-deploy/src/parse-steamcmd-output.ts | 2 +- plugins/steam-deploy/src/steam-deploy-command.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/steam-deploy/src/parse-steamcmd-output.ts b/plugins/steam-deploy/src/parse-steamcmd-output.ts index b39d8df4..3e6fdb32 100644 --- a/plugins/steam-deploy/src/parse-steamcmd-output.ts +++ b/plugins/steam-deploy/src/parse-steamcmd-output.ts @@ -33,7 +33,7 @@ export function parseSteamCmdOutput(output: string, exitCode: number): SteamCmdP const disconnected = /disconnected from steam/i.test(output); const errorBuildMatch = /ERROR!.*Build for depot\s+(\d+).*failed/i.exec(output); const errorBuild = /ERROR!.*Build for depot.*failed/i.test(output); - const errorChunks = /ERROR!.*Failed to get list of missing chunks/.test(output); + const errorChunks = /ERROR!.*Failed to get list of missing chunks/i.test(output); const loginFailed = /Logging in.*FAILED|Login Failure/i.exec(output); if (successConfirmed) { diff --git a/plugins/steam-deploy/src/steam-deploy-command.ts b/plugins/steam-deploy/src/steam-deploy-command.ts index 3f4c1a82..6b19ccf5 100644 --- a/plugins/steam-deploy/src/steam-deploy-command.ts +++ b/plugins/steam-deploy/src/steam-deploy-command.ts @@ -163,6 +163,14 @@ export class SteamDeployCommand { const appId = options.appId!; const depotId = options.depotId!; + if (!/^\d+$/.test(depotId)) { + throw new Error(`Invalid Steam depot ID "${depotId}": depot IDs must contain digits only.`); + } + if (options.firstDepotIdOverride && !/^\d+$/.test(options.firstDepotIdOverride)) { + throw new Error( + `Invalid first depot ID override "${options.firstDepotIdOverride}": depot IDs must contain digits only.`, + ); + } const branch = options.branch ?? "default"; const description = options.description ?? `${branch} build ${new Date().toISOString()}`; const mode = (options.mode ?? "auto") as "auto" | "local" | "docker";