@@ -141,7 +141,7 @@ type SignOptions struct {
141
141
// Sign signs the OCI artifact and push the signature to the Repository.
142
142
// The descriptor of the sign content is returned upon successful signing.
143
143
//
144
- // Deprecated: use SignOCI instead.
144
+ // Deprecated: use [ SignOCI] instead.
145
145
func Sign (ctx context.Context , signer Signer , repo registry.Repository , signOpts SignOptions ) (ocispec.Descriptor , error ) {
146
146
artifactMenifestDesc , _ , err := SignOCI (ctx , signer , repo , signOpts )
147
147
return artifactMenifestDesc , err
@@ -151,6 +151,12 @@ func Sign(ctx context.Context, signer Signer, repo registry.Repository, signOpts
151
151
//
152
152
// Both artifact and signature manifest descriptors are returned upon successful
153
153
// signing.
154
+ //
155
+ // Note: If the error type is remote.ReferrersError and
156
+ // referrerError.IsReferrersIndexDelete() returns true, the signature is
157
+ // successfully pushed to the repository, but the referrers index deletion
158
+ // failed. In this case, the artifact and signature manifest descriptors are
159
+ // returned with the error.
154
160
func SignOCI (ctx context.Context , signer Signer , repo registry.Repository , signOpts SignOptions ) (artifactManifestDesc , sigManifestDesc ocispec.Descriptor , err error ) {
155
161
// sanity check
156
162
if err := validateSignArguments (signer , signOpts .SignerSignOptions ); err != nil {
@@ -207,10 +213,9 @@ func SignOCI(ctx context.Context, signer Signer, repo registry.Repository, signO
207
213
if err != nil {
208
214
var referrerError * remote.ReferrersError
209
215
if errors .As (err , & referrerError ) && referrerError .IsReferrersIndexDelete () {
210
- // log warning if referrers index removal failed but signature
211
- // pushed succeeded
212
- logger .Warn ("Removal of outdated referrers index from remote registry failed. Garbage collection may be required." )
213
- return artifactManifestDesc , sigManifestDesc , nil
216
+ // return the descriptors for referrersIndexDelete error as
217
+ // the signature is successfully pushed to the repository
218
+ return artifactManifestDesc , sigManifestDesc , err
214
219
}
215
220
logger .Error ("Failed to push the signature" )
216
221
return ocispec.Descriptor {}, ocispec.Descriptor {}, ErrorPushSignatureFailed {Msg : err .Error ()}
0 commit comments