Merge pull request #3431 from tonistiigi/progress-none
add progress=none option
This commit is contained in:
+12
-3
@@ -210,7 +210,14 @@ func (o *buildOptions) toOptions() (*BuildOptions, error) {
|
||||
}
|
||||
|
||||
func (o *buildOptions) toDisplayMode() (progressui.DisplayMode, error) {
|
||||
progress := progressui.DisplayMode(o.progress)
|
||||
progressMode := o.progress
|
||||
if progressMode == "quiet" {
|
||||
o.quiet = true
|
||||
}
|
||||
if progressMode == "none" { // in buildx "quiet" means printing image ID in the end
|
||||
progressMode = "quiet"
|
||||
}
|
||||
progress := progressui.DisplayMode(progressMode)
|
||||
if o.quiet {
|
||||
if progress != progressui.AutoMode && progress != progressui.QuietMode {
|
||||
return "", errors.Errorf("progress=%s and quiet cannot be used together", o.progress)
|
||||
@@ -386,7 +393,9 @@ func runBuild(ctx context.Context, dockerCli command.Cli, debugOpts debuggerOpti
|
||||
case progressui.RawJSONMode:
|
||||
// no additional display
|
||||
case progressui.QuietMode:
|
||||
fmt.Println(getImageID(resp.ExporterResponse))
|
||||
if options.quiet {
|
||||
fmt.Println(getImageID(resp.ExporterResponse))
|
||||
}
|
||||
default:
|
||||
desktop.PrintBuildDetails(os.Stderr, printer.BuildRefs(), term)
|
||||
}
|
||||
@@ -624,7 +633,7 @@ type commonFlags struct {
|
||||
|
||||
func commonBuildFlags(options *commonFlags, flags *pflag.FlagSet) {
|
||||
options.noCache = flags.Bool("no-cache", false, "Do not use cache when building the image")
|
||||
flags.StringVar(&options.progress, "progress", "auto", `Set type of progress output ("auto", "quiet", "plain", "tty", "rawjson"). Use plain to show container output`)
|
||||
flags.StringVar(&options.progress, "progress", "auto", `Set type of progress output ("auto", "none", "plain", "quiet", "rawjson", "tty"). Use plain to show container output`)
|
||||
options.pull = flags.Bool("pull", false, "Always attempt to pull all referenced images")
|
||||
flags.StringVar(&options.metadataFile, "metadata-file", "", "Write build result metadata to a file")
|
||||
}
|
||||
|
||||
@@ -44,7 +44,12 @@ func runDialStdio(dockerCli command.Cli, opts stdioOptions) error {
|
||||
return err
|
||||
}
|
||||
|
||||
printer, err := progress.NewPrinter(ctx, os.Stderr, progressui.DisplayMode(opts.progress), progress.WithPhase("dial-stdio"), progress.WithDesc("builder: "+b.Name, "builder:"+b.Name))
|
||||
progressMode := opts.progress
|
||||
if progressMode == "none" { // in buildx "quiet" means printing image ID in the end
|
||||
progressMode = "quiet"
|
||||
}
|
||||
|
||||
printer, err := progress.NewPrinter(ctx, os.Stderr, progressui.DisplayMode(progressMode), progress.WithPhase("dial-stdio"), progress.WithDesc("builder: "+b.Name, "builder:"+b.Name))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -127,6 +132,6 @@ func dialStdioCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
|
||||
|
||||
flags := cmd.Flags()
|
||||
flags.StringVar(&opts.platform, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Target platform: this is used for node selection")
|
||||
flags.StringVar(&opts.progress, "progress", "quiet", `Set type of progress output ("auto", "plain", "tty", "rawjson"). Use plain to show container output`)
|
||||
flags.StringVar(&opts.progress, "progress", "none", `Set type of progress output ("auto", "plain", "rawjson", "tty"). Use plain to show container output`)
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -194,7 +194,11 @@ func runCreate(ctx context.Context, dockerCli command.Cli, in createOptions, arg
|
||||
|
||||
ctx2, cancel := context.WithCancelCause(context.TODO())
|
||||
defer func() { cancel(errors.WithStack(context.Canceled)) }()
|
||||
printer, err := progress.NewPrinter(ctx2, os.Stderr, progressui.DisplayMode(in.progress))
|
||||
progressMode := in.progress
|
||||
if progressMode == "none" {
|
||||
progressMode = "quiet"
|
||||
}
|
||||
printer, err := progress.NewPrinter(ctx2, os.Stderr, progressui.DisplayMode(progressMode))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -423,7 +427,7 @@ func createCmd(dockerCli command.Cli, opts RootOptions) *cobra.Command {
|
||||
flags.StringArrayVarP(&options.tags, "tag", "t", []string{}, "Set reference for new image")
|
||||
flags.BoolVar(&options.dryrun, "dry-run", false, "Show final image instead of pushing")
|
||||
flags.BoolVar(&options.actionAppend, "append", false, "Append to existing manifest")
|
||||
flags.StringVar(&options.progress, "progress", "auto", `Set type of progress output ("auto", "plain", "tty", "rawjson"). Use plain to show container output`)
|
||||
flags.StringVar(&options.progress, "progress", "auto", `Set type of progress output ("auto", "none", "plain", "rawjson", "tty"). Use plain to show container output`)
|
||||
flags.StringArrayVarP(&options.annotations, "annotation", "", []string{}, "Add annotation to the image")
|
||||
flags.BoolVar(&options.preferIndex, "prefer-index", true, "When only a single source is specified, prefer outputting an image index or manifest list instead of performing a carbon copy")
|
||||
flags.StringArrayVarP(&options.platforms, "platform", "p", []string{}, "Filter specified platforms of target image")
|
||||
|
||||
Reference in New Issue
Block a user