Add support for multiple exporters (#235)

Buildkit 0.13 introduced support for [multiple
exporters](https://docs.docker.com/build/exporters/#multiple-exporters).
We currently return an error in these situations.

Instead, inspect the builder's version when loading the node and relax
this error if we see it's running at least 0.13.

Fixes https://github.com/pulumi/pulumi-docker-build/issues/21.
This commit is contained in:
Bryce Lampe
2024-12-10 09:05:36 -08:00
committed by GitHub
parent 2907567484
commit 195fbfc784
15 changed files with 466 additions and 267 deletions

View File

@@ -55,7 +55,7 @@ func TestCustomHost(t *testing.T) {
t.Run("env", func(t *testing.T) {
t.Setenv("DOCKER_HOST", socket)
h, err := newHost(nil)
h, err := newHost(context.Background(), nil)
require.NoError(t, err)
cli, err := wrap(h)
require.NoError(t, err)
@@ -66,7 +66,7 @@ func TestCustomHost(t *testing.T) {
t.Run("config", func(t *testing.T) {
t.Parallel()
h, err := newHost(&Config{Host: socket})
h, err := newHost(context.Background(), &Config{Host: socket})
require.NoError(t, err)
cli, err := wrap(h)
require.NoError(t, err)
@@ -290,7 +290,7 @@ func TestBuild(t *testing.T) {
ctx := context.Background()
cli := testcli(t, true, tt.auths...)
build, err := tt.args.toBuild(ctx, false)
build, err := tt.args.toBuild(ctx, true, false)
require.NoError(t, err)
_, err = cli.Build(ctx, build)
@@ -383,7 +383,7 @@ func TestBuildError(t *testing.T) {
ctx := context.Background()
cli := testcli(t, true)
build, err := args.toBuild(ctx, false)
build, err := args.toBuild(ctx, true, false)
require.NoError(t, err)
_, err = cli.Build(ctx, build)
@@ -418,7 +418,7 @@ func TestBuildExecError(t *testing.T) {
ctx := context.Background()
cli := testcli(t, true)
build, err := args.toBuild(ctx, false)
build, err := args.toBuild(ctx, true, false)
require.NoError(t, err)
_, err = cli.Build(ctx, build)
@@ -438,7 +438,7 @@ func TestBuildExecError(t *testing.T) {
// testcli returns a new standalone CLI instance. Set ping to true if a live
// daemon is required -- the test will be skipped if the daemon is not available.
func testcli(t *testing.T, ping bool, auths ...Registry) *cli {
h, err := newHost(nil)
h, err := newHost(context.Background(), nil)
require.NoError(t, err)
cli, err := wrap(h, auths...)