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

Add SBOM generator for ModelCar OCI images #252

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Victoremepunto
Copy link

@Victoremepunto Victoremepunto commented Mar 7, 2025

This adds a helper script to generate SBOM reports for ModelCar image.

A ModelCar is a containerized approach to deploying machine learning models. It involves packaging
model artifacts within a container image, enabling efficient and standardized deployment in
Kubernetes environments, used as Sidecar containers (secondary containers that run alongside the
main application container within the same Pod)

This is a helper script that is used in the ModelCar task introduced with konflux-ci/build-definitions#2038, to produce the necessary SBOM report.

@Victoremepunto Victoremepunto requested a review from a team as a code owner March 7, 2025 22:42
@Victoremepunto Victoremepunto marked this pull request as draft March 7, 2025 22:42
@Victoremepunto Victoremepunto changed the title Add SBOM generator for OLOT task Add SBOM generator for modelcar task Mar 11, 2025
@Victoremepunto Victoremepunto marked this pull request as ready for review March 11, 2025 20:24
@ralphbean
Copy link
Member

/ok-to-test

@@ -0,0 +1,234 @@
import argparse
Copy link
Member

Choose a reason for hiding this comment

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

modelcars aren't yet a well known thing. I can imagine someone coming across this script later outside the context of your usage with olot and saying "what!?".

Can you provide a brief docstring at the top of the script explaining what modelcars are and a link to more upstream information about them?

Copy link
Member

Choose a reason for hiding this comment

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

Also, please - a short paragraph explaining why the two arguments (model image and base image) are sufficient to faithfully create an SBOM of the modelcar.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review, I've added a docstring with the description

Copy link
Contributor

Choose a reason for hiding this comment

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

I am a little wary of using links in the dosctrings. Links can die and I don't think it's necessary to link whole blog posts since those could be looked up by anyone interested enough anyway.
I imagine that a short paragraph describing it would work better instead of expecting someone to go through the links

Copy link
Member

Choose a reason for hiding this comment

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

@tnevrlka's opinion trumps mine here!

Copy link
Author

Choose a reason for hiding this comment

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

I have refactored the contents of the docstring to remove the links from it and to provide a succinct explanation of what a ModelCar is and what is the purpose of the script. The contents now match those of the help function output

Copy link
Contributor

@tnevrlka tnevrlka left a comment

Choose a reason for hiding this comment

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

I have a similar concern as Ralph.
I believe it would be great to write a description and motivation behind the change into the commit message(s) and PR description.
I would also prefer to avoid references to Red Hat's internal Jira.
At this moment, I don't understand why this change is being proposed and would appreciate clarification. Thank you!

--model-image Model OCI artifact reference resolved to digest (e.g., quay.io/foo/model_image@sha256:abcdef1234567890...
--sbom-type SBOM report format [CycloneDX, SPDX] - Optional, default: CycloneDX
-o, --output-file Output file path
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: you don't need to write such a long docstring. Instead, using the argparse API to set program description and arguments description, then, -h will print the whole description.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, it makes sense. I've accordingly updated the docstring to match the output of the help function, and refactored the former contents using the Argparse API as suggested.

}
]
},
{
Copy link

Choose a reason for hiding this comment

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

To represent that "aipcc/modelcar-image" descends from both "aipcc/base-image" and "aipcc/model-image", I wonder if the structure ought to be like:

"components": {
  {
    "type": "container",
    "name": "aipcc-modelcar-image",
    ...
    "components": [
        {
            "type": "container",
            "name": "aipcc/base-image",
            ...
        },
        {
            "type": "container",
            "name": "aipcc/model-image",
            ...
        }
    ]
}

Copy link
Author

Choose a reason for hiding this comment

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

I've updated the structure to accommodate the suggestion, please could you review it again?

@ralphbean
Copy link
Member

/ok-to-test

@Victoremepunto Victoremepunto changed the title Add SBOM generator for modelcar task Add SBOM generator for ModelCar OCI images Mar 12, 2025
@Victoremepunto
Copy link
Author

I have a similar concern as Ralph. I believe it would be great to write a description and motivation behind the change into the commit message(s) and PR description. I would also prefer to avoid references to Red Hat's internal Jira. At this moment, I don't understand why this change is being proposed and would appreciate clarification. Thank you!

Thanks for the review.

I have updated the docstring following the review comments, to expand on the nature of the script and its context.

I have also updated title and description of the PR to remove any external references to internal JIRA projects, and to provide details about what this script is meant to used for and why is it required.

I hope this changes help clarifying the PR's motivation.

@tnevrlka
Copy link
Contributor

/ok-to-test

"components": [
{

"type": "container",
Copy link

Choose a reason for hiding this comment

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

Minor: indentation looks off

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.

5 participants