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

--no-progress replaced with --progress #504

Merged
merged 1 commit into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions cmd/buildctl/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 {
c = cf
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)
})
Expand Down
6 changes: 3 additions & 3 deletions cmd/buildctl/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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()
Expand All @@ -56,7 +56,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()

Expand Down Expand Up @@ -85,7 +85,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)
Expand Down
2 changes: 1 addition & 1 deletion frontend/dockerfile/dockerfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2634,7 +2634,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 {
Expand Down