-
Notifications
You must be signed in to change notification settings - Fork 51
Allow the default value of expression to refer to environment variables #1019
Comments
This seems to be the code that would need to get touched for this:
|
Thanks for the suggestion @sschuberth. Have you seen #990? I'm planning on replacing the current expression syntax with something that would support this far more naturally. |
This is supported in places that accept local file paths (eg. the local side of a volume mount). Are there other places that you'd like to use it? |
Ah, no, I didn't connect "expression" with "environment variable" in that context. Thanks for pointing this out to me.
Hmm, when I tried it did not seem to work for me on Windows. Is
Nope, not yet 😉 |
It should be happening on all platforms - and if it's not, that's a bug :) |
Is there a way to see in the log what |
You should be able to see the resolved paths for volume mounts in the creation request sent to the Docker daemon, which is logged here. |
Ok, I'm getting
which actually looks good, and using |
So, since the table in the RFC has an entry for "Reference to environment variable with default from other environment variable" (and my immediate use-case would be solved with |
Describe the problem you'd like to solve
I'd like to specify a sub-directory of the host user's home directory as the
local
source directory for a volume. As a~
prefix did not seem to work, I was trying to use an expression likelocal: ${HOME:-$USERPROFILE}/.gradle
(so$HOME
is tried first, assuming the host is a Linux system; otherwise assume the host is Windows, and use$USERPROFILE
). But that does not seem to work either, the "nested"$USERPROFILE
environment variable does not seem to get resolved.Describe the solution you'd like
Environment variables that are part of the default value of an expression should be resolved.
Describe alternatives you've considered
Alternatively / additionally, a dedicated syntax to refer to the current user's home on the host system in a platform-agnostic way, like using
~
, would be nice.Additional context
Note that in Bash,
echo ${HOME:-$USERPROFILE}
actually works, so I was assuming it to work with Batect, too.The text was updated successfully, but these errors were encountered: