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

CEL code migration #1

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

CEL code migration #1

wants to merge 169 commits into from

Conversation

puerco
Copy link
Member

@puerco puerco commented Jan 15, 2025

This PR migrates the bomshell CEL module into the protobom project. This PR refactors the CEl module to make it more general purpose while preserving the whole history from the original bomshell project to recognize the folks that worked on it.

This is still in draft but I wanted to open it for early reviews.

puerco and others added 30 commits January 15, 2025 10:56
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
This commit checks in the bomshell poc working with the protobom libs
before the  first functions of the elements APIs were built.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
This commit modifies the shell to return the execution resutls instead of
just printing it.

Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
This commit modifies the main package to use a new cmd package which implements a new cobrabased cli.

The CLI has two subcommands, the root which launches the interactive shell and exec which is intended to run
CEL bomshell scripts from the CLI and printout the result.

Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
This commit modifies bomshell to support loading multiple SBOMs into
the bomshell environment. The --sbom flag in the exec subcommand
now can be specified multiple times.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
This commit adds the first composing function: RelateNodeListAtID()

This method takes a nodelist and remixes it by relating it to a
node in an SBOM or nodelist.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
puerco and others added 15 commits January 15, 2025 10:57
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Copy link

@jhoward-lm jhoward-lm left a comment

Choose a reason for hiding this comment

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

Just some minor nitpicks, haven't fully reviewed yet

pkg/library/protobom.go Outdated Show resolved Hide resolved
pkg/library/protobom.go Outdated Show resolved Hide resolved
pkg/library/protobom.go Outdated Show resolved Hide resolved
pkg/runner/runner_implementation.go Outdated Show resolved Hide resolved
pkg/runner/runner_implementation.go Outdated Show resolved Hide resolved
pkg/runner/runner_implementation.go Outdated Show resolved Hide resolved
pkg/runner/runner_implementation.go Show resolved Hide resolved
pkg/runner/runner_implementation.go Show resolved Hide resolved
.golangci.yaml Outdated Show resolved Hide resolved
pkg/elements/document.go Outdated Show resolved Hide resolved
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
.bom.yaml Outdated Show resolved Hide resolved
Comment on lines +23 to +26
- name: Test
run: |
go get -d ./...
go test -v ./...

Choose a reason for hiding this comment

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

If you're interested, the Makefile over in protobom/storage has a target to run all the tests and print out a coverage report. Up to you

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll start improving all the machinery once we check-in the code. This are stripped version of the files originally written to release the bomshell binary.

Makefile Outdated

.PHONY: sbom
sbom:
cd dist && bom generate -c ../.bom.yaml -o sbom.spdx.json --format=json

Choose a reason for hiding this comment

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

Just curious, why not

Suggested change
cd dist && bom generate -c ../.bom.yaml -o sbom.spdx.json --format=json
bom generate -c .bom.yaml -o dist/sbom.spdx.json --format=json

Copy link
Member Author

Choose a reason for hiding this comment

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

I've pushed a change with it, but don't pay a lot of attention to the Makefile, all of this needs to be implemented as the repo is now a library and not a binary.

# - lll
# - nestif
# - nilerr
# - nlreturn

Choose a reason for hiding this comment

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

Did you want to enable this, or no? Up to you, just following up from my other comment

Copy link
Member Author

Choose a reason for hiding this comment

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

nlreturn? I just tried it and it highlighted a ton of issues, I'm not sure I want to deal with those now :S

This commit fixes the native type adapter. It was missing all the protobom
elements.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
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