Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't hash the layer twice #778

Closed
Tracked by #781
jonjohnsonjr opened this issue Jul 1, 2023 · 0 comments · Fixed by #800
Closed
Tracked by #781

Don't hash the layer twice #778

jonjohnsonjr opened this issue Jul 1, 2023 · 0 comments · Fixed by #800

Comments

@jonjohnsonjr
Copy link
Contributor

We calculate the layer digest in GenerateImageSBOM by reading it from disk and hashing it.

We don't need to do that, because we have to calculate the digest already before this. We should pass that value down into this function (or just get it from the passed in img).

if err := s.ReadLayerTarball(o.TarballPath); err != nil {
return nil, fmt.Errorf("reading layer tar: %w", err)
}

This will save ~1ms per MB.

@jonjohnsonjr jonjohnsonjr changed the title Don't has the layer twice Don't hash the layer twice Jul 1, 2023
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 a pull request may close this issue.

1 participant