Repository navigation
Double quote build args to support complex values - #159
Conversation
|
@jfmyers9 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
|
@jfmyers9 Thank you for signing the Contributor License Agreement! |
|
We believe this change may fix the above issues. As said we struggled to run the |
|
Don't merge this, it doesn't work :) Fixing it now... |
|
Updated, should be working now. This is the simplest solution we could find which correctly quoted the values of build args. |
|
Sorry, the build has been failing for a bit and we hadn't noticed. It should be fixed now; I re-ran the build and it's green. |
|
@jfmyers9 @ljfranklin Now that the tests are runnable again, do you think there are any that could be added for this? |
This change properly escapes multiline build arg values when calling `docker build`. Fixes #158, Fixes #79 Signed-off-by: Lyle Franklin <[email protected]>
|
@vito This was somewhat difficult to test due to nature of the out integration tests and the behavior of the |
This change adds a test that validates that complex arguments passed to the docker command in the out script are properly quoted. It does this by validating that arguments with newlines and spaces are only passed into the docker command as one argument.
vito
left a comment
There was a problem hiding this comment.
not sure but i think the tests might be demonstrating that the linebreak case isn't actually fixed
| echo "DOCKER:" "$@" | ||
|
|
||
| for var in "$@"; do | ||
| echo "DOCKER ARG:" "$var" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| Expect(session.Err).To(gbytes.Say(dockerarg(`--build-arg`))) | ||
| Expect(session.Err).To(gbytes.Say(dockerarg(`arg1=arg with space`))) | ||
| Expect(session.Err).To(gbytes.Say(dockerarg(`--build-arg`))) | ||
| Expect(session.Err).To(gbytes.Say(dockerarg(`arg2=arg with\nnewline`))) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Ah right, forgot Say does regexes. Makes sense. Thanks for checking!
…On Wed, Dec 13, 2017, 11:16 AM James Myers ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In tests/out_test.go
<#159 (comment)>
:
> + "repository": "test",
+ },
+ "params": map[string]interface{}{
+ "build": "/docker-image-resource/tests/fixtures/build",
+ "build_args": map[string]string{
+ "arg1": "arg with space",
+ "arg2": "arg with\nnewline",
+ "arg3": "normal",
+ },
+ },
+ })
+
+ Expect(session.Err).To(gbytes.Say(dockerarg(`--build-arg`)))
+ Expect(session.Err).To(gbytes.Say(dockerarg(`arg1=arg with space`)))
+ Expect(session.Err).To(gbytes.Say(dockerarg(`--build-arg`)))
+ Expect(session.Err).To(gbytes.Say(dockerarg(`arg2=arg with\nnewline`)))
That being said, I think the assertion in the test is still correct.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#159 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAHWE_XeL25GULJ8VmTLjl-p1KCahe2ks5s__g5gaJpZM4Q1kz3>
.
|
|
Thanks! |
|
I wanted to pass GOOGLE_CREDENTIALS_JSON as a build arg and so also ran into this issue. I pulled this repo, built the image, tried using it, and am seeing: I don't see how this change relates to that problem; the line containing $SKIP_PRIVILEGED is a month old, meaning it should be in 3.8.0, and yet I don't see that problem in 3.8.0's docker-image-resource. For what it's worth: |
|
The fix for this was to set |
|
Added #160 to fix the above and added documentation for others. |
This change properly escapes multiline/complex build arg values when calling
docker build.Fixes #158, Fixes #79
Note: We couldn't get the tests to run on OSX. We think the
README.mdneeds some updating?Signed-off-by: Lyle Franklin [email protected]