Commit Graph

145 Commits (33388d6edef7aba7e51c258f86f1091e427fd485)

Author SHA1 Message Date
Tõnis Tiigi 6a702ebe5b
Merge pull request from crazy-max/bake-merge-jsons
bake: merge targets and vars from multiple JSON files
CrazyMax c0f8a8314b
bake: support compose build secrets
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax cad7ed68be
bake: merge vars from multiple JSON files
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax c317ca1e95
bake: merge targets from multiple JSON files
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax 243b428a58
compose: add test for port mapping
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax 0b8dde1071
bake: fix skipped group when already visited by another one
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Sebastiaan van Stijn fc7ba75fd7
Remove uses of deprecated io/ioutil
The package has been deprecated since Go 1.16: https://go.dev/doc/go1.16#ioutil

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Tonis Tiigi 91e550b715 bake: add path validation for remote bake invocations
This is a stopgap before proper entitlements support
is implemented.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 280c008f81 bake: make named contexts relative to remote bake input
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 32f6358d78 bake: add no-cache-filter
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 0fc2b5ca85 bake: add named contexts keys
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
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>
CrazyMax 0044c28b1f
bake: keep target inheritance
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax 5d715ada96
compose: resolve build args from service environment
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax 3400fa5628
compose: test env_file
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax d95ebef55c
bake: fix group resolution
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Tõnis Tiigi 33c121df01
Merge pull request from crazy-max/fix-bake-print
bake: fix groups print
CrazyMax 4466a24f9e
bake: fix groups print
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax ec9daba87e
bake: ignore NetworkMode field for json and hcl
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Tõnis Tiigi 7371dda7a2
Merge pull request from zachary-povey/support_host_network_in_compose
Add NetworkMode to bake target
Zachary Povey 7f8dbf890d Remove support for network override in bake
Signed-off-by: Zachary Povey <zachary.povey@autotrader.co.uk>
Zachary Povey 4ee7f70400 Remove NetworkMode support for HCL targets
Signed-off-by: Zachary Povey <zachary.povey@autotrader.co.uk>
Eliott Wiener dcabc22072 bake: build definition file via stdin
closes 

Accept bake build definition file from stdin with `-f -`.

Signed-off-by: Eliott Wiener <eliottwiener@gmail.com>
Zachary Povey ae53101e89 Add NetworkMode to bake target
Allows specification of network mode in a bake target.

Fixes 

Signed-off-by: Zachary Povey <zachary.povey@autotrader.co.uk>
CrazyMax 316ca972b6
bake: fix print output
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax 82b212bddf
bake: fix protocol detection
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Tonis Tiigi 7a7b73c043 bake: restore previous override merge behavior
For array fields, overrides are merged together
but override is not merged with the target. If merging
with target is desired we can add support for
overrides with += operator in the future.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 0e4d7aa7a9 bake: add test for merging overrides
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 6fc906532b bake: fix using push override with output definition
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 422ba60b04 use long-running context for client initialization
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tõnis Tiigi cb185f095f
Merge pull request from crazy-max/compose-ext
bake: `x-bake` extension field with compose
CrazyMax 89e126fa60
bake: `x-bake` extension field with compose
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax c685e46609
bake: print default group
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
CrazyMax 9aa8f09f14
Set `ConfigFile` to parse compose files with bake
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
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>
CrazyMax ba443811e4
Use compose-spec parser
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Tonis Tiigi 79433cef7a bake: fix target merge between compose and hcl
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi c5eb8f58b4 bake: new hclparser package
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tõnis Tiigi 03b7128b60
Merge pull request from tonistiigi/user-func-vars
bake: allow user functions in variables and vice-versa
Tonis Tiigi df7a318ec0 bake: allow user functions in variables and vice-versa
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Akihiro Suda 399df854ea
build: split buildflags package
Planned to be imported by nerdctl in future.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Alex Couture-Beil eec843a325 include default ssh socket when given an ssh-based git url
Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
Tonis Tiigi 83868a48b7 temp local copy of userfunc
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi f036bba48c bake: add test for json vars and attributes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 0fe2ce7fac bake: allow attributes in global scope
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 33f25acb08 bake: allow variables to reference each other
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 0e9066f6ed bake: fix hcl tests layout
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 0e9d6460db bake: allow variables across files
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi dba79ba223 update lint to go1.16/golangci
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 7878f0c514 bake: allow variables in user functions
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Felipe Santos f1f464e364 Add setproduct function to the bake HCL
As explained in the following link, it's a very useful function.

