telepresence
telepresence copied to clipboard
Intercept generates an invalid `.env` file when multiline variables are present
Describe the bug
When intercepting a deployment with a multi-line environment variable, telepresence intercept
generates an invalid .env
file which results in a failure when paired with --docker-run
.
To Reproduce Steps to reproduce the behavior:
- When I run
telepresence intercept <deployment> --docker-run -- ...
- I see
docker: poorly formatted environment: variable '"keys": [' contains whitespaces.
Expected behavior
I don't really know because of https://github.com/moby/moby/issues/12997, but it would be great if we could at least have an .env
file that is parseable and then document the multiline limitation.
I was thinking about this approach in which we escape the environment variable as ENV="..."
: https://github.com/jfmyers9/telepresence/commit/8dfb4599ec9d192208ab5fd2fcb14ff79d5d6f90 but it doesn't work as expected as Docker treats anything after the =
literally.
Other options include:
- Collapsing it to one line with literal
\n
that need to be evaluated withecho -e
or equivalent inside the container. - Skipping multiline environment variables and logging a warning.
- Passing multiline environment variables using
-e
instead of the.env
file.
Versions (please complete the following information):
- Output of
telepresence version
Client: v2.7.0 (api v3)
Root Daemon: v2.7.0 (api v3)
User Daemon: v2.7.0 (api v3)
- Operating system of workstation running
telepresence
commands MacOS - Kubernetes environment and Version [e.g. Minikube, bare metal, Google Kubernetes Engine] 1.20, EKS
Additional context Just looking for ideas.