vendor: update buildkit to v0.16.0-rc1

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-09-04 16:58:37 +02:00
parent e58a1d35d1
commit 7bea00f3dd
52 changed files with 1100 additions and 334 deletions

View File

@ -38,7 +38,7 @@ func Context() context.Context {
err := errors.Errorf("got %d SIGTERM/SIGINTs, forcing shutdown", retries)
cancel(err)
if retries >= exitLimit {
bklog.G(ctx).Errorf(err.Error())
bklog.G(ctx).Error(err.Error())
os.Exit(1)
}
}

View File

@ -0,0 +1,6 @@
package appdefaults
const (
Address = "unix:///run/buildkit/buildkitd.sock"
traceSocketPath = "/run/buildkit/otel-grpc.sock"
)

View File

@ -10,7 +10,6 @@ import (
)
const (
Address = "unix:///run/buildkit/buildkitd.sock"
Root = "/var/lib/buildkit"
ConfigDir = "/etc/buildkit"
DefaultCNIBinDir = "/opt/cni/bin"
@ -82,5 +81,5 @@ func TraceSocketPath(inUserNS bool) string {
return filepath.Join(dirs[0], "buildkit", "otel-grpc.sock")
}
}
return "/run/buildkit/otel-grpc.sock"
return traceSocketPath
}

View File

@ -0,0 +1,8 @@
//go:build unix && !linux
package appdefaults
const (
Address = "unix:///var/run/buildkit/buildkitd.sock"
traceSocketPath = "/var/run/buildkit/otel-grpc.sock"
)

View File

@ -96,6 +96,9 @@ func withDetails(ctx context.Context, s *status.Status, details ...proto.Message
func Code(err error) codes.Code {
if errdefs.IsInternal(err) {
if errdefs.IsResourceExhausted(err) {
return codes.ResourceExhausted
}
return codes.Internal
}

View File

@ -64,7 +64,7 @@ func retryError(err error) bool {
return true
}
// catches TLS timeout or other network-related temporary errors
if ne := net.Error(nil); errors.As(err, &ne) && ne.Temporary() { //nolint:staticcheck // ignoring "SA1019: Temporary is deprecated", continue to propagate net.Error through the "temporary" status
if ne := net.Error(nil); errors.As(err, &ne) && ne.Temporary() { // ignoring "SA1019: Temporary is deprecated", continue to propagate net.Error through the "temporary" status
return true
}

67
vendor/github.com/moby/buildkit/util/stack/compress.go generated vendored Normal file
View File

@ -0,0 +1,67 @@
package stack
import (
"slices"
)
func compressStacks(st []*Stack) []*Stack {
if len(st) == 0 {
return nil
}
slices.SortFunc(st, func(a, b *Stack) int {
return len(b.Frames) - len(a.Frames)
})
out := []*Stack{st[0]}
loop0:
for _, st := range st[1:] {
maxIdx := -1
for _, prev := range out {
idx := subFrames(st.Frames, prev.Frames)
if idx == -1 {
continue
}
// full match, potentially skip all
if idx == len(st.Frames)-1 {
if st.Pid == prev.Pid && st.Version == prev.Version && slices.Compare(st.Cmdline, st.Cmdline) == 0 {
continue loop0
}
}
if idx > maxIdx {
maxIdx = idx
}
}
if maxIdx > 0 {
st.Frames = st.Frames[:len(st.Frames)-maxIdx]
}
out = append(out, st)
}
return out
}
func subFrames(a, b []*Frame) int {
idx := -1
i := len(a) - 1
j := len(b) - 1
for i >= 0 {
if j < 0 {
break
}
if a[i].Equal(b[j]) {
idx++
i--
j--
} else {
break
}
}
return idx
}
func (a *Frame) Equal(b *Frame) bool {
return a.File == b.File && a.Line == b.Line && a.Name == b.Name
}

View File

@ -44,6 +44,10 @@ func Helper() {
}
func Traces(err error) []*Stack {
return compressStacks(traces(err))
}
func traces(err error) []*Stack {
var st []*Stack
switch e := err.(type) {

View File

@ -220,7 +220,7 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
func getFunctionName(i interface{}) string {
fullname := runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
dot := strings.LastIndex(fullname, ".") + 1
return strings.Title(fullname[dot:]) //nolint:staticcheck // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support
return strings.Title(fullname[dot:]) // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support
}
var localImageCache map[string]map[string]struct{}

View File

@ -59,6 +59,8 @@ func (sb *sandbox) NewRegistry() (string, error) {
func (sb *sandbox) Cmd(args ...string) *exec.Cmd {
if len(args) == 1 {
// \\ being stripped off for Windows paths, convert to unix style
args[0] = strings.ReplaceAll(args[0], "\\", "/")
if split, err := shlex.Split(args[0]); err == nil {
args = split
}
@ -151,7 +153,7 @@ func FormatLogs(m map[string]*bytes.Buffer) string {
func CheckFeatureCompat(t *testing.T, sb Sandbox, features map[string]struct{}, reason ...string) {
t.Helper()
if err := HasFeatureCompat(t, sb, features, reason...); err != nil {
t.Skipf(err.Error())
t.Skip(err.Error())
}
}

View File

@ -16,6 +16,10 @@ var windowsImagesMirrorMap = map[string]string{
"nanoserver:latest": "mcr.microsoft.com/windows/nanoserver:ltsc2022",
"servercore:latest": "mcr.microsoft.com/windows/servercore:ltsc2022",
"busybox:latest": "registry.k8s.io/e2e-test-images/busybox@sha256:6d854ffad9666d2041b879a1c128c9922d77faced7745ad676639b07111ab650",
// nanoserver with extra binaries, like fc.exe
// TODO(profnandaa): get an approved/compliant repo, placeholder for now
// see dockerfile here - https://github.com/microsoft/windows-container-tools/pull/178
"nanoserver:plus": "docker.io/wintools/nanoserver:ltsc2022",
}
// abstracted function to handle pipe dialing on windows.