mirror of
https://github.com/containers/podman.git
synced 2025-12-11 01:11:30 +08:00
Fix broken podman images filters
The id, digest, and intermediate filters were broken for podman images. Fix to match on substrings instead of the whole string for id and digest. Add the intermediate value correctly when set. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
42
vendor/github.com/containers/common/libimage/manifests/manifests.go
generated
vendored
42
vendor/github.com/containers/common/libimage/manifests/manifests.go
generated
vendored
@@ -6,8 +6,10 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/containers/common/pkg/manifests"
|
||||
"github.com/containers/common/pkg/retry"
|
||||
"github.com/containers/common/pkg/supplemented"
|
||||
cp "github.com/containers/image/v5/copy"
|
||||
"github.com/containers/image/v5/docker/reference"
|
||||
@@ -27,6 +29,10 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultMaxRetries = 3
|
||||
)
|
||||
|
||||
const instancesData = "instances.json"
|
||||
|
||||
// LookupReferenceFunc return an image reference based on the specified one.
|
||||
@@ -72,6 +78,11 @@ type PushOptions struct {
|
||||
SourceFilter LookupReferenceFunc // filter the list source
|
||||
AddCompression []string // add existing instances with requested compression algorithms to manifest list
|
||||
ForceCompressionFormat bool // force push with requested compression ignoring the blobs which can be reused.
|
||||
// Maximum number of retries with exponential backoff when facing
|
||||
// transient network errors. Default 3.
|
||||
MaxRetries *uint
|
||||
// RetryDelay used for the exponential back off of MaxRetries.
|
||||
RetryDelay *time.Duration
|
||||
}
|
||||
|
||||
// Create creates a new list containing information about the specified image,
|
||||
@@ -262,16 +273,31 @@ func (l *list) Push(ctx context.Context, dest types.ImageReference, options Push
|
||||
ForceCompressionFormat: options.ForceCompressionFormat,
|
||||
}
|
||||
|
||||
retryOptions := retry.Options{}
|
||||
retryOptions.MaxRetry = defaultMaxRetries
|
||||
if options.MaxRetries != nil {
|
||||
retryOptions.MaxRetry = int(*options.MaxRetries)
|
||||
}
|
||||
if options.RetryDelay != nil {
|
||||
retryOptions.Delay = *options.RetryDelay
|
||||
}
|
||||
|
||||
// Copy whatever we were asked to copy.
|
||||
manifestBytes, err := cp.Image(ctx, policyContext, dest, src, copyOptions)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
var manifestDigest digest.Digest
|
||||
f := func() error {
|
||||
opts := copyOptions
|
||||
var manifestBytes []byte
|
||||
var digest digest.Digest
|
||||
var err error
|
||||
if manifestBytes, err = cp.Image(ctx, policyContext, dest, src, opts); err == nil {
|
||||
if digest, err = manifest.Digest(manifestBytes); err == nil {
|
||||
manifestDigest = digest
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
manifestDigest, err := manifest.Digest(manifestBytes)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return nil, manifestDigest, nil
|
||||
err = retry.IfNecessary(ctx, f, &retryOptions)
|
||||
return nil, manifestDigest, err
|
||||
}
|
||||
|
||||
func prepareAddWithCompression(variants []string) ([]cp.OptionCompressionVariant, error) {
|
||||
|
||||
Reference in New Issue
Block a user