mirror of https://github.com/containers/image.git
docker: reference: load sha256 explicitly
There has been a change in upstream (docker/distribution), where they now require users of the digest library to load algorithms into the binary (in other words they do .Available checks on crypto algorithms). This fixes the unit test failures with "unsupported digest algorithm". Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
parent
23dbcf1b2b
commit
d0a45e907a
|
|
@ -6,6 +6,9 @@ import (
|
|||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
// "docker/distribution/digest" requires us to load the algorithms that we
|
||||
// want to use into the binary (it calls .Available).
|
||||
_ "crypto/sha256"
|
||||
"github.com/docker/distribution/digest"
|
||||
distreference "github.com/docker/distribution/reference"
|
||||
)
|
||||
|
|
@ -55,7 +58,7 @@ type Canonical interface {
|
|||
func ParseNamed(s string) (Named, error) {
|
||||
named, err := distreference.ParseNamed(s)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("Error parsing reference: %q is not a valid repository/tag", s)
|
||||
return nil, errors.Wrapf(err, "Error parsing reference: %q is not a valid repository/tag", s)
|
||||
}
|
||||
r, err := WithName(named.Name())
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package reference
|
|||
import (
|
||||
"testing"
|
||||
|
||||
_ "crypto/sha256"
|
||||
"github.com/docker/distribution/digest"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue