mirror of
https://github.com/containers/skopeo.git
synced 2025-09-21 18:09:08 +00:00
Update c/image after https://github.com/containers/image/pull/1842
... so that Renovate doesn't keep proposing a downgrade. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
4
vendor/github.com/containers/image/v5/docker/archive/src.go
generated
vendored
4
vendor/github.com/containers/image/v5/docker/archive/src.go
generated
vendored
@@ -1,8 +1,6 @@
|
||||
package archive
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/containers/image/v5/docker/internal/tarfile"
|
||||
"github.com/containers/image/v5/internal/private"
|
||||
"github.com/containers/image/v5/types"
|
||||
@@ -15,7 +13,7 @@ type archiveImageSource struct {
|
||||
|
||||
// newImageSource returns a types.ImageSource for the specified image reference.
|
||||
// The caller must call .Close() on the returned ImageSource.
|
||||
func newImageSource(ctx context.Context, sys *types.SystemContext, ref archiveReference) (private.ImageSource, error) {
|
||||
func newImageSource(sys *types.SystemContext, ref archiveReference) (private.ImageSource, error) {
|
||||
var archive *tarfile.Reader
|
||||
var closeArchive bool
|
||||
if ref.archiveReader != nil {
|
||||
|
2
vendor/github.com/containers/image/v5/docker/archive/transport.go
generated
vendored
2
vendor/github.com/containers/image/v5/docker/archive/transport.go
generated
vendored
@@ -190,7 +190,7 @@ func (ref archiveReference) NewImage(ctx context.Context, sys *types.SystemConte
|
||||
// NewImageSource returns a types.ImageSource for this reference.
|
||||
// The caller must call .Close() on the returned ImageSource.
|
||||
func (ref archiveReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||
return newImageSource(ctx, sys, ref)
|
||||
return newImageSource(sys, ref)
|
||||
}
|
||||
|
||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||
|
85
vendor/github.com/containers/image/v5/docker/body_reader.go
generated
vendored
85
vendor/github.com/containers/image/v5/docker/body_reader.go
generated
vendored
@@ -17,22 +17,27 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// bodyReaderMinimumProgress is the minimum progress we want to see before we retry
|
||||
const bodyReaderMinimumProgress = 1 * 1024 * 1024
|
||||
const (
|
||||
// bodyReaderMinimumProgress is the minimum progress we consider a good reason to retry
|
||||
bodyReaderMinimumProgress = 1 * 1024 * 1024
|
||||
// bodyReaderMSSinceLastRetry is the minimum time since a last retry we consider a good reason to retry
|
||||
bodyReaderMSSinceLastRetry = 60 * 1_000
|
||||
)
|
||||
|
||||
// bodyReader is an io.ReadCloser returned by dockerImageSource.GetBlob,
|
||||
// which can transparently resume some (very limited) kinds of aborted connections.
|
||||
type bodyReader struct {
|
||||
ctx context.Context
|
||||
c *dockerClient
|
||||
|
||||
path string // path to pass to makeRequest to retry
|
||||
logURL *url.URL // a string to use in error messages
|
||||
body io.ReadCloser // The currently open connection we use to read data, or nil if there is nothing to read from / close.
|
||||
lastRetryOffset int64
|
||||
offset int64 // Current offset within the blob
|
||||
ctx context.Context
|
||||
c *dockerClient
|
||||
path string // path to pass to makeRequest to retry
|
||||
logURL *url.URL // a string to use in error messages
|
||||
firstConnectionTime time.Time
|
||||
lastSuccessTime time.Time // time.Time{} if N/A
|
||||
|
||||
body io.ReadCloser // The currently open connection we use to read data, or nil if there is nothing to read from / close.
|
||||
lastRetryOffset int64 // -1 if N/A
|
||||
lastRetryTime time.Time // time.Time{} if N/A
|
||||
offset int64 // Current offset within the blob
|
||||
lastSuccessTime time.Time // time.Time{} if N/A
|
||||
}
|
||||
|
||||
// newBodyReader creates a bodyReader for request path in c.
|
||||
@@ -44,15 +49,17 @@ func newBodyReader(ctx context.Context, c *dockerClient, path string, firstBody
|
||||
return nil, err
|
||||
}
|
||||
res := &bodyReader{
|
||||
ctx: ctx,
|
||||
c: c,
|
||||
|
||||
ctx: ctx,
|
||||
c: c,
|
||||
path: path,
|
||||
logURL: logURL,
|
||||
body: firstBody,
|
||||
lastRetryOffset: 0,
|
||||
offset: 0,
|
||||
firstConnectionTime: time.Now(),
|
||||
|
||||
body: firstBody,
|
||||
lastRetryOffset: -1,
|
||||
lastRetryTime: time.Time{},
|
||||
offset: 0,
|
||||
lastSuccessTime: time.Time{},
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
@@ -190,6 +197,7 @@ func (br *bodyReader) Read(p []byte) (int, error) {
|
||||
consumedBody = true
|
||||
br.body = res.Body
|
||||
br.lastRetryOffset = br.offset
|
||||
br.lastRetryTime = time.Time{}
|
||||
return n, nil
|
||||
|
||||
default:
|
||||
@@ -198,29 +206,40 @@ func (br *bodyReader) Read(p []byte) (int, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// millisecondsSince is like time.Since(tm).Milliseconds, but it returns a floating-point value
|
||||
func millisecondsSince(tm time.Time) float64 {
|
||||
return float64(time.Since(tm).Nanoseconds()) / 1_000_000.0
|
||||
// millisecondsSinceOptional is like currentTime.Sub(tm).Milliseconds, but it returns a floating-point value.
|
||||
// If tm is time.Time{}, it returns math.NaN()
|
||||
func millisecondsSinceOptional(currentTime time.Time, tm time.Time) float64 {
|
||||
if tm == (time.Time{}) {
|
||||
return math.NaN()
|
||||
}
|
||||
return float64(currentTime.Sub(tm).Nanoseconds()) / 1_000_000.0
|
||||
}
|
||||
|
||||
// errorIfNotReconnecting makes a heuristic decision whether we should reconnect after err at redactedURL; if so, it returns nil,
|
||||
// otherwise it returns an appropriate error to return to the caller (possibly augmented with data about the heuristic)
|
||||
func (br *bodyReader) errorIfNotReconnecting(originalErr error, redactedURL string) error {
|
||||
totalTime := millisecondsSince(br.firstConnectionTime)
|
||||
failureTime := math.NaN()
|
||||
if (br.lastSuccessTime != time.Time{}) {
|
||||
failureTime = millisecondsSince(br.lastSuccessTime)
|
||||
}
|
||||
logrus.Debugf("Reading blob body from %s failed (%#v), decision inputs: lastRetryOffset %d, offset %d, %.3f ms since first connection, %.3f ms since last progress",
|
||||
redactedURL, originalErr, br.lastRetryOffset, br.offset, totalTime, failureTime)
|
||||
currentTime := time.Now()
|
||||
msSinceFirstConnection := millisecondsSinceOptional(currentTime, br.firstConnectionTime)
|
||||
msSinceLastRetry := millisecondsSinceOptional(currentTime, br.lastRetryTime)
|
||||
msSinceLastSuccess := millisecondsSinceOptional(currentTime, br.lastSuccessTime)
|
||||
logrus.Debugf("Reading blob body from %s failed (%#v), decision inputs: total %d @%.3f ms, last retry %d @%.3f ms, last progress @%.3f ms",
|
||||
redactedURL, originalErr, br.offset, msSinceFirstConnection, br.lastRetryOffset, msSinceLastRetry, msSinceLastSuccess)
|
||||
progress := br.offset - br.lastRetryOffset
|
||||
if progress < bodyReaderMinimumProgress {
|
||||
logrus.Debugf("Not reconnecting to %s because only %d bytes progress made", redactedURL, progress)
|
||||
return fmt.Errorf("(heuristic tuning data: last retry %d, current offset %d; %.3f ms total, %.3f ms since progress): %w",
|
||||
br.lastRetryOffset, br.offset, totalTime, failureTime, originalErr)
|
||||
if progress >= bodyReaderMinimumProgress {
|
||||
logrus.Infof("Reading blob body from %s failed (%v), reconnecting after %d bytes…", redactedURL, originalErr, progress)
|
||||
return nil
|
||||
}
|
||||
logrus.Infof("Reading blob body from %s failed (%v), reconnecting…", redactedURL, originalErr)
|
||||
return nil
|
||||
if br.lastRetryTime == (time.Time{}) {
|
||||
logrus.Infof("Reading blob body from %s failed (%v), reconnecting (first reconnection)…", redactedURL, originalErr)
|
||||
return nil
|
||||
}
|
||||
if msSinceLastRetry >= bodyReaderMSSinceLastRetry {
|
||||
logrus.Infof("Reading blob body from %s failed (%v), reconnecting after %.3f ms…", redactedURL, originalErr, msSinceLastRetry)
|
||||
return nil
|
||||
}
|
||||
logrus.Debugf("Not reconnecting to %s: insufficient progress %d / time since last retry %.3f ms", redactedURL, progress, msSinceLastRetry)
|
||||
return fmt.Errorf("(heuristic tuning data: total %d @%.3f ms, last retry %d @%.3f ms, last progress @ %.3f ms): %w",
|
||||
br.offset, msSinceFirstConnection, br.lastRetryOffset, msSinceLastRetry, msSinceLastSuccess, originalErr)
|
||||
}
|
||||
|
||||
// Close implements io.ReadCloser
|
||||
|
2
vendor/github.com/containers/image/v5/docker/docker_client.go
generated
vendored
2
vendor/github.com/containers/image/v5/docker/docker_client.go
generated
vendored
@@ -994,7 +994,7 @@ func (c *dockerClient) getOCIDescriptorContents(ctx context.Context, ref dockerR
|
||||
return nil, err
|
||||
}
|
||||
defer reader.Close()
|
||||
payload, err := iolimits.ReadAtMost(reader, iolimits.MaxSignatureBodySize)
|
||||
payload, err := iolimits.ReadAtMost(reader, maxSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("reading blob %s in %s: %w", desc.Digest.String(), ref.ref.Name(), err)
|
||||
}
|
||||
|
5
vendor/github.com/containers/image/v5/manifest/oci.go
generated
vendored
5
vendor/github.com/containers/image/v5/manifest/oci.go
generated
vendored
@@ -6,7 +6,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/containers/image/v5/internal/manifest"
|
||||
internalManifest "github.com/containers/image/v5/internal/manifest"
|
||||
compressiontypes "github.com/containers/image/v5/pkg/compression/types"
|
||||
"github.com/containers/image/v5/types"
|
||||
ociencspec "github.com/containers/ocicrypt/spec"
|
||||
@@ -197,7 +196,7 @@ func (m *OCI1) Inspect(configGetter func(types.BlobInfo) ([]byte, error)) (*type
|
||||
// Most software calling this without human intervention is going to expect the values to be realistic and relevant,
|
||||
// and is probably better served by failing; we can always re-visit that later if we fail now, but
|
||||
// if we started returning some data for OCI artifacts now, we couldn’t start failing in this function later.
|
||||
return nil, internalManifest.NewNonImageArtifactError(m.Config.MediaType)
|
||||
return nil, manifest.NewNonImageArtifactError(m.Config.MediaType)
|
||||
}
|
||||
|
||||
config, err := configGetter(m.ConfigInfo())
|
||||
@@ -248,7 +247,7 @@ func (m *OCI1) ImageID([]digest.Digest) (string, error) {
|
||||
// (The only known caller of ImageID is storage/storageImageDestination.computeID,
|
||||
// which can’t work with non-image artifacts.)
|
||||
if m.Config.MediaType != imgspecv1.MediaTypeImageConfig {
|
||||
return "", internalManifest.NewNonImageArtifactError(m.Config.MediaType)
|
||||
return "", manifest.NewNonImageArtifactError(m.Config.MediaType)
|
||||
}
|
||||
|
||||
if err := m.Config.Digest.Validate(); err != nil {
|
||||
|
11
vendor/github.com/containers/image/v5/openshift/openshift-copies.go
generated
vendored
11
vendor/github.com/containers/image/v5/openshift/openshift-copies.go
generated
vendored
@@ -21,7 +21,6 @@ import (
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/exp/slices"
|
||||
"golang.org/x/net/http2"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
@@ -212,7 +211,7 @@ func (config *directClientConfig) ClientConfig() (*restConfig, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
serverAuthPartialConfig, err := getServerIdentificationPartialConfig(configAuthInfo, configClusterInfo)
|
||||
serverAuthPartialConfig, err := getServerIdentificationPartialConfig(configClusterInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -231,7 +230,7 @@ func (config *directClientConfig) ClientConfig() (*restConfig, error) {
|
||||
// 1. configClusterInfo (the final result of command line flags and merged .kubeconfig files)
|
||||
// 2. configAuthInfo.auth-path (this file can contain information that conflicts with #1, and we want #1 to win the priority)
|
||||
// 3. load the ~/.kubernetes_auth file as a default
|
||||
func getServerIdentificationPartialConfig(configAuthInfo clientcmdAuthInfo, configClusterInfo clientcmdCluster) (*restConfig, error) {
|
||||
func getServerIdentificationPartialConfig(configClusterInfo clientcmdCluster) (*restConfig, error) {
|
||||
mergedConfig := &restConfig{}
|
||||
|
||||
// configClusterInfo holds the information identify the server provided by .kubeconfig
|
||||
@@ -931,14 +930,14 @@ func tlsCacheGet(config *restConfig) (http.RoundTripper, error) {
|
||||
Proxy: newProxierWithNoProxyCIDR(http.ProxyFromEnvironment),
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
TLSClientConfig: tlsConfig,
|
||||
Dial: (&net.Dialer{
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
}).DialContext,
|
||||
}
|
||||
// Allow clients to disable http2 if needed.
|
||||
if s := os.Getenv("DISABLE_HTTP2"); len(s) == 0 {
|
||||
_ = http2.ConfigureTransport(t)
|
||||
t.ForceAttemptHTTP2 = true
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
10
vendor/github.com/containers/image/v5/storage/storage_dest.go
generated
vendored
10
vendor/github.com/containers/image/v5/storage/storage_dest.go
generated
vendored
@@ -159,7 +159,7 @@ func (s *storageImageDestination) computeNextBlobCacheFile() string {
|
||||
// to any other readers for download using the supplied digest.
|
||||
// If stream.Read() at any time, ESPECIALLY at end of input, returns an error, PutBlob MUST 1) fail, and 2) delete any data stored so far.
|
||||
func (s *storageImageDestination) PutBlobWithOptions(ctx context.Context, stream io.Reader, blobinfo types.BlobInfo, options private.PutBlobOptions) (types.BlobInfo, error) {
|
||||
info, err := s.putBlobToPendingFile(ctx, stream, blobinfo, &options)
|
||||
info, err := s.putBlobToPendingFile(stream, blobinfo, &options)
|
||||
if err != nil {
|
||||
return info, err
|
||||
}
|
||||
@@ -173,7 +173,7 @@ func (s *storageImageDestination) PutBlobWithOptions(ctx context.Context, stream
|
||||
|
||||
// putBlobToPendingFile implements ImageDestination.PutBlobWithOptions, storing stream into an on-disk file.
|
||||
// The caller must arrange the blob to be eventually committed using s.commitLayer().
|
||||
func (s *storageImageDestination) putBlobToPendingFile(ctx context.Context, stream io.Reader, blobinfo types.BlobInfo, options *private.PutBlobOptions) (types.BlobInfo, error) {
|
||||
func (s *storageImageDestination) putBlobToPendingFile(stream io.Reader, blobinfo types.BlobInfo, options *private.PutBlobOptions) (types.BlobInfo, error) {
|
||||
// Stores a layer or data blob in our temporary directory, checking that any information
|
||||
// in the blobinfo matches the incoming data.
|
||||
errorBlobInfo := types.BlobInfo{
|
||||
@@ -203,7 +203,7 @@ func (s *storageImageDestination) putBlobToPendingFile(ctx context.Context, stre
|
||||
|
||||
diffID := digest.Canonical.Digester()
|
||||
// Copy the data to the file.
|
||||
// TODO: This can take quite some time, and should ideally be cancellable using ctx.Done().
|
||||
// TODO: This can take quite some time, and should ideally be cancellable using context.Context.
|
||||
_, err = io.Copy(diffID.Hash(), decompressed)
|
||||
decompressed.Close()
|
||||
if err != nil {
|
||||
@@ -302,7 +302,7 @@ func (s *storageImageDestination) PutBlobPartial(ctx context.Context, chunkAcces
|
||||
// reflected in the manifest that will be written.
|
||||
// If the transport can not reuse the requested blob, TryReusingBlob returns (false, {}, nil); it returns a non-nil error only on an unexpected failure.
|
||||
func (s *storageImageDestination) TryReusingBlobWithOptions(ctx context.Context, blobinfo types.BlobInfo, options private.TryReusingBlobOptions) (bool, types.BlobInfo, error) {
|
||||
reused, info, err := s.tryReusingBlobAsPending(ctx, blobinfo, &options)
|
||||
reused, info, err := s.tryReusingBlobAsPending(blobinfo, &options)
|
||||
if err != nil || !reused || options.LayerIndex == nil {
|
||||
return reused, info, err
|
||||
}
|
||||
@@ -312,7 +312,7 @@ func (s *storageImageDestination) TryReusingBlobWithOptions(ctx context.Context,
|
||||
|
||||
// tryReusingBlobAsPending implements TryReusingBlobWithOptions, filling s.blobDiffIDs and other metadata.
|
||||
// The caller must arrange the blob to be eventually committed using s.commitLayer().
|
||||
func (s *storageImageDestination) tryReusingBlobAsPending(ctx context.Context, blobinfo types.BlobInfo, options *private.TryReusingBlobOptions) (bool, types.BlobInfo, error) {
|
||||
func (s *storageImageDestination) tryReusingBlobAsPending(blobinfo types.BlobInfo, options *private.TryReusingBlobOptions) (bool, types.BlobInfo, error) {
|
||||
// lock the entire method as it executes fairly quickly
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
2
vendor/github.com/containers/image/v5/storage/storage_image.go
generated
vendored
2
vendor/github.com/containers/image/v5/storage/storage_image.go
generated
vendored
@@ -43,7 +43,7 @@ func (s *storageImageCloser) Size() (int64, error) {
|
||||
|
||||
// newImage creates an image that also knows its size
|
||||
func newImage(ctx context.Context, sys *types.SystemContext, s storageReference) (types.ImageCloser, error) {
|
||||
src, err := newImageSource(ctx, sys, s)
|
||||
src, err := newImageSource(sys, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
2
vendor/github.com/containers/image/v5/storage/storage_reference.go
generated
vendored
2
vendor/github.com/containers/image/v5/storage/storage_reference.go
generated
vendored
@@ -277,7 +277,7 @@ func (s storageReference) DeleteImage(ctx context.Context, sys *types.SystemCont
|
||||
}
|
||||
|
||||
func (s storageReference) NewImageSource(ctx context.Context, sys *types.SystemContext) (types.ImageSource, error) {
|
||||
return newImageSource(ctx, sys, s)
|
||||
return newImageSource(sys, s)
|
||||
}
|
||||
|
||||
func (s storageReference) NewImageDestination(ctx context.Context, sys *types.SystemContext) (types.ImageDestination, error) {
|
||||
|
2
vendor/github.com/containers/image/v5/storage/storage_src.go
generated
vendored
2
vendor/github.com/containers/image/v5/storage/storage_src.go
generated
vendored
@@ -44,7 +44,7 @@ type storageImageSource struct {
|
||||
}
|
||||
|
||||
// newImageSource sets up an image for reading.
|
||||
func newImageSource(ctx context.Context, sys *types.SystemContext, imageRef storageReference) (*storageImageSource, error) {
|
||||
func newImageSource(sys *types.SystemContext, imageRef storageReference) (*storageImageSource, error) {
|
||||
// First, locate the image.
|
||||
img, err := imageRef.resolveImage(sys)
|
||||
if err != nil {
|
||||
|
2
vendor/github.com/containers/image/v5/version/version.go
generated
vendored
2
vendor/github.com/containers/image/v5/version/version.go
generated
vendored
@@ -8,7 +8,7 @@ const (
|
||||
// VersionMinor is for functionality in a backwards-compatible manner
|
||||
VersionMinor = 24
|
||||
// VersionPatch is for backwards-compatible bug fixes
|
||||
VersionPatch = 1
|
||||
VersionPatch = 2
|
||||
|
||||
// VersionDev indicates development branch. Releases will be empty string.
|
||||
VersionDev = "-dev"
|
||||
|
Reference in New Issue
Block a user