sourceSignatures returns signatures from unparsedSource, and verifies that they can be used (to avoid copying a large image when we can tell in advance that it would ultimately fail)
(ctx context.Context, unparsed private.UnparsedImage, gettingSignaturesMessage, checkingDestMessage string)
| 54 | // and verifies that they can be used (to avoid copying a large image when we |
| 55 | // can tell in advance that it would ultimately fail) |
| 56 | func (c *copier) sourceSignatures(ctx context.Context, unparsed private.UnparsedImage, |
| 57 | gettingSignaturesMessage, checkingDestMessage string) ([]internalsig.Signature, error) { |
| 58 | var sigs []internalsig.Signature |
| 59 | if c.options.RemoveSignatures { |
| 60 | sigs = []internalsig.Signature{} |
| 61 | } else { |
| 62 | c.Printf("%s\n", gettingSignaturesMessage) |
| 63 | s, err := unparsed.UntrustedSignatures(ctx) |
| 64 | if err != nil { |
| 65 | return nil, fmt.Errorf("reading signatures: %w", err) |
| 66 | } |
| 67 | sigs = s |
| 68 | } |
| 69 | if len(sigs) != 0 { |
| 70 | c.Printf("%s\n", checkingDestMessage) |
| 71 | if err := c.dest.SupportsSignatures(ctx); err != nil { |
| 72 | return nil, fmt.Errorf("Can not copy signatures to %s: %w", transports.ImageName(c.dest.Reference()), err) |
| 73 | } |
| 74 | } |
| 75 | return sigs, nil |
| 76 | } |
| 77 | |
| 78 | // createSignatures creates signatures for manifest and an optional identity. |
| 79 | func (c *copier) createSignatures(ctx context.Context, manifest []byte, identity reference.Named) ([]internalsig.Signature, error) { |
no test coverage detected