Transmode / gradle-docker

A Gradle plugin to build Docker images from the build script.
Apache License 2.0
647 stars 142 forks source link

Fixed problem with whitespace in command line parameters to docker. #39

Closed mikljohansson closed 9 years ago

mikljohansson commented 9 years ago

The NativeDockerClient class executed a command line string without escaping whitespace in the parameters. This failed for example if the buildDir parameter contained spaces. The fix uses the [].execute() method instead which passes each element as a separate parameter.

For some additional info see http://groovy.codehaus.org/Executing+External+Processes+From+Groovy

mikljohansson commented 9 years ago

Failed build indicates that "Gradle build daemon disappeared unexpectedly (it may have been stopped, killed or may have crashed)", is this just a transient error?

Note that when I build the master (not including the patch in this pull req) I also get a test error

:licenseIntegTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':licenseIntegTest'.
> License violations were found:
mikljohansson commented 9 years ago

Any chance of getting this merged or looked at? I'd be most happy for any feedback or suggestions on the simple bug fix. The failing check is unrelated to the bug fix itself, which is just a very simple change from using String.execute() to List.execute() to avoid the shell parameter escaping problem.

We have a couple of hundred Jenkins jobs that are using spaces in their names. Since Jenkins workspace directories use the job name this means that the gradle-docker-plugin fails on all those jobs unless they're renamed. Which is a bit of a blocker for us in rolling out Docker support for the projects.

mattgruter commented 9 years ago

I just cherry-picked your fix into the dev branch (see 0a814467191a83ffb17f9d39a622770870ce9755). Thanks for the patch and sorry for the delay!

mikljohansson commented 9 years ago

Awesome, thanks! Your plugin is by far the best gradle docker plugin we've found. When this fix gets into release it'll make our docker move a lot smoother.

Cheers, Mikael and Meltwater

mattgruter commented 9 years ago

Glad to hear! :-) We hope to release 1.3 soonish. (I know that I've been saying that for too long now, hope we get this out the door ASAP though.)