From 280a10d107589711c805d0cd7dbe9c76d1d66ea4 Mon Sep 17 00:00:00 2001 From: frostebite Date: Thu, 5 Mar 2026 17:27:19 +0000 Subject: [PATCH] =?UTF-8?q?fix(cli):=20address=20review=20findings=20?= =?UTF-8?q?=E2=80=94=20exit=20codes,=20missing=20inputs,=20null=20safety?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add process.exit(1) in cli.ts catch block so failures produce non-zero exit codes - Add 6 missing build inputs: containerRegistryRepository, containerRegistryImageVersion, dockerIsolationMode, sshPublicKeysDirectoryPath, cacheUnityInstallationOnMac, unityHubVersionOnMac - Add 6 missing orchestrate inputs: kubeStorageClass, readInputFromOverrideList, readInputOverrideCommand, postBuildSteps, preBuildSteps, customJob - Fix activate command description to accurately reflect verification behavior - Add null check before accessing result.BuildResults in orchestrate handler Co-Authored-By: Claude Opus 4.6 --- src/cli.ts | 1 + src/cli/commands/activate.ts | 2 +- src/cli/commands/build.ts | 37 +++++++++++++++++++++++++++ src/cli/commands/orchestrate.ts | 45 ++++++++++++++++++++++++++++++++- src/cli/input-mapper.ts | 6 +++++ 5 files changed, 89 insertions(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 592866e9..926eb79d 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -34,6 +34,7 @@ async function main() { } catch (error: any) { if (error.name !== 'YError') { core.error(`Error: ${error.message}`); + process.exit(1); } } } diff --git a/src/cli/commands/activate.ts b/src/cli/commands/activate.ts index 4fd03683..910568f8 100644 --- a/src/cli/commands/activate.ts +++ b/src/cli/commands/activate.ts @@ -10,7 +10,7 @@ interface ActivateArguments extends CliArguments { const activateCommand: CommandModule = { command: 'activate', - describe: 'Activate a Unity license', + describe: 'Verify Unity license configuration', builder: (yargs) => { return yargs .option('unity-version', { diff --git a/src/cli/commands/build.ts b/src/cli/commands/build.ts index 719c87ea..2102f7fe 100644 --- a/src/cli/commands/build.ts +++ b/src/cli/commands/build.ts @@ -206,6 +206,43 @@ const buildCommand: CommandModule = { description: 'The Unity licensing server address', default: '', }) + .option('container-registry-repository', { + alias: 'containerRegistryRepository', + type: 'string', + description: 'Container registry and repository to pull image from. Only applicable if customImage is not set.', + default: 'unityci/editor', + }) + .option('container-registry-image-version', { + alias: 'containerRegistryImageVersion', + type: 'string', + description: 'Container registry image version. Only applicable if customImage is not set.', + default: '3', + }) + .option('docker-isolation-mode', { + alias: 'dockerIsolationMode', + type: 'string', + description: + 'Isolation mode to use for the docker container (process, hyperv, or default). Only applicable on Windows.', + default: 'default', + }) + .option('ssh-public-keys-directory-path', { + alias: 'sshPublicKeysDirectoryPath', + type: 'string', + description: 'Path to a directory containing SSH public keys to forward to the container', + default: '', + }) + .option('cache-unity-installation-on-mac', { + alias: 'cacheUnityInstallationOnMac', + type: 'boolean', + description: 'Whether to cache the Unity hub and editor installation on MacOS', + default: false, + }) + .option('unity-hub-version-on-mac', { + alias: 'unityHubVersionOnMac', + type: 'string', + description: 'The version of Unity Hub to install on MacOS (e.g. 3.4.0). Defaults to latest available on brew.', + default: '', + }) .example('game-ci build --target-platform StandaloneLinux64', 'Build for Linux using auto-detected Unity version') .example( 'game-ci build --target-platform Android --unity-version 2022.3.56f1 --build-method MyBuild.Run', diff --git a/src/cli/commands/orchestrate.ts b/src/cli/commands/orchestrate.ts index 59237e1d..8f681881 100644 --- a/src/cli/commands/orchestrate.ts +++ b/src/cli/commands/orchestrate.ts @@ -138,6 +138,45 @@ const orchestrateCommand: CommandModule = { description: 'Skip Unity activation/deactivation', default: 'false', }) + .option('kube-storage-class', { + alias: 'kubeStorageClass', + type: 'string', + description: 'Kubernetes storage class to use for orchestrator jobs. Leave empty to install rook cluster.', + default: '', + }) + .option('read-input-from-override-list', { + alias: 'readInputFromOverrideList', + type: 'string', + description: 'Comma separated list of input value names to read from the input override command', + default: '', + }) + .option('read-input-override-command', { + alias: 'readInputOverrideCommand', + type: 'string', + description: 'Command to execute to pull input from an external source (e.g. cloud provider secret managers)', + default: '', + }) + .option('post-build-steps', { + alias: 'postBuildSteps', + type: 'string', + description: + 'Post build job in yaml format with the keys image, secrets (name, value object array), command string', + default: '', + }) + .option('pre-build-steps', { + alias: 'preBuildSteps', + type: 'string', + description: + 'Pre build job after repository setup but before the build job (yaml format with keys image, secrets, command)', + default: '', + }) + .option('custom-job', { + alias: 'customJob', + type: 'string', + description: + 'Custom job instead of the standard build automation (yaml format with keys image, secrets, command)', + default: '', + }) .example( 'game-ci orchestrate --target-platform StandaloneLinux64 --provider-strategy aws', 'Build on AWS using the orchestrator', @@ -162,7 +201,11 @@ const orchestrateCommand: CommandModule = { const result = await Orchestrator.run(buildParameters, baseImage.toString()); core.info(`\nOrchestrated build completed.`); - core.info(`Results: ${result.BuildResults}`); + if (result?.BuildResults) { + core.info(`Results: ${result.BuildResults}`); + } else { + core.warning('Build completed but no build results were returned.'); + } } catch (error: any) { core.setFailed(`Orchestrated build failed: ${error.message}`); diff --git a/src/cli/input-mapper.ts b/src/cli/input-mapper.ts index 9c6985bd..b6e1386f 100644 --- a/src/cli/input-mapper.ts +++ b/src/cli/input-mapper.ts @@ -62,6 +62,12 @@ export interface CliArguments { skipActivation?: string; cloneDepth?: string; + readInputFromOverrideList?: string; + readInputOverrideCommand?: string; + postBuildSteps?: string; + preBuildSteps?: string; + customJob?: string; + unityLicensingServer?: string; cacheUnityInstallationOnMac?: boolean;