mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-14 12:06:48 -07:00
fix(cli): address review findings — exit codes, missing inputs, null safety
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,7 @@ async function main() {
|
|||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error.name !== 'YError') {
|
if (error.name !== 'YError') {
|
||||||
core.error(`Error: ${error.message}`);
|
core.error(`Error: ${error.message}`);
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ interface ActivateArguments extends CliArguments {
|
|||||||
|
|
||||||
const activateCommand: CommandModule<object, ActivateArguments> = {
|
const activateCommand: CommandModule<object, ActivateArguments> = {
|
||||||
command: 'activate',
|
command: 'activate',
|
||||||
describe: 'Activate a Unity license',
|
describe: 'Verify Unity license configuration',
|
||||||
builder: (yargs) => {
|
builder: (yargs) => {
|
||||||
return yargs
|
return yargs
|
||||||
.option('unity-version', {
|
.option('unity-version', {
|
||||||
|
|||||||
@@ -206,6 +206,43 @@ const buildCommand: CommandModule<object, BuildArguments> = {
|
|||||||
description: 'The Unity licensing server address',
|
description: 'The Unity licensing server address',
|
||||||
default: '',
|
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 StandaloneLinux64', 'Build for Linux using auto-detected Unity version')
|
||||||
.example(
|
.example(
|
||||||
'game-ci build --target-platform Android --unity-version 2022.3.56f1 --build-method MyBuild.Run',
|
'game-ci build --target-platform Android --unity-version 2022.3.56f1 --build-method MyBuild.Run',
|
||||||
|
|||||||
@@ -138,6 +138,45 @@ const orchestrateCommand: CommandModule<object, OrchestrateArguments> = {
|
|||||||
description: 'Skip Unity activation/deactivation',
|
description: 'Skip Unity activation/deactivation',
|
||||||
default: 'false',
|
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(
|
.example(
|
||||||
'game-ci orchestrate --target-platform StandaloneLinux64 --provider-strategy aws',
|
'game-ci orchestrate --target-platform StandaloneLinux64 --provider-strategy aws',
|
||||||
'Build on AWS using the orchestrator',
|
'Build on AWS using the orchestrator',
|
||||||
@@ -162,7 +201,11 @@ const orchestrateCommand: CommandModule<object, OrchestrateArguments> = {
|
|||||||
const result = await Orchestrator.run(buildParameters, baseImage.toString());
|
const result = await Orchestrator.run(buildParameters, baseImage.toString());
|
||||||
|
|
||||||
core.info(`\nOrchestrated build completed.`);
|
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) {
|
} catch (error: any) {
|
||||||
core.setFailed(`Orchestrated build failed: ${error.message}`);
|
core.setFailed(`Orchestrated build failed: ${error.message}`);
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ export interface CliArguments {
|
|||||||
skipActivation?: string;
|
skipActivation?: string;
|
||||||
cloneDepth?: string;
|
cloneDepth?: string;
|
||||||
|
|
||||||
|
readInputFromOverrideList?: string;
|
||||||
|
readInputOverrideCommand?: string;
|
||||||
|
postBuildSteps?: string;
|
||||||
|
preBuildSteps?: string;
|
||||||
|
customJob?: string;
|
||||||
|
|
||||||
unityLicensingServer?: string;
|
unityLicensingServer?: string;
|
||||||
|
|
||||||
cacheUnityInstallationOnMac?: boolean;
|
cacheUnityInstallationOnMac?: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user