MCPcopy Create free account
hub / github.com/docker/cli / signAndPublishToTarget

Function signAndPublishToTarget

cmd/docker-trust/trust/sign.go:116–133  ·  view source on GitHub ↗
(out io.Writer, imgRefAndAuth trust.ImageRefAndAuth, notaryRepo notaryclient.Repository, target notaryclient.Target)

Source from the content-addressed store, hash-verified

114}
115
116func 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
135func validateTag(imgRefAndAuth trust.ImageRefAndAuth) error {
136 tag := imgRefAndAuth.Tag()

Callers 1

runSignImageFunction · 0.85

Calls 6

RepoInfoMethod · 0.80
TagMethod · 0.45
NameMethod · 0.45
PublishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…