Skip to content
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

Add support for --chown flag for ADD/COPY Docker commands #1044

Merged
merged 5 commits into from
Oct 22, 2017

Conversation

mrfyda
Copy link
Contributor

@mrfyda mrfyda commented Oct 15, 2017

Closes #1029

@lightbend-cla-validator

Hi @mrfyda,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement:

http://www.lightbend.com/contribute/cla

@muuki88
Copy link
Contributor

muuki88 commented Oct 15, 2017

Thanks a lot for taking the time to work on this. I'll review this when I'm back from vacation ( 22.10 ) 😍

@muuki88 muuki88 added the docker label Oct 21, 2017
Copy link
Contributor

@muuki88 muuki88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have the dockerVersion mentioned in the docs as well. Users may use it to customize their own build.

Cmd("ADD", s"$files /$files")

dockerVersion match {
case Some(DockerVersion(major, minor, _, _)) if major >= 17 && minor >= 9 =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if statement looks buggy to me.
If the server has version 18.0 it will yield false, which is not want we want, right?
It must be something like if majro >= (17 && minor >= 9) || major > 17

At this point I'm fine with putting this into a if statement. If we have more of this special case, we should
extract this in somethin like a DockerSupport object:

object DockerSupport {

   def chownFlag(version: DockerVersion): Boolean = ...

}

@muuki88
Copy link
Contributor

muuki88 commented Oct 21, 2017

I updated the branch so all tests should work fine now.

@mrfyda
Copy link
Contributor Author

mrfyda commented Oct 22, 2017

@muuki88 Nice catch. Fixed the condition and extracted it to a separate object.

Also, updated both the spotify docker client implementation and the docs.

Copy link
Contributor

@muuki88 muuki88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 😄

@muuki88 muuki88 merged commit 42750a7 into sbt:master Oct 22, 2017
@ahjohannessen
Copy link

Thanks @mrfyda 💪🤗

@ahjohannessen
Copy link

@muuki88 Please cut a release :)

@muuki88
Copy link
Contributor

muuki88 commented Oct 23, 2017

Sure sure sure 😜

Merged one last PR today. With sbt cross build and all scripted tests a release always
takes a while, but here it is: 1.3.0

@ahjohannessen
Copy link

👍

@@ -80,6 +83,9 @@ object DockerPlugin extends AutoPlugin {
dockerEntrypoint := Seq("bin/%s" format executableScriptName.value),
dockerCmd := Seq(),
dockerExecCommand := Seq("docker"),
dockerVersion := Try(Process(dockerExecCommand.value ++ Seq("version --format '{{.Server.Version}}'")).!!)
Copy link
Contributor

@NeQuissimus NeQuissimus Oct 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guys, I don't think this works...
I believe it needs to be Seq("version", "--format", "'{{.Server.Version}}'"), otherwise your shell will add another set of ticks around the whole thing and Docker will report that it does not know the command.

I will try to confirm this and send a PR is necessary. I'd love to use this feature :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm me, already fixed somewhere else :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1052 and @mrfyda ftw! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants