Skip to content

Commit

Permalink
Fix crane digest for v1 and platform option (#907)
Browse files Browse the repository at this point in the history
* Fix crane digest for v1 and platform option

This allows to use crane.Digest on images with a v1 schema

* Move logic after err check

* Add TODO for indexes which contain schema v1 manifests
  • Loading branch information
dvob committed Jan 8, 2021
1 parent f97c411 commit 7682012
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/crane/digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ func Digest(ref string, opt ...Option) (string, error) {
if err != nil {
return "", err
}
if !desc.MediaType.IsIndex() {
return desc.Digest.String(), nil
}

// TODO: does not work for indexes which contain schema v1 manifests
img, err := desc.Image()
if err != nil {
return "", err
Expand Down

0 comments on commit 7682012

Please sign in to comment.