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

Write sbom.legacy.json files for newer platform api #825

Merged
merged 5 commits into from
Mar 21, 2022

Conversation

natalieparellano
Copy link
Member

Resolves #808

@natalieparellano natalieparellano force-pushed the remove-legacy-bom-label branch from 215eefe to 7707bea Compare March 10, 2022 21:45
Comment on lines -13 to -37
func WriteTOML(path string, data interface{}) error {
if err := os.MkdirAll(filepath.Dir(path), 0777); err != nil {
return err
}
f, err := os.Create(path)
if err != nil {
return err
}
defer f.Close()
return toml.NewEncoder(f).Encode(data)
}

func ReadGroup(path string) (buildpack.Group, error) {
var group buildpack.Group
_, err := toml.DecodeFile(path, &group)
return group, err
}

func ReadOrder(path string) (buildpack.Order, error) {
var order struct {
Order buildpack.Order `toml:"order"`
}
_, err := toml.DecodeFile(path, &order)
return order.Order, err
}
Copy link
Member Author

Choose a reason for hiding this comment

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

These functions are unused. I think we forgot to delete them in an earlier PR.

builder.go Outdated
if err := encoding.WriteJSON(filepath.Join(b.LayersDir, "sbom", "launch", "sbom.legacy.json"), launchBOM); err != nil {
return nil, errors.Wrap(err, "encoding launch bom")
}
launchBOM = []buildpack.BOMEntry{} // zero out bom in <layers>/config/metadata.toml
Copy link
Member Author

Choose a reason for hiding this comment

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

This will have the effect of producing a null bom, as opposed to omitting it, because of here. I don't think this is what we want...

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in db5d4af - thanks @jabrown85 for the suggestion!

Signed-off-by: Natalie Arellano <[email protected]>
Due to limitations of our TOML library, we can't add MarshalTOML to the top-level struct.

Signed-off-by: Natalie Arellano <[email protected]>
@natalieparellano natalieparellano marked this pull request as ready for review March 15, 2022 19:34
@natalieparellano natalieparellano requested a review from a team as a code owner March 15, 2022 19:34
Copy link
Contributor

@mboldt mboldt left a comment

Choose a reason for hiding this comment

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

Added a couple suggestions, but overall looks good to me!

@natalieparellano natalieparellano merged commit 828906b into main Mar 21, 2022
@natalieparellano natalieparellano deleted the remove-legacy-bom-label branch March 21, 2022 21:30
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.

Remove legacy bom from label in platform API 0.9
3 participants