bake: allow pattern matching for target names in --set

Although bake is for running multiple targets, --set required a single
target name for overriding a property. This change allows matching
multiple targets for overrides.

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass
2020-04-21 21:47:40 +00:00
parent 721b63f3a0
commit 2bca8fa677
4 changed files with 81 additions and 55 deletions

View File

@@ -511,7 +511,7 @@ Options:
| --print | Print the options without building
| --progress string | Set type of progress output (auto, plain, tty). Use plain to show container output (default "auto")
| --pull | Always attempt to pull a newer version of the image
| --set stringArray | Override target value (eg: target.key=value)
| --set stringArray | Override target value (eg: targetpattern.key=value)
#### `-f, --file FILE`
@@ -554,14 +554,16 @@ Same as `build --progress`. Set type of progress output (auto, plain, tty). Use
Same as `build --pull`.
#### `--set target.key[.subkey]=value`
#### `--set targetpattern.key[.subkey]=value`
Override target configurations from command line.
Override target configurations from command line. The pattern matching syntax is defined in https://golang.org/pkg/path/#Match.
Example:
```
docker buildx bake --set target.args.mybuildarg=value
docker buildx bake --set target.platform=linux/arm64
docker buildx bake --set foo*.args.mybuildarg=value # overrides build arg for all targets starting with 'foo'
docker buildx bake --set *.platform=linux/arm64 # overrides platform for all targets
```
#### File definition