Skip to content

Fix --pull and --no-cache behavior#268

Merged
tonistiigi merged 4 commits intodocker:masterfrom
tiborvass:fix-tristate
Apr 30, 2020
Merged

Fix --pull and --no-cache behavior#268
tonistiigi merged 4 commits intodocker:masterfrom
tiborvass:fix-tristate

Conversation

@tiborvass
Copy link
Copy Markdown
Collaborator

@tiborvass tiborvass commented Apr 30, 2020

Fixes --pull and --no-cache without argument

Signed-off-by: Tibor Vass tibor@docker.com

Fixes #265

@tiborvass tiborvass requested a review from tonistiigi April 30, 2020 18:17
@tiborvass tiborvass changed the title flagutil: tristate flag parsing should be like boolean flag flagutil: tristate flag should parse like a boolean flag Apr 30, 2020
@tiborvass tiborvass force-pushed the fix-tristate branch 2 times, most recently from b4d6537 to 5fc6f16 Compare April 30, 2020 19:04
@tiborvass tiborvass changed the title flagutil: tristate flag should parse like a boolean flag commands: check if flag is set instead of using flagutil.Tristate Apr 30, 2020
Fixes --pull and --no-cache without argument

Signed-off-by: Tibor Vass <tibor@docker.com>
Comment thread commands/build.go
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, plain, tty). Use plain to show container output")
flags.Var(flagutil.Tristate(options.pull), "pull", "Always attempt to pull a newer version of the image")
options.pull = flags.Bool("pull", false, "Always attempt to pull a newer version of the image")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious; wouldn't something like this work?

flags.StringVar(&options.pull, "pull", nil, "Always attempt to pull a newer version of the image")

(use nil as default)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd have to do an strconv.ParseBool which flags.Bool does for us.

tonistiigi and others added 3 commits April 30, 2020 13:01
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
@tiborvass tiborvass changed the title commands: check if flag is set instead of using flagutil.Tristate Fix --pull and --no-cache behavior Apr 30, 2020
Comment thread bake/bake.go
SSH []string `json:"ssh,omitempty" hcl:"ssh,optional"`
Platforms []string `json:"platforms,omitempty" hcl:"platforms,optional"`
Outputs []string `json:"output,omitempty" hcl:"output,optional"`
Pull bool `json:"pull,omitempty": hcl:"pull,optional"`
Copy link
Copy Markdown
Collaborator Author

@tiborvass tiborvass Apr 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thaJeztah check out this stupidity!!!! 😆😠

@tonistiigi tonistiigi merged commit bda4882 into docker:master Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v0.4.0] build fail with --pull arg

3 participants