(out io.Writer, imgRefAndAuth trust.ImageRefAndAuth, notaryRepo notaryclient.Repository, target notaryclient.Target)
| 114 | } |
| 115 | |
| 116 | func signAndPublishToTarget(out io.Writer, imgRefAndAuth trust.ImageRefAndAuth, notaryRepo notaryclient.Repository, target notaryclient.Target) error { |
| 117 | tag := imgRefAndAuth.Tag() |
| 118 | _, _ = fmt.Fprintln(out, "Signing and pushing trust metadata for", imgRefAndAuth.Name()) |
| 119 | existingSigInfo, err := getExistingSignatureInfoForReleasedTag(notaryRepo, tag) |
| 120 | if err != nil { |
| 121 | return err |
| 122 | } |
| 123 | err = trust.AddToAllSignableRoles(notaryRepo, &target) |
| 124 | if err == nil { |
| 125 | prettyPrintExistingSignatureInfo(out, existingSigInfo) |
| 126 | err = notaryRepo.Publish() |
| 127 | } |
| 128 | if err != nil { |
| 129 | return fmt.Errorf("failed to sign %s:%s: %w", imgRefAndAuth.RepoInfo().Name.Name(), tag, err) |
| 130 | } |
| 131 | _, _ = fmt.Fprintf(out, "Successfully signed %s:%s\n", imgRefAndAuth.RepoInfo().Name.Name(), tag) |
| 132 | return nil |
| 133 | } |
| 134 | |
| 135 | func validateTag(imgRefAndAuth trust.ImageRefAndAuth) error { |
| 136 | tag := imgRefAndAuth.Tag() |
no test coverage detected
searching dependent graphs…