-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(env): support multiline in env-file #19096
feat(env): support multiline in env-file #19096
Conversation
2fc06fe
to
fd7642c
Compare
fd7642c
to
5b8dd87
Compare
5b8dd87
to
7e6dcf3
Compare
3b5912a
to
5908c42
Compare
5908c42
to
588d231
Compare
588d231
to
1806e71
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.
I am not so sure if this is not breaking to much. Keeping backwards and docker compatibility is really important. We do not know this is used today but I think the docker cli behaves the same way so changing how quotes, etc.. behave seems wrong to me.
I mainly thought this was about allowing newlines which I think can be done without breaking people.
I need to reconfirm the handling of quotation marks in the previous code. The current implementation will discard all quotation marks. |
This is what I see so far:
|
1806e71
to
dbf9192
Compare
Hey @Luap99 👋. I fixed the issues with Here are examples of how this PR handles multi-line environment variables: case 1$ cat test.env
FOO="aa
bb"
$ bin/podman run --env-file test.env alpine printenv FOO
aa
bb case 2$ cat test.env
FOO='aa
bb'
$ bin/podman run --env-file test.env alpine printenv FOO
aa
bb case 3$ cat test.env
FOO=`aa
bb`
$ bin/podman run --env-file test.env alpine printenv FOO
Error: parsing file "./test.env": only support multi-line environment variables surrounded by double quotation marks or single quotation marks. invalid variable: "FOO=`aa\nbb`\n"
exit code: 125 |
dbf9192
to
33ab92f
Compare
LGTM |
Thanks a lot for this PR. However, apparently it always replaces '\n' in a multi-line variable with a new line character (I mean replacing Thanks again |
Are you suggesting that deleting this line would make it consistent with Docker's behavior?
I believe it would make sense to remove |
33ab92f
to
b4a268d
Compare
Yes!
It's also correct! I also find it while I was testing your branch. The interesting thing is that while docker itself doesn't seem to properly support mult-line env files,
Yes, and it makes it impossible to embed I've not tried a multi-line value surrounded by double quotes to see the |
@hedayat Thank you for your test! |
@vrothberg @Luap99 PTAL |
@vrothberg @Luap99 Reping |
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
@Luap99 PTAL
Signed-off-by: Black-Hole1 <[email protected]>
4e81015
to
c67ef7c
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
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
/hold
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BlackHole1, Luap99, vrothberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
Heads-up everybody, this PR broke the use of octothorpe in environment variables: $ bin/podman run --env aaa='bbb#ccc' quay.io/libpod/testimage:20221018 printenv aaa
bbb <---- should be bbb#ccc A community member will be filing an issue. This is just an early notice so someone can start working on a fix. |
@BlackHole1 ^^ |
@rhatdan @edsantiago Good Catch. I will be submitting a fix PR for this in the next couple of days |
We noticed that we no longer able to pass a value containing new line ( We are now using the CentOS Stream 9 package built from the hash 1440985 , while we didn't see the issue when we used the package built from hash 38e6fab , and indeed this change appears in the diffs between these two hash. |
Hi @edsantiago I have just fixed this issue locally. I will submit a PR in 1 hour (because I'm having lunch now 😄). This problem is quite interesting, and I will provide a detailed explanation in the PR. |
@kajinamit Can you provide a detailed explanation of the issue you encountered? Was it related to the |
We are using I've reported my issue to CentOS 9 Stream https://bugzilla.redhat.com/show_bug.cgi?id=2230212 , because I faced the issue using the podman package from CentOS 9 Stream. That contains a few more details. |
OK. I will submit the fix PR within an hour. Thank you for your feedback. |
We've made rather a mess of those options, due to lack of testing. Here we have a first step toward regression tests. --env is OK, but there are three special-case exceptions in --env-file for three incompatibilities introduced by containers#19096. To be continued, but probably in future PRs. We need this ASAP to prevent us from making any more regressions. Signed-off-by: Ed Santiago <[email protected]>
Close: #18724
Does this PR introduce a user-facing change?
/cc @Luap99 @vrothberg