-
Notifications
You must be signed in to change notification settings - Fork 553
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
phase 1, migrate the outer shell of cosign to cobra #728
Conversation
433a53f
to
87d1c20
Compare
cmd.PersistentFlags().StringVar(&o.OutputFile, "output-file", "", | ||
"log output to a file") | ||
|
||
cmd.PersistentFlags().BoolVarP(&o.Verbose, "verbose", "d", false, |
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.
cmd.PersistentFlags().BoolVarP(&o.Verbose, "verbose", "d", false, | |
cmd.PersistentFlags().BoolVarP(&o.Verbose, "verbose", "v", false, |
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.
the current option is d
for debug, but debug is not a normal flag, verbose is :idk:
} | ||
|
||
func AddRootArgs(cmd *cobra.Command, o *RootOptions) { | ||
cmd.PersistentFlags().StringVar(&o.OutputFile, "output-file", "", |
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.
--log-out
? --log-file
?
We'll probably be wanting to use --output-file
and/or -o
for the commands that rewrite dockerfiles and k8s manifests
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.
I don't want to change the flag, but yeah I like that better. Let's get the refactor in place and revisit what we want long term
if !options.EnableExperimental() { | ||
if !options.OneOf(*key, *sk) { | ||
return &options.KeyParseError{} | ||
} | ||
} |
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.
if !options.EnableExperimental() { | |
if !options.OneOf(*key, *sk) { | |
return &options.KeyParseError{} | |
} | |
} | |
if !options.EnableExperimental() && !options.OneOf(*key, *sk) { | |
return &options.KeyParseError{} | |
} |
@@ -114,19 +118,19 @@ func isb64(data []byte) bool { | |||
return err == nil | |||
} | |||
|
|||
func VerifyBlobCmd(ctx context.Context, ko KeyOpts, certRef, sigRef, blobRef string) error { | |||
var pubKey signature.Verifier | |||
func VerifyBlobCmd(ctx context.Context, ko sign.KeyOpts, certRef, sigRef, blobRef string) error { |
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.
func VerifyBlobCmd(ctx context.Context, ko sign.KeyOpts, certRef, sigRef, blobRef string) error { | |
func Blob(ctx context.Context, ko sign.KeyOpts, certRef, sigRef, blobRef string) error { |
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.
:D I started doing this but all of the files are not constant. the plan is to move all of this code into another form, so this whole thing is throw away anyway soon. let's hold off renaming at this moment, I added a // nolint
comment for now.
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.
ty
"github.com/sigstore/sigstore/pkg/signature" | ||
"github.com/sigstore/sigstore/pkg/signature/options" | ||
sigstoresigs "github.com/sigstore/sigstore/pkg/signature" | ||
signatureoptions "github.com/sigstore/sigstore/pkg/signature/options" | ||
) | ||
|
||
func VerifyBlob() *ffcli.Command { |
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.
func VerifyBlob() *ffcli.Command { | |
func BlobCmd() *ffcli.Command { |
"github.com/sigstore/cosign/pkg/cosign" | ||
"github.com/sigstore/cosign/pkg/cosign/pivkey" | ||
"github.com/sigstore/cosign/pkg/image" | ||
sigs "github.com/sigstore/cosign/pkg/signature" | ||
"github.com/sigstore/sigstore/pkg/signature" | ||
"github.com/sigstore/sigstore/pkg/signature/payload" | ||
) | ||
|
||
// VerifyCommand verifies a signature on a supplied container image | ||
type VerifyCommand struct { |
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.
This one's weirder than the other surfaces, but would be good to address the linter feedback here, too
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.
yeah, agreed, but not in this PR?
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.
sgtm
87d1c20
to
e6fad61
Compare
Signed-off-by: Scott Nichols <[email protected]>
e6fad61
to
3cafe3d
Compare
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.
approved w/ comments for further iteration
Summary
This is the first in several PRs to migrate cosign to cobra. In this PR I have focused on:
cmd/
and intopkg/
where needed to prevent circular dependencies.Ticket Link
Related to #706
Release Note