fix: Docker.run() ignored engine-supplied commands, breaking Godot/Unreal builds - #61
Conversation
…uilds Bug: getLinuxCommand/getWindowsCommand never referenced options.commands, so any non-Unity build always ran Unity's hardcoded /bin/bash /entrypoint.sh (a pure license-activate/build/return-license flow) instead of the command the Godot/Unreal build commands actually set. Godot and Unreal builds via `game-ci build` were not running their intended container command. Fix adds an isUnityDefaultFlow = !commands || engine === 'unity' guard: when a non-Unity engine supplies `commands`, that's now what actually runs in the container, and Unity-only volumes/env vars (UNITY_SERIAL, default-build-script, platform steps, entrypoint.sh, unity-config) are skipped for that path. Also completes cli#51 phase 2/3 (engine-agnostic boundary cleanup): image-environment-factory.ts no longer hardcodes Unity/Android env vars directly; they move to the new src/logic/unity/environment.ts and are passed in as extraVariables, only for engine === 'unity'. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 3 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Severity-1 bug found while auditing cli's build scripts against unity-builder's real source (via unity-engine-core) for other divergence, after finding and fixing the Docker `commands`-ignored bug in #61. MacBuilder.run() invoked entrypoint.sh via System.run() but never converted any parsed option (--unity-serial, --project-path, --target-platform, --build-name, licensing, Android signing, etc.) into an environment variable. System.run()'s underlying spawn() call had no `env` override at all, so it fell back to inheriting the cli process's own environment - meaning `game-ci build` on macOS only worked at all if a user separately, manually exported every setting as a real shell env var outside of cli's own flags, silently ignoring everything passed via CLI options. Also found while confirming this: mac's entrypoint.sh/build.sh reference $ACTION_FOLDER and $GITHUB_WORKSPACE, neither of which ImageEnvironmentFactory produces (Docker builds get these via explicit --env flags and volume-mount remapping instead) - added both directly from options.cliDistPath/options.currentWorkDir. And: mac's activate.sh had no Unity Licensing Server (floating license) branch at all - UNITY_LICENSING_SERVER was silently ignored and activation always attempted (likely empty) serial mode instead. Linux and Windows already had this; ported the same structure real unity-builder uses on mac. Fix: - System.run()'s RunOptions gains an `env` field, merged on top of the current process env when spawning. - MacBuilder.run() now builds a full env var map from options (reusing the same ImageEnvironmentFactory/UnityEnvironment construction Docker builds already use and trust) and passes it through. - mac activate.sh gets the missing UNITY_LICENSING_SERVER branch. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Bug found while doing cli#51 phase 2/3 cleanup
Docker.run()'sgetLinuxCommand/getWindowsCommandnever referencedoptions.commandsat all. Every container run always executed Unity's hardcoded/bin/bash /entrypoint.sh(which sourcesactivate.sh/build.sh/return_license.sh— a Unity-license-activation-specific flow), regardless ofoptions.engine.godot-build-command.tsandunreal-build-command.tsboth setcommandson the options they pass toDocker.run(), expecting it to control what actually runs in the container (e.g.godot --headless --export-release ...orRunUAT.sh BuildCookRun ...). That value was silently discarded. In practice,game-ci buildfor Godot/Unreal projects was always running Unity's entrypoint script instead of the engine's real build command.Fix
Added
isUnityDefaultFlow = !commands || engine === 'unity'in bothgetLinuxCommandandgetWindowsCommand:commands, that string is now the actual container invocation.UNITY_SERIAL,default-build-script, platform steps,entrypoint.sh,unity-config, and on Windows the Visual Studio/registry-keys volumes) are skipped on that path.commandsset, orengine === 'unity') is unchanged — verified via existing + new tests.Also completes cli#51 phase 2/3 (engine-agnostic boundary cleanup)
image-environment-factory.tsno longer hardcodesUNITY_LICENSE/UNITY_SERIAL/ANDROID_*/etc. — those move to newsrc/logic/unity/environment.ts(UnityEnvironment.getVariables()), passed in asextraVariablesonly whenengine === 'unity'.docker.tsgets these via a smallengineEnvVars(options)helper.Phase 1 was already done via #50. This closes out phases 2 and 3.
Testing
docker.test.tscovering: commands used verbatim for a non-Unity engine, and Unity's entrypoint still used whenengine === 'unity'even ifcommandshappens to be set.docker.test.ts/image-environment-factory.test.tsfixtures to explicitly passengine: 'unity'/UnityEnvironment.getVariables()now that those vars aren't baked in by default — confirmed this matches howunity-build-command.tsalready calls things (env is populated via yargs middleware insrc/middleware/engine-detection/index.ts).bun test— 105 pass, 0 fail.bun run build— builds clean.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com