Skip to content

Commit

Permalink
bake: allow overriding no-cache and pull per target via --set
Browse files Browse the repository at this point in the history
Signed-off-by: Tibor Vass <tibor@docker.com>
  • Loading branch information
Tibor Vass committed Oct 16, 2019
1 parent d6f9e90 commit 86e1d47
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bake/bake.go
Expand Up @@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path"
"strconv"
"strings"

"github.com/docker/buildx/build"
Expand Down Expand Up @@ -185,6 +186,18 @@ func (c Config) setOverrides(overrides []string) error {
t.Platforms = append(t.Platforms, parts[1])
case "output":
t.Outputs = append(t.Outputs, parts[1])
case "no-cache":
noCache, err := strconv.ParseBool(parts[1])
if err != nil {
return errors.Errorf("invalid value %s for boolean key no-cache", parts[1])
}
t.NoCache = noCache
case "pull":
pull, err := strconv.ParseBool(parts[1])
if err != nil {
return errors.Errorf("invalid value %s for boolean key pull", parts[1])
}
t.Pull = pull
default:
return errors.Errorf("unknown key: %s", keys[1])
}
Expand Down Expand Up @@ -274,6 +287,8 @@ type Target struct {
SSH []string `json:"ssh,omitempty" hcl:"ssh,omitempty"`
Platforms []string `json:"platforms,omitempty" hcl:"platforms,omitempty"`
Outputs []string `json:"output,omitempty" hcl:"output,omitempty"`
Pull bool `json:"pull,omitempty": hcl:"pull,omitempty"`
NoCache bool `json:"no-cache,omitempty": hcl:"no-cache,omitempty"`
}

func (t *Target) normalize() {
Expand Down

0 comments on commit 86e1d47

Please sign in to comment.