Merge pull request #1647 from containers/renovate/github.com-containerd-containerd-1.x

fix(deps): update module github.com/containerd/containerd to v1.7.6
This commit is contained in:
Daniel J Walsh 2023-09-12 20:10:54 -04:00 committed by GitHub
commit 36df70d288
8 changed files with 58 additions and 11 deletions

View File

@ -5,7 +5,7 @@ go 1.18
require ( require (
github.com/BurntSushi/toml v1.3.2 github.com/BurntSushi/toml v1.3.2
github.com/container-orchestrated-devices/container-device-interface v0.6.1 github.com/container-orchestrated-devices/container-device-interface v0.6.1
github.com/containerd/containerd v1.7.5 github.com/containerd/containerd v1.7.6
github.com/containernetworking/cni v1.1.2 github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.3.0 github.com/containernetworking/plugins v1.3.0
github.com/containers/image/v5 v5.27.1-0.20230911141411-81c35e010bab github.com/containers/image/v5 v5.27.1-0.20230911141411-81c35e010bab

View File

@ -40,8 +40,8 @@ github.com/container-orchestrated-devices/container-device-interface v0.6.1 h1:m
github.com/container-orchestrated-devices/container-device-interface v0.6.1/go.mod h1:40T6oW59rFrL/ksiSs7q45GzjGlbvxnA4xaK6cyq+kA= github.com/container-orchestrated-devices/container-device-interface v0.6.1/go.mod h1:40T6oW59rFrL/ksiSs7q45GzjGlbvxnA4xaK6cyq+kA=
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/containerd v1.7.5 h1:i9T9XpAWMe11BHMN7pu1BZqOGjXaKTPyz2v+KYOZgkY= github.com/containerd/containerd v1.7.6 h1:oNAVsnhPoy4BTPQivLgTzI9Oleml9l/+eYIDYXRCYo8=
github.com/containerd/containerd v1.7.5/go.mod h1:ieJNCSzASw2shSGYLHx8NAE7WsZ/gEigo5fQ78W5Zvw= github.com/containerd/containerd v1.7.6/go.mod h1:SY6lrkkuJT40BVNO37tlYTSnKJnP5AXBc0fhx0q+TJ4=
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=
github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o= github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o=
github.com/containernetworking/cni v1.1.2 h1:wtRGZVv7olUHMOqouPpn3cXJWpJgM6+EUl31EQbXALQ= github.com/containernetworking/cni v1.1.2 h1:wtRGZVv7olUHMOqouPpn3cXJWpJgM6+EUl31EQbXALQ=

View File

@ -44,6 +44,12 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
// G is a shorthand for [GetLogger].
//
// We may want to define this locally to a package to get package tagged log
// messages.
var G = GetLogger
// L is an alias for the standard logger. // L is an alias for the standard logger.
var L = &Entry{ var L = &Entry{
Logger: logrus.StandardLogger(), Logger: logrus.StandardLogger(),
@ -169,11 +175,6 @@ func WithLogger(ctx context.Context, logger *Entry) context.Context {
// 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) *Entry { func GetLogger(ctx context.Context) *Entry {
return G(ctx)
}
// G is a shorthand for [GetLogger].
func G(ctx context.Context) *Entry {
if logger := ctx.Value(loggerKey{}); logger != nil { if logger := ctx.Value(loggerKey{}); logger != nil {
return logger.(*Entry) return logger.(*Entry)
} }

View File

@ -22,6 +22,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/Microsoft/hcsshim/osversion"
specs "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
) )
@ -50,15 +51,36 @@ func (m windowsmatcher) Match(p specs.Platform) bool {
match := m.defaultMatcher.Match(p) match := m.defaultMatcher.Match(p)
if match && m.OS == "windows" { if match && m.OS == "windows" {
if strings.HasPrefix(p.OSVersion, m.osVersionPrefix) { // HPC containers do not have OS version filled
if p.OSVersion == "" {
return true return true
} }
return p.OSVersion == ""
hostOsVersion := GetOsVersion(m.osVersionPrefix)
ctrOsVersion := GetOsVersion(p.OSVersion)
return osversion.CheckHostAndContainerCompat(hostOsVersion, ctrOsVersion)
} }
return match return match
} }
func GetOsVersion(osVersionPrefix string) osversion.OSVersion {
parts := strings.Split(osVersionPrefix, ".")
if len(parts) < 3 {
return osversion.OSVersion{}
}
majorVersion, _ := strconv.Atoi(parts[0])
minorVersion, _ := strconv.Atoi(parts[1])
buildNumber, _ := strconv.Atoi(parts[2])
return osversion.OSVersion{
MajorVersion: uint8(majorVersion),
MinorVersion: uint8(minorVersion),
Build: uint16(buildNumber),
}
}
// Less sorts matched platforms in front of other platforms. // Less sorts matched platforms in front of other platforms.
// For matched platforms, it puts platforms with larger revision // For matched platforms, it puts platforms with larger revision
// number in front. // number in front.

View File

@ -196,6 +196,10 @@ func Parse(specifier string) (specs.Platform, error) {
p.Variant = cpuVariant() p.Variant = cpuVariant()
} }
if p.OS == "windows" {
p.OSVersion = GetWindowsOsVersion()
}
return p, nil return p, nil
} }
@ -218,6 +222,10 @@ func Parse(specifier string) (specs.Platform, error) {
p.Variant = "" p.Variant = ""
} }
if p.OS == "windows" {
p.OSVersion = GetWindowsOsVersion()
}
return p, nil return p, nil
case 3: case 3:
// we have a fully specified variant, this is rare // we have a fully specified variant, this is rare
@ -227,6 +235,10 @@ func Parse(specifier string) (specs.Platform, error) {
p.Variant = "v8" p.Variant = "v8"
} }
if p.OS == "windows" {
p.OSVersion = GetWindowsOsVersion()
}
return p, nil return p, nil
} }

View File

@ -28,3 +28,7 @@ func newDefaultMatcher(platform specs.Platform) Matcher {
Platform: Normalize(platform), Platform: Normalize(platform),
} }
} }
func GetWindowsOsVersion() string {
return ""
}

View File

@ -17,7 +17,10 @@
package platforms package platforms
import ( import (
"fmt"
specs "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/sys/windows"
) )
// NewMatcher returns a Windows matcher that will match on osVersionPrefix if // NewMatcher returns a Windows matcher that will match on osVersionPrefix if
@ -32,3 +35,8 @@ func newDefaultMatcher(platform specs.Platform) Matcher {
}, },
} }
} }
func GetWindowsOsVersion() string {
major, minor, build := windows.RtlGetNtVersionNumbers()
return fmt.Sprintf("%d.%d.%d", major, minor, build)
}

View File

@ -62,7 +62,7 @@ github.com/container-orchestrated-devices/container-device-interface/pkg/parser
# github.com/containerd/cgroups v1.1.0 # github.com/containerd/cgroups v1.1.0
## explicit; go 1.17 ## explicit; go 1.17
github.com/containerd/cgroups/stats/v1 github.com/containerd/cgroups/stats/v1
# github.com/containerd/containerd v1.7.5 # github.com/containerd/containerd v1.7.6
## explicit; go 1.19 ## explicit; go 1.19
github.com/containerd/containerd/errdefs github.com/containerd/containerd/errdefs
github.com/containerd/containerd/log github.com/containerd/containerd/log