-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass env vars set in workflow file to docker environment #229
Comments
Thanks for opening an issue for this @tobyspark This is by design, let me try to outline a tl;dr: Our actions aren't a thin wrapper around a docker container. Their goal is actually to take away as much complexity for the user as possible. We do this by exposing a public API in the form of configuration options. We allow people passing in custom parameters so that you can basically pass in anything, while at the same time having a documented place of what's passed into Unity, which also needs to be used in the build script, making users implementations cleaner and with less hidden complexity. This also means it's easier to share configurations and build scripts with other teams. Finally, most teams need exactly the same functionality of a CI workflow. We much prefer making features visible (especially for people that are newer to Unity, or to CI). This is done by adding common features to said public API. That said, perhaps it's useful to add a concise line in the docs about Although please note that that isn't exactly the default behaviour in other actions either, oftentimes you want to abstract away from "it using a container under the hood" completely. This is what we are doing. Hope this helps :) |
That does help, thank you. Also, having implemented the command-line reading version, my fears of leaking secrets were unfounded. At least, GitHub Actions does an excellent job of scrubbing them wherever they appear. For what it’s worth, I share your motivation, but I struggle with the design conclusions here.
Plus, on taste –
One final thought is that because our app doesn’t have tests (at least, not that would run here, yet) I skipped that part of the getting started. And that’s where use of |
…meters` See discussion in game-ci/docker#229
The second point isn't completely accurate in my opinion. Actually they promote either using First off I think your point 1 is an excellent point. It would however create a duality of APIs (the programmatic API and env variables). The latter can have conflicts that can be hard to debug. Allowing arbitrary It is in fact very hard to find out how people use our actions, by having people collaborate on a shared API we believe we end up solving more problems and we're able to make it more user-friendly towards newer developers. Part of this rationale is also described in game-ci/cli#9. I'd say your approach would have been sound too. |
…meters` (#422) See discussion in game-ci/docker#229
Quibbles aside, it’s good to see such thought put into it. Thanks for pushing the documentation clarification, and your efforts generally. |
Thanks for your contributions! Closing this but feel free to reopen at any time. |
Context
It’s standard practice to set environment variables in GitHub actions, e.g.
Unity - Builder
usesenv
to passUNITY_LICENSE
. However arbitrary env variables are not passed to the docker container where Unity runs, so they cannot be accessed in any Unity-based tooling for the game. While understandable in hindsight, this is not what I expected going in, and there’s no indication in the documentation that arbitrary env vars will fail.Suggested solution
Passing environment variables set in the workflow file to the docker environment running Unity would be good general practice for all such Game-CI actions.
Considered alternatives
Searching Discord I see the alternative is to set custom parameters, and from Unity use
Environment.GetCommandLineArgs()
. I am concerned this may leak secrets into logs (am about to implement this so will see).Additional details
Pointed in the right direction, I should be able to work up a PR for this.
The text was updated successfully, but these errors were encountered: