Merge pull request #504 from kunalkushwaha/no-console
--no-progress replaced with --progressdocker-18.09
commit
17e6416706
|
@ -37,9 +37,10 @@ var buildCommand = cli.Command{
|
|||
Name: "exporter-opt",
|
||||
Usage: "Define custom options for exporter",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "no-progress",
|
||||
Usage: "Don't show interactive progress",
|
||||
cli.StringFlag{
|
||||
Name: "progress",
|
||||
Usage: "Set type of progress (auto, plain, tty). Use plain to show container output",
|
||||
Value: "auto",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "trace",
|
||||
|
@ -233,11 +234,20 @@ func build(clicontext *cli.Context) error {
|
|||
|
||||
eg.Go(func() error {
|
||||
var c console.Console
|
||||
if !clicontext.Bool("no-progress") {
|
||||
if cf, err := console.ConsoleFromFile(os.Stderr); err == nil {
|
||||
progressOpt := clicontext.String("progress")
|
||||
|
||||
switch progressOpt {
|
||||
case "auto", "tty":
|
||||
cf, err := console.ConsoleFromFile(os.Stderr)
|
||||
if err != nil && progressOpt == "tty" {
|
||||
return err
|
||||
}
|
||||
c = cf
|
||||
case "plain":
|
||||
default:
|
||||
return errors.Errorf("invalid progress value : %s", progressOpt)
|
||||
}
|
||||
}
|
||||
|
||||
// not using shared context to not disrupt display but let is finish reporting errors
|
||||
return progressui.DisplaySolveStatus(context.TODO(), "", c, os.Stdout, displayCh)
|
||||
})
|
||||
|
|
|
@ -36,7 +36,7 @@ func testBuildWithLocalFiles(t *testing.T, sb integration.Sandbox) {
|
|||
rdr, err := marshal(st.Root())
|
||||
require.NoError(t, err)
|
||||
|
||||
cmd := sb.Cmd(fmt.Sprintf("build --no-progress --local src=%s", dir))
|
||||
cmd := sb.Cmd(fmt.Sprintf("build --progress=plain --local src=%s", dir))
|
||||
cmd.Stdin = rdr
|
||||
|
||||
err = cmd.Run()
|
||||
|
@ -57,7 +57,7 @@ func testBuildLocalExporter(t *testing.T, sb integration.Sandbox) {
|
|||
require.NoError(t, err)
|
||||
defer os.RemoveAll(tmpdir)
|
||||
|
||||
cmd := sb.Cmd(fmt.Sprintf("build --no-progress --exporter=local --exporter-opt output=%s", tmpdir))
|
||||
cmd := sb.Cmd(fmt.Sprintf("build --progress=plain --exporter=local --exporter-opt output=%s", tmpdir))
|
||||
cmd.Stdin = rdr
|
||||
err = cmd.Run()
|
||||
|
||||
|
@ -86,7 +86,7 @@ func testBuildContainerdExporter(t *testing.T, sb integration.Sandbox) {
|
|||
rdr, err := marshal(st.Root())
|
||||
require.NoError(t, err)
|
||||
|
||||
cmd := sb.Cmd("build --no-progress --exporter=image --exporter-opt name=example.com/moby/imageexporter:test")
|
||||
cmd := sb.Cmd("build --progress=plain --exporter=image --exporter-opt name=example.com/moby/imageexporter:test")
|
||||
cmd.Stdin = rdr
|
||||
err = cmd.Run()
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -2709,7 +2709,7 @@ func tmpdir(appliers ...fstest.Applier) (string, error) {
|
|||
|
||||
func dfCmdArgs(ctx, dockerfile string) (string, string) {
|
||||
traceFile := filepath.Join(os.TempDir(), "trace"+identity.NewID())
|
||||
return fmt.Sprintf("build --no-progress --frontend dockerfile.v0 --local context=%s --local dockerfile=%s --trace=%s", ctx, dockerfile, traceFile), traceFile
|
||||
return fmt.Sprintf("build --progress=plain --frontend dockerfile.v0 --local context=%s --local dockerfile=%s --trace=%s", ctx, dockerfile, traceFile), traceFile
|
||||
}
|
||||
|
||||
func runShell(dir string, cmds ...string) error {
|
||||
|
|
Loading…
Reference in New Issue