fix: native macOS builds silently ignored almost every CLI option - #64
Conversation
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>
|
Warning Review limit reached
Next review available in: 95 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 (2)
📒 Files selected for processing (4)
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 for other regressions
Found while systematically diffing
cli's build scripts againstunity-builder's real source (viaunity-engine-core), after the Dockercommands-ignored bug in #61 turned up the same way.MacBuilder.run()invokesentrypoint.shviaSystem.run(), but never converted any parsed CLI option (--unity-serial,--project-path,--target-platform,--build-name, licensing, Android signing — everything) into an environment variable.System.run()'s underlyingspawn()call had noenvoverride at all, so it fell back to inheriting thecliprocess's own environment. In practice:game-ci buildon macOS only respected CLI flags if a user also manually exported every setting as a real shell env var outside of cli's own options — the flags themselves were silently ignored on macOS specifically (Docker-based builds on Linux/Windows were unaffected, sinceDocker.run()already constructs explicit--envflags from options).Also found while confirming this:
entrypoint.sh/build.shon mac reference$ACTION_FOLDERand$GITHUB_WORKSPACE, neither of whichImageEnvironmentFactoryproduces (Docker gets these via explicit--envflags and volume-mount path remapping instead, which doesn't apply to a native process). Added both directly fromoptions.cliDistPath/options.currentWorkDir.mac/steps/activate.shhad no Unity Licensing Server (floating license) branch at all —UNITY_LICENSING_SERVERwas silently ignored and activation always attempted (likely empty) serial-mode auth instead. Linux and Windows already handle this correctly; ported the same structure the realunity-buildersource uses on mac (confirmed viaunity-engine-core).Fix
System.run()'sRunOptionsgains anenvfield, merged on top of the current process env when spawning (existing callers unaffected — omitting it preserves today's inherit-everything behavior).MacBuilder.run()now builds a full env var map fromoptions, reusing the exact sameImageEnvironmentFactory/UnityEnvironmentconstruction the already-tested Docker path uses, and passes it through via the newenvoption.mac/steps/activate.shgets the missingUNITY_LICENSING_SERVERbranch, matching Linux/Windows and realunity-builder.Testing
mac-builder.test.ts(env map construction: generic options,GITHUB_WORKSPACE/ACTION_FOLDER, Unity-only vars gated byengine, empty/undefined values omitted) andsystem.test.ts(env merge vs. inherit-by-default, using anode -eprobe command that works identically undershandpowershell).bash -nsyntax-checked the modified shell script.bun test— 122 pass, 0 fail.bun run build— builds clean.I don't have a real macOS + Unity environment to verify end-to-end, so this is verified at the unit level (env map construction, script syntax) rather than a live build — flagging that explicitly rather than claiming full verification.
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com