Skip to content

Commit

Permalink
accepts attachment-tag-prefix for cosign copy
Browse files Browse the repository at this point in the history
Signed-off-by: Mritunjay <mritunjaysharma394@gmail.com>
  • Loading branch information
mritunjaysharma394 committed May 29, 2023
1 parent 6236366 commit ff25b99
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/cosign/cli/copy/copy.go
Expand Up @@ -49,17 +49,24 @@ func CopyCmd(ctx context.Context, regOpts options.RegistryOptions, srcImg, dstIm
}
dstRepoRef := dstRef.Context()

ociRemoteOpts, err := regOpts.ClientOpts(ctx)
if err != nil {
return err
}

remoteOpts := regOpts.GetRegistryClientOpts(ctx)

pusher, err := remote.NewPusher(remoteOpts...)
if err != nil {
return err
}

ociRemoteOpts = append(ociRemoteOpts, ociremote.WithRemoteOptions(remoteOpts...))

g, gctx := errgroup.WithContext(ctx)
g.SetLimit(runtime.GOMAXPROCS(0))

root, err := ociremote.SignedEntity(srcRef, ociremote.WithRemoteOptions(remoteOpts...))
root, err := ociremote.SignedEntity(srcRef, ociRemoteOpts...)
if err != nil {
return err
}
Expand All @@ -73,7 +80,7 @@ func CopyCmd(ctx context.Context, regOpts options.RegistryOptions, srcImg, dstIm
srcDigest := srcRepoRef.Digest(h.String())

copyTag := func(tm tagMap) error {
src, err := tm(srcDigest, ociremote.WithRemoteOptions(remoteOpts...))
src, err := tm(srcDigest, ociRemoteOpts...)
if err != nil {
return err
}
Expand Down

0 comments on commit ff25b99

Please sign in to comment.