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
Change the quiet flag behavior in the build command [closes #17623] #17428
Conversation
Ummm... strange, I don't know why it fails. I'll take a look on it, when I get back from work. |
In the console text, this is the failure message I receive:
However, from what I see the Am I right? If so, @vdemeester @cpuguy83 can you please restart the Jenkins windows testing job again? Thanks a bunch. 😄 |
Correct |
Couple of things... Have you considering doing this on the daemon side? Then the only output we'd see on the wire would be the resulting image id, for both the docker cli and REST APIs. |
@duglin, thanks for your feedback. Let me figure out a way to implement that on the daemon side, though. Otherwise, I will get rid of the Thanks. |
@duglin -- I tried my best here 😄. I am not that satisfied with the implementation, though. |
@ripcurld00d can you add "closes #17623" to the top description? |
@thaJeztah affirmative ;) |
First, great name for a branch :-) I think you may need to tweak the logic when there's an error. Right now if the build fails we'll get the error message but that's it - we only see the error message and not anything else. I think when there's an error you should send the entire buffer along with it. Without that extra text it might be really hard for people to know which line of the Dockerfile caused the issue. Granted we could try to be really smart and only return the last few lines, but I think that's probably overkill and when things go wrong I'd prefer to give as much info as possible to help the user fix it - and for all we know, the true issue could be back on the first step of the Dockerfile. They shouldn't have to rerun again (w/o this flag) just to get the info they need to debug. I'm not fond of the phrase "script-mode", it feels a bit too focused on one particular usecase. What about just |
outBuf = cli.out | ||
} else { | ||
// First check whether the Docker daemon supports this feature. | ||
serverResp, err := cli.call("GET", "/version", nil, nil) |
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.
While I understand why you're doing this, I'm not sure its worth it or consistent with the rest of Docker. I can't think of any other check like this for other new flags. In general, there's no guarantee that newer CLIs will ever work with old servers w.r.t. new features, so its not worth adding this check. Unless other @docker/maintainers want to start to add this check for other flags we may have added recently (and going forward).
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.
@duglin, no problem. I will remove it. Although, I will propose this check later.
@duglin thanks again for your feedback. I will work on it and do as you suggest. Thanks. |
Hi @ripcurld00d - any update on this? Looks like a rebase is needed too. |
Yeah, I have already done cc @duglin |
@@ -54,3 +57,75 @@ func ParseServerHeader(hdr string) (*ServerHeader, error) { | |||
OS: strings.TrimSpace(matches[3]), | |||
}, nil | |||
} | |||
|
|||
// Version represents the Docker version |
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 guess I will remove these changes, since we're not making any version-check.
Looks like this will work from the shell like so. if docker build -st super-cool-project:latest . 2>/dev/null | read IMAGE_ID; then
docker tag $IMAGE_ID super-cool-project:1.0
fi I'm happy with that. |
This functionality is provided by "-q" across other commands. Why the departure from that convention? |
@stevvooe because build already has a "-q" option and its not "quite" enough |
for heaven sake! when does it end?... i have to re-write another component again... 😭 |
sorry @ripcurld00d, let's try to get this merged asap I noticed build is failing currently;
|
@thaJeztah not giving up yet! ✊ |
🤘 sorry it's a really bad time with rebases. we're re-organizing loads of things and moving some packages to separate repositories. I really hope we'll be able to get this merged asap |
🏇 let the game begin... |
grrr windows fails again:
those aren't related to my changes... 😞 |
} | ||
} | ||
|
||
func (s *DockerSuite) TestBuildNotVerboseFailureRemote(c *check.C) { |
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.
Because of the 4 variants at https://github.com/docker/docker/pull/17428/files#diff-3a1632a75e011091e0bae6f8c8435fd2L93 can we add a test for when the URL points to a github repo and for when the Dockerfile comes from stdin ?
Aside from that I think this is ready to go!
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.
@duglin w/o using FakeGit? like giving a real github repo?
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.
would using FakeGit be bad for the happy-path case? Could use a bogus git repo URL for the failure case.
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.
@duglin why using git repo or stdin in the happy-path case? we know it generates an image ID. I thought that it would be useful for the sad-path case, to confirm that the output is similar to when the verbose mode is uesd.
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 was thinking that since we have four different code paths we might run into four different ways that output could be sent to the screen, and we should make sure -q caught all 4.
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.
@duglin uh huh. I see. OK. Let me figure out how to do a test with stdin, though.
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.
@duglin looking at the integration-cli/docker_utils.go
, we are already passing the "Dockerfile" through stdin
.
Therefore, I am going to add the FakeGit
and the FakeContext
methods.
If there is an error, is the exit status set to non-zero? It's not clear on a read-through if this is true (I'd have to dig through the cli package more perhaps to figure this out). Otherwise looks good. |
@ewindisch yes it does, that part hasn't changed. |
@thaJeztah can you restart |
@ripcurld00d done! did you rebase, to get the fix #18820 in? |
Right now, the quiet (-q, --quiet) flag ignores the output generated from within the container. However, it ought to be quiet in a way that all kind of diagnostic output should be ignored, unless the build process fails. This patch makes the quiet flag behave in the following way: 1. If the build process succeeds, stdout contains the image ID and stderr is empty. 2. If the build process fails, stdout is empty and stderr has the error message and the diagnostic output of that process. If the quiet flag is not set, then everything goes to stdout and error messages, if there are any, go to stderr. Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Now I did 😊 |
LGTM |
ping @cpuguy83 @tiborvass |
LGTM 😉 |
Alright!! Looks like we have 2 LGTM's on code, and docs didn't change and already had 2 LGTM's. In my world that means merge 🎉 💃 |
Change the quiet flag behavior in the build command [closes #17623]
Thanks so much @ripcurld00d! I added impact/changelog; although it can be seen as a bug fix, this flag was currently not really useful, now that it is, I think it's nice to inform people that they can use it again 😄 |
👯 💃 OMG OMG OMG OMG 🎉 🎈 👏 |
this is adorable On Mon, Dec 21, 2015 at 9:34 AM, Sebastiaan van Stijn <
|
🎉 |
Congrats @ripcurld00d and thank you for all the work you put into this. I'm looking forward to using this in my shell scripts. My appreciation goes out to the docker team, too. You're doing a great job. |
This PR answers the requirement in #7727 and closes #17623
Closes #17623
TODO:
Change thequiet
part in thedocker build
docsWrite a cli-integration testApparently figure out why the tests fail