Skip to content

Collection of fixes for attestations and platform shenanigans#3379

Closed
jedevc wants to merge 5 commits intomoby:masterfrom
jedevc:attestation-docker-exporter
Closed

Collection of fixes for attestations and platform shenanigans#3379
jedevc wants to merge 5 commits intomoby:masterfrom
jedevc:attestation-docker-exporter

Conversation

@jedevc
Copy link
Copy Markdown
Member

@jedevc jedevc commented Dec 9, 2022

⬆️ Follow-up to #3321

Signed-off-by: Justin Chadwell <me@jedevc.com>
The docker exporter should filter out inline attestations, since it
doesn't support them. Any remaining attestations should cause an error,
since they have been requested but cannot actually be output.

Signed-off-by: Justin Chadwell <me@jedevc.com>
Frontends SHOULD avoid generating SBOMs and Provenance if the backend
does not support it.

Signed-off-by: Justin Chadwell <me@jedevc.com>
Previous commit to fix platform output wasn't quite right - while the
original use case for the multi-platform arg works correctly, it was
flawed when used with attestations. We need to fallback to a default of
false if no attestations are present.

multi-platform still works in this case because of a quirk - if a client
has the capability to request attestations, then it will also have the
fix that forwards all FrontendOpts to every section of Build, so we can
extract multi-platform and pass it to the exporter. Not a perfect
solution, but it's not obvious what a more elegant approach would be
without a major refactor.

Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>

func (c *grpcClient) BuildOpts() client.BuildOpts {
opts := c.opts
if c.caps.Supports(pb.CapAttestations) == nil {
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.

Supports() == nil means that capability IS supported.

I think the better behavior in this cases would be to make sure AddAttestation is a noop if daemon has no support.

Comment thread exporter/local/export.go
}

isMap := len(inp.Refs) > 0
if len(inp.Attestations) > 0 {
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 do not understand this. Needs a comment. I still don't understand it even after reading the commit message (it says that there is a "flaw" and now things work because of a "quirk" but not what this line really does).

}

multiPlatform := len(inp.Refs) > 0
if len(inp.Attestations) > 0 {
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.

if the len(inp.Refs) > 0 clause above is wrong then it should be removed. If it is not wrong then this patch does not maintain that behavior.

@tonistiigi
Copy link
Copy Markdown
Member

CI red

@jedevc jedevc marked this pull request as draft December 12, 2022 13:45
@jedevc
Copy link
Copy Markdown
Member Author

jedevc commented Dec 13, 2022

Closed in favor of #3389

@jedevc jedevc closed this Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants