-
Notifications
You must be signed in to change notification settings - Fork 71
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
use Scorecard library entrypoint instead of Cobra hooking #1423
Conversation
Scorecard V5 released a new entrypoint, so make use of it instead of hooking into the underlying Cobra CLI. This gives us more flexibility when running Scorecard, such as writing the result to multiple formats. Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Testing the Dockerfile locally, the JSON output is identical (using But there aren't any great e2e tests currently setup before merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits.
Looks much cleaner, @spencerschrock!!
Signed-off-by: Stephen Augustus <justaugustus@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with code suggestions applied from #1423 (review).
Scorecard V5 released a new entrypoint, so make use of it instead of
hooking into the underlying Cobra CLI. This gives us more flexibility
when running Scorecard, such as writing the result to multiple formats.
The code got moved around a lot, my hope is it's organized more
clearly now, but I'll try to summarize it for the sake of the reviewer.
entrypoint/entrypoint.go
used to do several thingsRead the Scorecard Action options, which now takes place in our
main.go
scorecard-action/main.go
Lines 35 to 39 in 486e8de
All sorts of pre/post hooks to redirect output to both stdout and a result file. Which is done explicitly in a new format helper function.
scorecard-action/internal/scorecard/format.go
Lines 47 to 53 in 486e8de
signing/signing.go
re-ran scorecard viaGetJSONScorecardResults
, which is now a simple extra formatting call.scorecard-action/main.go
Lines 54 to 58 in 486e8de
In terms of testing, separating the format code makes it more testable! But the rest of it is very hard to unit test. I'll look into testing the rest of it.
Fixes #1071