com-lihaoyi / mill

Your shiny new Java/Scala build tool!
https://mill-build.com/
MIT License
2k stars 308 forks source link

`docker.build` should invalidate results when environment changes #3132

Open lolgab opened 3 months ago

lolgab commented 3 months ago

Docker images are built when the environment changes, since Docker depends on some environment variables.

Docker documentation here.

Mill should invalidate the docker build target when the environment changes.

lefou commented 3 months ago

Since the DockerModule already defines a envVars target, I'd argue that the current implementation assumes they are the only used env vars at play. This is probably not correct, since os-lib's os.proc is silently using all default env vars of the Java process if the propagateEnv parameter isn't set to false. So a fix should probably set it. If a user wants to depend on all actual env vars, she already can override envVars with T.input { sys.props }. Or we implement it that way by default.