https://www.terraform.io/docs/configuration/functions/setproduct.html#finding-combinations-for-for_each
Signed-off-by: Felipe Santos <felipecassiors@gmail.com>
CrazyMax 96e7f3224a
Extend hcl2 support with more functions
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Tonis Tiigi 40fad4bbb5 progress: make sure all channels have written before returning
Possible write on closed channel on cancellation before.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 5bf2ff98c9 bake: support filenames without suffix
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 570e733a51 bake: support inline dockerfile
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi cffcd57edb bake: support for remote files
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Anthony Poschen abfb2c064d Add support for empty strings in target elements and compact func.
Signed-off-by: Anthony Poschen <zanven42@gmail.com>
Tonis Tiigi 95ac9ebb8a bake: format hcl errors with source definition
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tõnis Tiigi 42448c5f37
Merge pull request from vanstee/hcl-json-support
Support parsing json config with hcl v2
Patrick Van Stee 355261e49e
Parse bake config as hcl falling back to json
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Patrick Van Stee 44c840b31d
Add test of parsing a json bake config
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Patrick Van Stee 1bc068a583
Fix json keys for groups and targets
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Patrick Van Stee 340686a383
Support parsing json config with hcl v2
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Brian Goff 1ad87c6ba6 Update go-cty to pull in more stdlib funcs.
I needed "split" specifically so I can do something like:

```hcl
variable PLATFORMS {
  default = "linux/amd64"
}

target foo {
  platforms = split(",", "${PLATFORMS}")
  # other stuff
}
```

Where the existing "csvdecode" does not work for this because it parses
the string into a list of objects instead of a list of strings.

I went ahead and just added all the available new functions.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Tibor Vass 77ddee9314 bake: fix pull and no-cache overrides
Signed-off-by: Tibor Vass <tibor@docker.com>
Tonis Tiigi c9676c79d1 bake: fix hcl tags
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Patrick Van Stee 870b38837b Allow for user defined functions
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Patrick Van Stee abed97cf33 Include test cases of different hcl files
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Patrick Van Stee f10d8dab5e Define variables as blocks with defaults
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Patrick Van Stee 5185d534bc Include go-cty stdlib functions in HCL file scope
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Patrick Van Stee a520de447e Provide current env as variables in eval context
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Patrick Van Stee 4121ae50b5 Modify parsing functions and config structs to accept hcl changes
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
Tibor Vass 2a257a8252 bake: allow overriding no-cache and pull per target via --set
Signed-off-by: Tibor Vass <tibor@docker.com>
Tibor Vass 078b65905a bake: add test cases for pattern matching
Signed-off-by: Tibor Vass <tibor@docker.com>
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>
Tibor Vass 14e65ff3b4 bake: fix override+inheritance bug
Signed-off-by: Tibor Vass <tibor@docker.com>
Tibor Vass 3282dae09b bake: add tests for override+inheritance bug
Signed-off-by: Tibor Vass <tibor@docker.com>
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>
Tonis Tiigi 15a5a42eb1 bake: merge targets on same groups
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tibor Vass 8b2171f78a bake: honor --no-cache and --pull
Signed-off-by: Tibor Vass <tibor@docker.com>
Tibor Vass 92f1234aaa
Merge pull request from tonistiigi/build-arg-default
build: load default build args from env
Tonis Tiigi 662c0768cb bake: replace env in compose files
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 43150ef849 build: load default build args from env
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tibor Vass b741350afd bake: compose parser should only error if there are neither build nor image fields
Signed-off-by: Tibor Vass <tibor@docker.com>
Jack Laxson 4b2666b9d6 Change compose file handling to require valid service specifications
Added the checks and some tests
One of the tests wasn't valid docker-compose.yml, that's been changed.
Bad config throws an error and has a test

Signed-off-by: Jack Laxson <jackjrabbit@gmail.com>
Tonis Tiigi f1fd9a274b bake: make dockerfile relative to context
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi b68b005f68 vendor: update buildkit to f238f1e
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 43356bbbbe bake: fix parsing target from compose files
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi 94a0422a1b rename to docker/buildx
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi a238b05a4c bake: add output key
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi ef4afac948 bake: fix dockerfile and context defaults
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tibor Vass 6e3dfe72cb
Merge pull request from tonistiigi/platforms-fixes
fixes for managing platforms
Tonis Tiigi 96a148020a build: add cache-from and cache-to support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi e773d0eb2a util: add platformutil
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi a932d52e35 bake: initial implementation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>