Merge pull request #3655 from tonistiigi/q-call-empty-line
build: avoid empty line when -q used with --call
This commit is contained in:
+1
-1
@@ -411,7 +411,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, debugOpts debuggerOpti
|
||||
case progressui.RawJSONMode:
|
||||
// no additional display
|
||||
case progressui.QuietMode:
|
||||
if options.quiet {
|
||||
if options.quiet && opts.CallFunc == nil {
|
||||
fmt.Println(getImageID(resp.ExporterResponse))
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -1379,6 +1379,33 @@ FROM second
|
||||
require.Equal(t, 1, len(res.Sources))
|
||||
})
|
||||
|
||||
// docker/buildx#3651
|
||||
t.Run("outline-quiet-output", func(t *testing.T) {
|
||||
dockerfile := []byte(`
|
||||
FROM busybox
|
||||
ARG FOO=bar
|
||||
`)
|
||||
dir := tmpdir(
|
||||
t,
|
||||
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
||||
)
|
||||
|
||||
runOutline := func(args ...string) string {
|
||||
cmd := buildxCmd(sb, withArgs(args...))
|
||||
var stdout bytes.Buffer
|
||||
var stderr bytes.Buffer
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
require.NoError(t, cmd.Run(), stdout.String(), stderr.String())
|
||||
return stdout.String()
|
||||
}
|
||||
|
||||
quietOut := runOutline("build", "-q", "--call=outline", dir)
|
||||
noneOut := runOutline("build", "--progress=none", "--call=outline", dir)
|
||||
assert.Equal(t, noneOut, quietOut)
|
||||
assert.False(t, strings.HasPrefix(quietOut, "\n"))
|
||||
})
|
||||
|
||||
t.Run("targets", func(t *testing.T) {
|
||||
dockerfile := []byte(`
|
||||
# build defines stage for compiling the binary
|
||||
|
||||
Reference in New Issue
Block a user