mirror of
https://github.com/containers/podman.git
synced 2025-09-26 16:25:00 +08:00
podman image tree: restore previous behavior
The initial version of libimage changed the order of layers which has now been restored to remain backwards compatible. Further changes: * Fix a bug in the journald logging which requires to strip trailing new lines from the message. The system tests did not pass due to empty new lines. Triggered by changing the default logger to journald in containers/common. * Fix another bug in the journald logging which embedded the container ID inside the message rather than the specifid field. That surfaced in a preceeding whitespace of each log line which broke the system tests. * Alter the system tests to make sure that the k8s-file and the journald logging drivers are executed. * A number of e2e tests have been changed to force the k8s-file driver to make them pass when running inside a root container. * Increase the timeout in a kill test which seems to take longer now. Reasons are unknown. Tests passed earlier and no signal-related changes happend. It may be CI VM flake since some system tests but other flaked. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
45
vendor/github.com/containers/common/libimage/pull.go
generated
vendored
45
vendor/github.com/containers/common/libimage/pull.go
generated
vendored
@ -5,10 +5,10 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/containers/common/pkg/config"
|
||||
dirTransport "github.com/containers/image/v5/directory"
|
||||
dockerTransport "github.com/containers/image/v5/docker"
|
||||
registryTransport "github.com/containers/image/v5/docker"
|
||||
dockerArchiveTransport "github.com/containers/image/v5/docker/archive"
|
||||
"github.com/containers/image/v5/docker/reference"
|
||||
ociArchiveTransport "github.com/containers/image/v5/oci/archive"
|
||||
@ -42,7 +42,7 @@ type PullOptions struct {
|
||||
// policies (e.g., buildah-bud versus podman-build). Making the pull-policy
|
||||
// choice explicit is an attempt to prevent silent regressions.
|
||||
//
|
||||
// The errror is storage.ErrImageUnknown iff the pull policy is set to "never"
|
||||
// The error is storage.ErrImageUnknown iff the pull policy is set to "never"
|
||||
// and no local image has been found. This allows for an easier integration
|
||||
// into some users of this package (e.g., Buildah).
|
||||
func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullPolicy, options *PullOptions) ([]*Image, error) {
|
||||
@ -56,7 +56,7 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP
|
||||
if err != nil {
|
||||
// If the image clearly refers to a local one, we can look it up directly.
|
||||
// In fact, we need to since they are not parseable.
|
||||
if strings.HasPrefix(name, "sha256:") || (len(name) == 64 && !strings.Contains(name, "/.:@")) {
|
||||
if strings.HasPrefix(name, "sha256:") || (len(name) == 64 && !strings.ContainsAny(name, "/.:@")) {
|
||||
if pullPolicy == config.PullPolicyAlways {
|
||||
return nil, errors.Errorf("pull policy is always but image has been referred to by ID (%s)", name)
|
||||
}
|
||||
@ -76,10 +76,14 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP
|
||||
ref = dockerRef
|
||||
}
|
||||
|
||||
if options.AllTags && ref.Transport().Name() != dockerTransport.Transport.Name() {
|
||||
if options.AllTags && ref.Transport().Name() != registryTransport.Transport.Name() {
|
||||
return nil, errors.Errorf("pulling all tags is not supported for %s transport", ref.Transport().Name())
|
||||
}
|
||||
|
||||
if r.eventChannel != nil {
|
||||
r.writeEvent(&Event{ID: "", Name: name, Time: time.Now(), Type: EventTypeImagePull})
|
||||
}
|
||||
|
||||
var (
|
||||
pulledImages []string
|
||||
pullError error
|
||||
@ -88,29 +92,17 @@ func (r *Runtime) Pull(ctx context.Context, name string, pullPolicy config.PullP
|
||||
// Dispatch the copy operation.
|
||||
switch ref.Transport().Name() {
|
||||
|
||||
// DOCKER/REGISTRY
|
||||
case dockerTransport.Transport.Name():
|
||||
// DOCKER REGISTRY
|
||||
case registryTransport.Transport.Name():
|
||||
pulledImages, pullError = r.copyFromRegistry(ctx, ref, strings.TrimPrefix(name, "docker://"), pullPolicy, options)
|
||||
|
||||
// DOCKER ARCHIVE
|
||||
case dockerArchiveTransport.Transport.Name():
|
||||
pulledImages, pullError = r.copyFromDockerArchive(ctx, ref, &options.CopyOptions)
|
||||
|
||||
// OCI
|
||||
case ociTransport.Transport.Name():
|
||||
pulledImages, pullError = r.copyFromDefault(ctx, ref, &options.CopyOptions)
|
||||
|
||||
// OCI ARCHIVE
|
||||
case ociArchiveTransport.Transport.Name():
|
||||
pulledImages, pullError = r.copyFromDefault(ctx, ref, &options.CopyOptions)
|
||||
|
||||
// DIR
|
||||
case dirTransport.Transport.Name():
|
||||
pulledImages, pullError = r.copyFromDefault(ctx, ref, &options.CopyOptions)
|
||||
|
||||
// UNSUPPORTED
|
||||
// ALL OTHER TRANSPORTS
|
||||
default:
|
||||
return nil, errors.Errorf("unsupported transport %q for pulling", ref.Transport().Name())
|
||||
pulledImages, pullError = r.copyFromDefault(ctx, ref, &options.CopyOptions)
|
||||
}
|
||||
|
||||
if pullError != nil {
|
||||
@ -162,7 +154,12 @@ func (r *Runtime) copyFromDefault(ctx context.Context, ref types.ImageReference,
|
||||
imageName = "sha256:" + storageName[1:]
|
||||
} else {
|
||||
storageName = manifest.Annotations["org.opencontainers.image.ref.name"]
|
||||
imageName = storageName
|
||||
named, err := NormalizeName(storageName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
imageName = named.String()
|
||||
storageName = imageName
|
||||
}
|
||||
|
||||
default:
|
||||
@ -275,7 +272,7 @@ func (r *Runtime) copyFromRegistry(ctx context.Context, ref types.ImageReference
|
||||
}
|
||||
|
||||
named := reference.TrimNamed(ref.DockerReference())
|
||||
tags, err := dockerTransport.GetRepositoryTags(ctx, &r.systemContext, ref)
|
||||
tags, err := registryTransport.GetRepositoryTags(ctx, &r.systemContext, ref)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -399,7 +396,7 @@ func (r *Runtime) copySingleImageFromRegistry(ctx context.Context, imageName str
|
||||
for _, candidate := range resolved.PullCandidates {
|
||||
candidateString := candidate.Value.String()
|
||||
logrus.Debugf("Attempting to pull candidate %s for %s", candidateString, imageName)
|
||||
srcRef, err := dockerTransport.NewReference(candidate.Value)
|
||||
srcRef, err := registryTransport.NewReference(candidate.Value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user