Skip to content

Commit

Permalink
add examples for cosign attach signature cmd (#3468)
Browse files Browse the repository at this point in the history
* add examples for cosign attach signature cmd

Signed-off-by: Vivek Kumar Sahu <[email protected]>

* remove whitespace

Signed-off-by: Vivek Kumar Sahu <[email protected]>

* update cosign attach docs

Signed-off-by: Vivek Kumar Sahu <[email protected]>

---------

Signed-off-by: Vivek Kumar Sahu <[email protected]>
  • Loading branch information
viveksahu26 authored Jan 4, 2024
1 parent daf1eeb commit d372b9b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
23 changes: 20 additions & 3 deletions cmd/cosign/cli/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,26 @@ func attachSignature() *cobra.Command {
o := &options.AttachSignatureOptions{}

cmd := &cobra.Command{
Use: "signature",
Short: "Attach signatures to the supplied container image",
Example: " cosign attach signature <image uri>",
Use: "signature",
Short: "Attach signatures to the supplied container image",
Example: ` cosign attach signature [--payload <path>] [--signature < path>] [--rekor-response < path>] <image uri>
cosign attach signature command attaches payload, signature, rekor-bundle, etc in a new layer of provided image.
# Attach signature can attach payload to a supplied image
cosign attach signature --payload <payload.json> $IMAGE
# Attach signature can attach payload, signature to a supplied image
cosign attach signature --payload <payload.json> --signature <base64 signature file> $IMAGE
# Attach signature can attach payload, signature, time stamped response to a supplied image
cosign attach signature --payload <payload.json> --signature <base64 signature file> --tsr=<file> $IMAGE
# Attach signature attaches payload, signature and rekor-bundle via rekor-response to a supplied image
cosign attach signature --payload <payload.json> --signature <base64 signature file> --rekor-response <proper rekor-response format file> $IMAGE
# Attach signature attaches payload, signature and rekor-bundle directly to a supplied image
cosign attach signature --payload <payload.json> --signature <base64 signature file> --rekor-response <rekor-bundle file> $IMAGE`,
PersistentPreRun: options.BindViper,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
19 changes: 18 additions & 1 deletion doc/cosign_attach_signature.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d372b9b

Please sign in to comment.