Skip to content

build: error when using docker exporter and attestations#1511

Merged
tonistiigi merged 2 commits intodocker:masterfrom
jedevc:error-on-attestations-docker
Jan 17, 2023
Merged

build: error when using docker exporter and attestations#1511
tonistiigi merged 2 commits intodocker:masterfrom
jedevc:error-on-attestations-docker

Conversation

@jedevc
Copy link
Copy Markdown
Collaborator

@jedevc jedevc commented Jan 11, 2023

Bug reported by @crazy-max:

it seems image is not loaded anymore: https://github.com/docker/build-push-action/actions/runs/3892759918/jobs/6644553386#step:5:107

We have importing to docker in the logs but does not look to be imported actually

This occurs when attestations are explicitly requested, and buildkit generates an index - which docker will not import. We should explicitly error in this case, and not allow the user to --load an image that contains explicit attestation flags.

Comment thread commands/build.go Outdated
return err
}
for _, out := range outputs {
if out.Type == "docker" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use driver.MultiPlatform

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or I guess because this is container driver with a Docker endpoint for exporting that endpoint should be checked similarly as driver.MultiPlatform is detected. If this gets complicated and doesn't work for regular multi-platform atm then it can be follow-up.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reworked the patch to be handled in toSolveOpt, where we handle the exporter and multi-platform case like this today - this means it'll also work in bake.

I think you're right, we should check multi-platform capabilities in toSolveOpt, to see if we need to error with "docker exporter does not currently support exporting manifest lists" for either attestations or multi-platform?

But we can do that as a follow-up, it seems orthogonal to this - it makes sense for the behavior for attestations and multi-platform should be linked together in the same place (that both generate indexes).

We should avoid erroring with attestations support compatability errors
when a user has specified --provenance=false.

A user may wish to enable --provenance=false that works across buildkit
versions, but currently it will fail on old versions - this patch fixes
this, to silently ignore the provenance flag for this check if it's set
to disabled.

Signed-off-by: Justin Chadwell <[email protected]>
@jedevc jedevc force-pushed the error-on-attestations-docker branch from 9415350 to 43a748f Compare January 13, 2023 13:42
@crazy-max crazy-max added this to the v0.10.1 milestone Jan 13, 2023
Comment thread build/build.go
}
}
if _, ok := opt.Attests["attest:provenance"]; !ok && supportsAttestations {
so.FrontendAttrs["attest:provenance"] = "mode=min,inline-only=true"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what stops the inline attestation to be added when loading to docker? Or did we block this in buildkit side?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, this is blocked buildkit side - https://github.com/moby/buildkit/pull/3466/files#diff-93b81ebb2d74a7ff89a643dfd137603e309b87754076de895b0c15dd4626a169R76.

We will attach inline attestations - but only if we would are already exporting an image index. For cases where we need to transform the manifest into the index, we only perform that upgrade for the image exporter.

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

Labels

kind/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants