chore(deps): bump github.com/containerd/containerd from 1.7.3 to 1.7.5 (#2723)

Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.7.3 to 1.7.5.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.7.3...v1.7.5)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-09-05 16:25:15 -07:00 committed by GitHub
parent 621802f98b
commit 665d0be1f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 138 additions and 137 deletions

4
go.mod
View File

@ -39,7 +39,7 @@ require (
golang.org/x/sync v0.3.0 golang.org/x/sync v0.3.0
) )
require github.com/containerd/containerd v1.7.3 require github.com/containerd/containerd v1.7.5
require ( require (
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
@ -84,7 +84,7 @@ require (
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cilium/ebpf v0.9.1 // indirect github.com/cilium/ebpf v0.9.1 // indirect
github.com/containerd/continuity v0.4.1 // indirect github.com/containerd/continuity v0.4.2 // indirect
github.com/containerd/fifo v1.1.0 // indirect github.com/containerd/fifo v1.1.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/containerd/typeurl v1.0.2 // indirect github.com/containerd/typeurl v1.0.2 // indirect

8
go.sum
View File

@ -206,10 +206,10 @@ github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u9
github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM=
github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw=
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
github.com/containerd/containerd v1.7.3 h1:cKwYKkP1eTj54bP3wCdXXBymmKRQMrWjkLSWZZJDa8o= github.com/containerd/containerd v1.7.5 h1:i9T9XpAWMe11BHMN7pu1BZqOGjXaKTPyz2v+KYOZgkY=
github.com/containerd/containerd v1.7.3/go.mod h1:32FOM4/O0RkNg7AjQj3hDzN9cUGtu+HMvaKUNiqCZB8= github.com/containerd/containerd v1.7.5/go.mod h1:ieJNCSzASw2shSGYLHx8NAE7WsZ/gEigo5fQ78W5Zvw=
github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM=
github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY= github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY=
github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o= github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o=
github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k= github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k=

View File

@ -166,6 +166,15 @@ func NewAttach(opts ...Opt) Attach {
if fifos == nil { if fifos == nil {
return nil, fmt.Errorf("cannot attach, missing fifos") return nil, fmt.Errorf("cannot attach, missing fifos")
} }
if streams.Stdin == nil {
fifos.Stdin = ""
}
if streams.Stdout == nil {
fifos.Stdout = ""
}
if streams.Stderr == nil {
fifos.Stderr = ""
}
return copyIO(fifos, streams) return copyIO(fifos, streams)
} }
} }

View File

@ -14,6 +14,27 @@
limitations under the License. limitations under the License.
*/ */
// Package log provides types and functions related to logging, passing
// loggers through a context, and attaching context to the logger.
//
// # Transitional types
//
// This package contains various types that are aliases for types in [logrus].
// These aliases are intended for transitioning away from hard-coding logrus
// as logging implementation. Consumers of this package are encouraged to use
// the type-aliases from this package instead of directly using their logrus
// equivalent.
//
// The intent is to replace these aliases with locally defined types and
// interfaces once all consumers are no longer directly importing logrus
// types.
//
// IMPORTANT: due to the transitional purpose of this package, it is not
// guaranteed for the full logrus API to be provided in the future. As
// outlined, these aliases are provided as a step to transition away from
// a specific implementation which, as a result, exposes the full logrus API.
// While no decisions have been made on the ultimate design and interface
// provided by this package, we do not expect carrying "less common" features.
package log package log
import ( import (
@ -23,98 +44,138 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var ( // L is an alias for the standard logger.
// G is an alias for GetLogger. var L = &Entry{
// Logger: logrus.StandardLogger(),
// We may want to define this locally to a package to get package tagged log // Default is three fields plus a little extra room.
// messages. Data: make(Fields, 6),
G = GetLogger }
// L is an alias for the standard logger. type loggerKey struct{}
L = logrus.NewEntry(logrus.StandardLogger())
)
type ( // Fields type to pass to "WithFields".
loggerKey struct{} type Fields = map[string]any
// Fields type to pass to `WithFields`, alias from `logrus`. // Entry is a logging entry. It contains all the fields passed with
Fields = logrus.Fields // [Entry.WithFields]. It's finally logged when Trace, Debug, Info, Warn,
// Error, Fatal or Panic is called on it. These objects can be reused and
// passed around as much as you wish to avoid field duplication.
//
// Entry is a transitional type, and currently an alias for [logrus.Entry].
type Entry = logrus.Entry
// Level is a logging level // RFC3339NanoFixed is [time.RFC3339Nano] with nanoseconds padded using
Level = logrus.Level // zeros to ensure the formatted time is always the same number of
) // characters.
const RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
// Level is a logging level.
type Level = logrus.Level
// Supported log levels.
const ( const (
// RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to // TraceLevel level. Designates finer-grained informational events
// ensure the formatted time is always the same number of characters. // than [DebugLevel].
RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00" TraceLevel Level = logrus.TraceLevel
// TextFormat represents the text logging format // DebugLevel level. Usually only enabled when debugging. Very verbose
TextFormat = "text" // logging.
DebugLevel Level = logrus.DebugLevel
// JSONFormat represents the JSON logging format // InfoLevel level. General operational entries about what's going on
JSONFormat = "json" // inside the application.
InfoLevel Level = logrus.InfoLevel
// TraceLevel level. // WarnLevel level. Non-critical entries that deserve eyes.
TraceLevel = logrus.TraceLevel WarnLevel Level = logrus.WarnLevel
// DebugLevel level. // ErrorLevel level. Logs errors that should definitely be noted.
DebugLevel = logrus.DebugLevel // Commonly used for hooks to send errors to an error tracking service.
ErrorLevel Level = logrus.ErrorLevel
// InfoLevel level. // FatalLevel level. Logs and then calls "logger.Exit(1)". It exits
InfoLevel = logrus.InfoLevel // even if the logging level is set to Panic.
FatalLevel Level = logrus.FatalLevel
// PanicLevel level. This is the highest level of severity. Logs and
// then calls panic with the message passed to Debug, Info, ...
PanicLevel Level = logrus.PanicLevel
) )
// SetLevel sets log level globally. // SetLevel sets log level globally. It returns an error if the given
// level is not supported.
//
// level can be one of:
//
// - "trace" ([TraceLevel])
// - "debug" ([DebugLevel])
// - "info" ([InfoLevel])
// - "warn" ([WarnLevel])
// - "error" ([ErrorLevel])
// - "fatal" ([FatalLevel])
// - "panic" ([PanicLevel])
func SetLevel(level string) error { func SetLevel(level string) error {
lvl, err := logrus.ParseLevel(level) lvl, err := logrus.ParseLevel(level)
if err != nil { if err != nil {
return err return err
} }
logrus.SetLevel(lvl) L.Logger.SetLevel(lvl)
return nil return nil
} }
// GetLevel returns the current log level. // GetLevel returns the current log level.
func GetLevel() Level { func GetLevel() Level {
return logrus.GetLevel() return L.Logger.GetLevel()
} }
// SetFormat sets log output format // OutputFormat specifies a log output format.
func SetFormat(format string) error { type OutputFormat string
// Supported log output formats.
const (
// TextFormat represents the text logging format.
TextFormat OutputFormat = "text"
// JSONFormat represents the JSON logging format.
JSONFormat OutputFormat = "json"
)
// SetFormat sets the log output format ([TextFormat] or [JSONFormat]).
func SetFormat(format OutputFormat) error {
switch format { switch format {
case TextFormat: case TextFormat:
logrus.SetFormatter(&logrus.TextFormatter{ L.Logger.SetFormatter(&logrus.TextFormatter{
TimestampFormat: RFC3339NanoFixed, TimestampFormat: RFC3339NanoFixed,
FullTimestamp: true, FullTimestamp: true,
}) })
return nil
case JSONFormat: case JSONFormat:
logrus.SetFormatter(&logrus.JSONFormatter{ L.Logger.SetFormatter(&logrus.JSONFormatter{
TimestampFormat: RFC3339NanoFixed, TimestampFormat: RFC3339NanoFixed,
}) })
return nil
default: default:
return fmt.Errorf("unknown log format: %s", format) return fmt.Errorf("unknown log format: %s", format)
} }
return nil
} }
// WithLogger returns a new context with the provided logger. Use in // WithLogger returns a new context with the provided logger. Use in
// combination with logger.WithField(s) for great effect. // combination with logger.WithField(s) for great effect.
func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context { func WithLogger(ctx context.Context, logger *Entry) context.Context {
e := logger.WithContext(ctx) return context.WithValue(ctx, loggerKey{}, logger.WithContext(ctx))
return context.WithValue(ctx, loggerKey{}, e)
} }
// GetLogger retrieves the current logger from the context. If no logger is // GetLogger retrieves the current logger from the context. If no logger is
// available, the default logger is returned. // available, the default logger is returned.
func GetLogger(ctx context.Context) *logrus.Entry { func GetLogger(ctx context.Context) *Entry {
logger := ctx.Value(loggerKey{}) return G(ctx)
}
if logger == nil {
return L.WithContext(ctx) // G is a shorthand for [GetLogger].
} func G(ctx context.Context) *Entry {
if logger := ctx.Value(loggerKey{}); logger != nil {
return logger.(*logrus.Entry) return logger.(*Entry)
}
return L.WithContext(ctx)
} }

View File

@ -1,5 +1,5 @@
//go:build freebsd //go:build freebsd || dragonfly
// +build freebsd // +build freebsd dragonfly
/* /*
Copyright The containerd Authors. Copyright The containerd Authors.

View File

@ -1,5 +1,5 @@
//go:build darwin || freebsd || netbsd || openbsd || solaris //go:build darwin || freebsd || netbsd || openbsd || dragonfly || solaris
// +build darwin freebsd netbsd openbsd solaris // +build darwin freebsd netbsd openbsd dragonfly solaris
/* /*
Copyright The containerd Authors. Copyright The containerd Authors.

View File

@ -18,20 +18,13 @@ package fs
import ( import (
"fmt" "fmt"
"io"
"os" "os"
"path/filepath" "path/filepath"
"sync"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var bufferPool = &sync.Pool{
New: func() interface{} {
buffer := make([]byte, 32*1024)
return &buffer
},
}
// XAttrErrorHandler transform a non-nil xattr error. // XAttrErrorHandler transform a non-nil xattr error.
// Return nil to ignore an error. // Return nil to ignore an error.
// xattrKey can be empty for listxattr operation. // xattrKey can be empty for listxattr operation.
@ -199,5 +192,6 @@ func openAndCopyFile(target, source string) error {
} }
defer tgt.Close() defer tgt.Close()
return copyFileContent(tgt, src) _, err = io.Copy(tgt, src)
return err
} }

View File

@ -18,7 +18,6 @@ package fs
import ( import (
"fmt" "fmt"
"io"
"os" "os"
"syscall" "syscall"
@ -62,51 +61,6 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
return nil return nil
} }
const maxSSizeT = int64(^uint(0) >> 1)
func copyFileContent(dst, src *os.File) error {
st, err := src.Stat()
if err != nil {
return fmt.Errorf("unable to stat source: %w", err)
}
size := st.Size()
first := true
srcFd := int(src.Fd())
dstFd := int(dst.Fd())
for size > 0 {
// Ensure that we are never trying to copy more than SSIZE_MAX at a
// time and at the same time avoids overflows when the file is larger
// than 4GB on 32-bit systems.
var copySize int
if size > maxSSizeT {
copySize = int(maxSSizeT)
} else {
copySize = int(size)
}
n, err := unix.CopyFileRange(srcFd, nil, dstFd, nil, copySize, 0)
if err != nil {
if (err != unix.ENOSYS && err != unix.EXDEV) || !first {
return fmt.Errorf("copy file range failed: %w", err)
}
buf := bufferPool.Get().(*[]byte)
_, err = io.CopyBuffer(dst, src, *buf)
bufferPool.Put(buf)
if err != nil {
return fmt.Errorf("userspace copy failed: %w", err)
}
return nil
}
first = false
size -= int64(n)
}
return nil
}
func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error { func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
xattrKeys, err := sysx.LListxattr(src) xattrKeys, err := sysx.LListxattr(src)
if err != nil { if err != nil {

View File

@ -1,5 +1,5 @@
//go:build darwin || freebsd || openbsd || netbsd || solaris //go:build darwin || freebsd || openbsd || netbsd || dragonfly || solaris
// +build darwin freebsd openbsd netbsd solaris // +build darwin freebsd openbsd netbsd dragonfly solaris
/* /*
Copyright The containerd Authors. Copyright The containerd Authors.
@ -21,7 +21,6 @@ package fs
import ( import (
"fmt" "fmt"
"io"
"os" "os"
"runtime" "runtime"
"syscall" "syscall"
@ -61,14 +60,6 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
return nil return nil
} }
func copyFileContent(dst, src *os.File) error {
buf := bufferPool.Get().(*[]byte)
_, err := io.CopyBuffer(dst, src, *buf)
bufferPool.Put(buf)
return err
}
func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error { func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
xattrKeys, err := sysx.LListxattr(src) xattrKeys, err := sysx.LListxattr(src)
if err != nil { if err != nil {

View File

@ -19,7 +19,6 @@ package fs
import ( import (
"errors" "errors"
"fmt" "fmt"
"io"
"os" "os"
winio "github.com/Microsoft/go-winio" winio "github.com/Microsoft/go-winio"
@ -72,13 +71,6 @@ func copyFileInfo(fi os.FileInfo, src, name string) error {
return nil return nil
} }
func copyFileContent(dst, src *os.File) error {
buf := bufferPool.Get().(*[]byte)
_, err := io.CopyBuffer(dst, src, *buf)
bufferPool.Put(buf)
return err
}
func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error { func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error {
return nil return nil
} }

View File

@ -1,5 +1,5 @@
//go:build linux || openbsd || solaris //go:build linux || openbsd || dragonfly || solaris
// +build linux openbsd solaris // +build linux openbsd dragonfly solaris
/* /*
Copyright The containerd Authors. Copyright The containerd Authors.

4
vendor/modules.txt vendored
View File

@ -286,7 +286,7 @@ github.com/containerd/cgroups
github.com/containerd/cgroups/stats/v1 github.com/containerd/cgroups/stats/v1
github.com/containerd/cgroups/v2 github.com/containerd/cgroups/v2
github.com/containerd/cgroups/v2/stats github.com/containerd/cgroups/v2/stats
# github.com/containerd/containerd v1.7.3 # github.com/containerd/containerd v1.7.5
## explicit; go 1.19 ## explicit; go 1.19
github.com/containerd/containerd/cio github.com/containerd/containerd/cio
github.com/containerd/containerd/defaults github.com/containerd/containerd/defaults
@ -296,7 +296,7 @@ github.com/containerd/containerd/pkg/cap
github.com/containerd/containerd/pkg/seccomp github.com/containerd/containerd/pkg/seccomp
github.com/containerd/containerd/pkg/userns github.com/containerd/containerd/pkg/userns
github.com/containerd/containerd/platforms github.com/containerd/containerd/platforms
# github.com/containerd/continuity v0.4.1 # github.com/containerd/continuity v0.4.2
## explicit; go 1.19 ## explicit; go 1.19
github.com/containerd/continuity/devices github.com/containerd/continuity/devices
github.com/containerd/continuity/driver github.com/containerd/continuity/driver