pull: fallthrough for registry parsing errors

Pull is a bit of an "one size fits all" API to keep complexity away from
callers and hide everything behind the interface.

Commit 369aaa4178 recently altered the error reporting to when pulling
fromt the `docker-daemon` transport which in turn caused a regression in
Buildah CI when pulling `docker:latest`.  Such an input would cause a
parsing error in the `docker:`.

Fix the regression by relaxing the stricter error reporting introduced
by commit 369aaa4178 and make an exception for the `docker:`
transport.  Note that invalid input would still be caught a couple of
lines below.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg 2021-08-02 09:14:43 +02:00
parent 57dbcc0fa4
commit f1f1300c77
1 changed files with 4 additions and 1 deletions

View File

@ -61,7 +61,10 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP
// Check whether `name` points to a transport. If so, we // Check whether `name` points to a transport. If so, we
// return the error. Otherwise we assume that `name` refers to // return the error. Otherwise we assume that `name` refers to
// an image on a registry (e.g., "fedora"). // an image on a registry (e.g., "fedora").
if alltransports.TransportFromImageName(name) != nil { //
// NOTE: the `docker` transport is an exception to support a
// `pull docker:latest` which would otherwise return an error.
if t := alltransports.TransportFromImageName(name); t != nil && t.Name() != registryTransport.Transport.Name() {
return nil, err return nil, err
} }