Skip to content

Commit

Permalink
fix: update comment
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Sep 3, 2023
1 parent 7e008e6 commit 0b41645
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion registry/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ func (c *repositoryClient) uploadSignatureManifest(ctx context.Context, subject,

// pushNotationManifestConfig pushes an empty notation manifest config, if it
// doesn't exist.
//
// if the config exists, it returns the descriptor of the config without error.
func pushNotationManifestConfig(ctx context.Context, pusher content.Storage) (ocispec.Descriptor, error) {
// check if the config exists
exists, err := pusher.Exists(ctx, notationEmptyConfigDesc)
Expand All @@ -230,7 +232,7 @@ func pushNotationManifestConfig(ctx context.Context, pusher content.Storage) (oc
return notationEmptyConfigDesc, nil
}

// push the config
// return nil if the config pushed successfully or it already exists
if err := pusher.Push(ctx, notationEmptyConfigDesc, bytes.NewReader(notationEmptyConfigData)); err != nil && !errors.Is(err, errdef.ErrAlreadyExists) {
return ocispec.Descriptor{}, fmt.Errorf("unable to push: %s: %s. Details: %w", notationEmptyConfigDesc.Digest.String(), notationEmptyConfigDesc.MediaType, err)
}
Expand Down

0 comments on commit 0b41645

Please sign in to comment.