-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
Adds envVars propagation client -> server #267
Adds envVars propagation client -> server #267
Conversation
Since Mill now executes in a long-lived JVM, the builds do not have a chance to use environment variables as inputs. This propagates the environment variables from the client all the way down to the context available to the tasks as a `Map[String, String]` so that they can be used as inputs should the user choose to do so. com-lihaoyi#257
@robby-phd @rockjam one of you want to help review this? |
@lihaoyi will take a look |
@Baccata thank you, overall looks good. |
Thanks for the feedback, I'll get on adding tests/doc asap |
* Moved the `System.getenv` side effect to the end of the world * Adds a test to make sure that the `Map[String, String]` gets propagated correctly * Adds a `Ctx.Env` trait for consistency com-lihaoyi#257
Adds documentation about the Ctx.Env API to indicate that the user should not use `System.getenv` com-lihaoyi#257
7c7fc25
to
997760e
Compare
@rockjam, for consistency I added documentation there : https://github.com/lihaoyi/mill/pull/267/files#diff-521aff6dd9f50dbf1ce6d38d8940bdd1R191. Hope that's okay. Also added a test |
@Baccata great that you find a good place to put it in docs. I'll take a closer look at PR when I have time. |
9ebd19b
to
779e453
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Baccata There are some conflicts, can you take a look, will merge after that. |
@lihaoyi thank you |
Since Mill now executes in a long-lived JVM, the builds do not have a chance to use environment variables as inputs (ie
System.getEnv
returns the same result across several runs).This PR allows to propagate the environment variables from the client all the way down to the context and makes them available as a
Map[String, String]
so that they can be used as inputs should the user choose to do so.Example of usage :
def envVar = T.input { T.ctx().env.get("ENV_VAR") }
#257
Tests
Documentation