Skip to content

Commit

Permalink
Fix --sig-only in cosign copy (#3074)
Browse files Browse the repository at this point in the history
This sigOnly early return needs to come after we Wait() for the
signature to finish copying.

Signed-off-by: Jon Johnson <jon.johnson@chainguard.dev>
  • Loading branch information
jonjohnsonjr committed Jun 21, 2023
1 parent a476d20 commit ff648d5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/cosign/cli/copy/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func CopyCmd(ctx context.Context, regOpts options.RegistryOptions, srcImg, dstIm
if err := copyTag(ociremote.SignatureTag); err != nil {
return err
}

if sigOnly {
return nil
}
Expand All @@ -117,15 +118,17 @@ func CopyCmd(ctx context.Context, regOpts options.RegistryOptions, srcImg, dstIm
}); err != nil {
return err
}
if sigOnly {
return nil
}

// Wait for everything to be copied over.
if err := g.Wait(); err != nil {
return err
}

// If we're only copying sigs, we have nothing left to do.
if sigOnly {
return nil
}

// Now that everything has been copied over, update the tag.
h, err := root.Digest()
if err != nil {
Expand Down

0 comments on commit ff648d5

Please sign in to comment.