Commit Graph

35 Commits (master)

Author SHA1 Message Date
CrazyMax 56d55a4137
test: fix non-deterministic compose context path
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
1 year ago
Guillaume Lours 4a059d5144
adapt compose unit tests, build context is now transformed to absolute paths by compose-go
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
1 year ago
Justin Chadwell 431732f5d1 bake: fix incorrect dockerfile resolution against cwd:// context
We need to resolve the strip the cwd:// prefix before attempting to
resolve the dockerfile. Otherwise, we'll get the cwd:// prefix in the
dockerfile name, which isn't stripped out later.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell f5f00e68ef bake(cli): allow passing in-stream using command.Cli
ReadLocalFiles should allow passing the stdin file as an argument, which
allows us to read from dockerCli.Stdin() to be consistent with other
commands in the same package.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell 90c849f5ef bake: merge attest entries
This ensures that `target.attest=["type=sbom,<value>"]` can be
appropriately merged when `--sbom=true` or `--set
target.attest=type=sbom`.

To merge, we simply naively take the last valid value.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Nick Sieger 12885c01ad
bake: use default filenames from compose-go
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2 years ago
CrazyMax fb61fde581
fix cannot set environment variables in parallel tests
> FAIL: TestReadTargets/ArgsOverrides/leaf (0.00s)
> panic: testing: t.Setenv called after t.Parallel; cannot set environment variables in parallel tests

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
CrazyMax fe76a1b179
bake: support null label value
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
CrazyMax df4957307f
bake: support null arg value
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
Justin Chadwell 77b33260f8 bake: recursively resolve groups
Groups that contained other groups were not recursively resolved by
ReadTargets, which prevented output from --print from being useable as a
self-contained bake file.

This patch ensures that all groups that are referenced inside the bake
file are actually defined under the groups field. This has required a
substantial refactor, as previously only a single group was returned
from ReadTargets, notably, returning a map of groups, instead of a
slice.

This does introduce a small behavior change to the behavior of --print -
while previously, passing a group name to bake would return all the
targets of that group back as the default group, now only the name of
that group will be inserted into the default group, keeping the original
group intact. The impact of this can be observed in some of the changes
to the bake_test.go file.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
CrazyMax 42dea89247
bake: test for unknown extensions
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
CrazyMax 982a332679
bake(compose): fix unskipped services without build context
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
CrazyMax 7ef679d945
bake(compose): allow dot in target name
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
CrazyMax 5ce3909c48
bake: fix compose consistency check
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
CrazyMax 0b8dde1071
bake: fix skipped group when already visited by another one
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Tonis Tiigi 280c008f81 bake: make named contexts relative to remote bake input
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi 0fc2b5ca85 bake: add named contexts keys
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
CrazyMax c74b2fe7a4
bake: restrict target name
This fix adds a restriction `[a-zA-Z0-9_-]+`
for target name. This is pretty much the same as the
container name restriction in moby.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
CrazyMax 0044c28b1f
bake: keep target inheritance
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
CrazyMax d95ebef55c
bake: fix group resolution
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
CrazyMax 4466a24f9e
bake: fix groups print
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
CrazyMax 316ca972b6
bake: fix print output
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Tonis Tiigi 0e4d7aa7a9 bake: add test for merging overrides
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi 6fc906532b bake: fix using push override with output definition
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
CrazyMax c685e46609
bake: print default group
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Tonis Tiigi 1bb425a882 bake: allow BAKE_CMD_CONTEXT builtin var
Allows accessing the main context for bake command from bake
file that has been imported remotely.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
4 years ago
Tonis Tiigi cffcd57edb bake: support for remote files
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
4 years ago
Tibor Vass 77ddee9314 bake: fix pull and no-cache overrides
Signed-off-by: Tibor Vass <tibor@docker.com>
5 years ago
Patrick Van Stee 4121ae50b5 Modify parsing functions and config structs to accept hcl changes
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
5 years ago
Tibor Vass 078b65905a bake: add test cases for pattern matching
Signed-off-by: Tibor Vass <tibor@docker.com>
5 years ago
Tibor Vass 2bca8fa677 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>
5 years ago
Tibor Vass 3282dae09b bake: add tests for override+inheritance bug
Signed-off-by: Tibor Vass <tibor@docker.com>
5 years ago
Brian Goff 6634f1e75c Support reading from env on bake --set <t>.args
This works just like the `build` command where if you have `--build-arg
FOO`, it will read the variable from env and only set a value if the
variable is defined.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
5 years ago
Tonis Tiigi 15a5a42eb1 bake: merge targets on same groups
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
5 years ago
Tonis Tiigi ef4afac948 bake: fix dockerfile and context defaults
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
6 years ago