Skip to content

local exporter creates extra platform dir with in-line provenance #3385

Description

@crazy-max

With docker/buildx#1412 we now have provenance enabled by default (in-line mode): https://github.com/docker/buildx/blob/5f4d463780e72c643e3d24675a00e5c7bf50f1d5/build/build.go#L595

When building with Buildx master client (docker/buildx@5f4d463) using a container builder (BuildKit 01c0d67), the local exporter will create an extra platform directory in destination output which is unexpected and could break some workflows like:

$ git clone https://github.com/docker/buildx.git
$ cd buildx/
$ make install
...
#18 exporting to client directory
#18 copying files linux/amd64 21B
#18 copying files linux/amd64 49.18MB 0.3s done
#18 DONE 0.3s
mkdir -p ~/.docker/cli-plugins
install bin/build/buildx ~/.docker/cli-plugins/docker-buildx
install: cannot stat 'bin/build/buildx': No such file or directory
make: *** [Makefile:33: install] Error 1
$ tree bin/build
bin/build
└── linux_amd64
    └── buildx

1 directory, 1 file

As provenance is in-line, it should just extract files in the expected dir.

Furthermore, when exporting without in-line enabled, I don't think we should create an extra platform directory:

$ tree bin/build
bin/build
└── linux_amd64
    ├── buildx
    └── provenance.json

1 directory, 2 files

As it would still break some workflows. Instead we should keep the expected outcome and put extra attestation files in a specific directory like:

$ tree -a bin/build
bin/build
├── .buildkit-attest
│   └── provenance.json
└── buildx

1 directory, 2 files

Same when exporting for multi-platform:

$ tree -a bin/build
bin/build
├── linux_amd64
│   ├── .buildkit-attest
│   │   └── provenance.json
│   └── buildx
└── linux_arm64
    ├── .buildkit-attest
    │   └── provenance.json
    └── buildx

4 directories, 4 files

This way we avoid overriding exported files if someone wants to export a provenance.json file from build result. Concerning .buildkit-attest dir name I think it's fine but open to suggestions.

cc @tonistiigi @jedevc

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions