-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
support runner env #19
Conversation
because in order to use parameters in runner options.
|
||
dockerArgs := []string{} | ||
for _, v := range c.Volumes { | ||
dockerArgs = append(dockerArgs, "-v", os.ExpandEnv(v)) |
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.
Thanks for preserving ExpandEnv
here!
As far as I remember, this was necessary to expand the HOME
env var contained in the src of volume mount, that is useful for mounting .aws
or .ssh
on the host machine to the container.
dockerArgs = append(dockerArgs, "-e", fmt.Sprintf("%s=%s", k, os.ExpandEnv(v))) | ||
} | ||
if c.Envfile != "" { | ||
dockerArgs = append(dockerArgs, "--env-file", os.ExpandEnv(c.Envfile)) |
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.
I am thinking about specification like $PWD/.env
and $HOME/.env
as usecase.
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.
Sounds nice. Thanks for clarifying 👍
dockerArgs = append(dockerArgs, "-v", os.ExpandEnv(v)) | ||
} | ||
for k, v := range c.Env { | ||
dockerArgs = append(dockerArgs, "-e", fmt.Sprintf("%s=%s", k, os.ExpandEnv(v))) |
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.
Pass the host's environment variable to docker as a use case.
example:
runner:
image: ...
env:
DOCKER_HOST: $DOCKER_HOST
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.
This looks awesome. Thanks for your contribution 👍
support
runner.env
option.and, We have made it possible to expand environment variables and
autoenv
parameters with some runner options.