vendor: update buildkit to 664c2b469f19

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-07-31 16:47:50 +02:00
parent 38a8261f05
commit 4b27fb3022
82 changed files with 2517 additions and 1981 deletions

View File

@ -10,6 +10,7 @@ import (
gogotypes "github.com/gogo/protobuf/types"
"github.com/golang/protobuf/proto" //nolint:staticcheck
"github.com/golang/protobuf/ptypes/any"
"github.com/moby/buildkit/errdefs"
"github.com/moby/buildkit/util/bklog"
"github.com/moby/buildkit/util/stack"
spb "google.golang.org/genproto/googleapis/rpc/status"
@ -94,6 +95,10 @@ func withDetails(ctx context.Context, s *status.Status, details ...proto.Message
}
func Code(err error) codes.Code {
if errdefs.IsInternal(err) {
return codes.Internal
}
if se, ok := err.(interface {
Code() codes.Code
}); ok {

View File

@ -64,11 +64,7 @@ func retryError(err error) bool {
return true
}
// catches TLS timeout or other network-related temporary errors
if ne, ok := errors.Cause(err).(net.Error); ok && ne.Temporary() { //nolint:staticcheck // ignoring "SA1019: Temporary is deprecated", continue to propagate net.Error through the "temporary" status
return true
}
// https://github.com/containerd/containerd/pull/4724
if errors.Cause(err).Error() == "no response" {
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
return true
}

View File

@ -1,3 +1,6 @@
//go:build !windows
// +build !windows
package integration
var pins = map[string]map[string]string{

View File

@ -189,7 +189,9 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
t.Skip("rootless")
}
ctx := appcontext.Context()
if !strings.HasSuffix(fn, "NoParallel") {
// TODO(profnandaa): to revisit this to allow tests run
// in parallel on Windows in a stable way. Is flaky currently.
if !strings.HasSuffix(fn, "NoParallel") && runtime.GOOS != "windows" {
t.Parallel()
}
require.NoError(t, sandboxLimiter.Acquire(context.TODO(), 1))
@ -273,23 +275,7 @@ func copyImagesLocal(t *testing.T, host string, images map[string]string) error
}
func OfficialImages(names ...string) map[string]string {
ns := runtime.GOARCH
if ns == "arm64" {
ns = "arm64v8"
} else if ns != "amd64" {
ns = "library"
}
m := map[string]string{}
for _, name := range names {
ref := "docker.io/" + ns + "/" + name
if pns, ok := pins[name]; ok {
if dgst, ok := pns[ns]; ok {
ref += "@" + dgst
}
}
m["library/"+name] = ref
}
return m
return officialImages(names...)
}
func withMirrorConfig(mirror string) ConfigUpdater {
@ -439,9 +425,19 @@ func prepareValueMatrix(tc testConf) []matrixValue {
return m
}
// Skips tests on Windows
// Skips tests on platform
func SkipOnPlatform(t *testing.T, goos string) {
if runtime.GOOS == goos {
t.Skipf("Skipped on %s", goos)
}
}
// Selects between two types, returns second
// argument if on Windows or else first argument.
// Typically used for selecting test cases.
func UnixOrWindows[T any](unix, windows T) T {
if runtime.GOOS == "windows" {
return windows
}
return unix
}

View File

@ -0,0 +1,26 @@
//go:build !windows
// +build !windows
package integration
import "runtime"
func officialImages(names ...string) map[string]string {
ns := runtime.GOARCH
if ns == "arm64" {
ns = "arm64v8"
} else if ns != "amd64" {
ns = "library"
}
m := map[string]string{}
for _, name := range names {
ref := "docker.io/" + ns + "/" + name
if pns, ok := pins[name]; ok {
if dgst, ok := pns[ns]; ok {
ref += "@" + dgst
}
}
m["library/"+name] = ref
}
return m
}

View File

@ -0,0 +1,13 @@
package integration
func officialImages(names ...string) map[string]string {
m := map[string]string{}
for _, name := range names {
// select available refs from the mirror map
// so that we mirror only those needed for the tests
if ref, ok := windowsImagesMirrorMap[name]; ok {
m["library/"+name] = ref
}
}
return m
}

View File

@ -94,8 +94,12 @@ func StartCmd(cmd *exec.Cmd, logs map[string]*bytes.Buffer) (func() error, error
case <-ctx.Done():
case <-stopped:
case <-stop:
// windows processes not responding to SIGTERM
signal := UnixOrWindows(syscall.SIGTERM, syscall.SIGKILL)
signalStr := UnixOrWindows("SIGTERM", "SIGKILL")
fmt.Fprintf(cmd.Stderr, "> sending sigterm %v\n", time.Now())
cmd.Process.Signal(syscall.SIGTERM)
fmt.Fprintf(cmd.Stderr, "> sending %s %v\n", signalStr, time.Now())
cmd.Process.Signal(signal)
go func() {
select {
case <-stopped:

View File

@ -11,6 +11,13 @@ import (
var socketScheme = "npipe://"
var windowsImagesMirrorMap = map[string]string{
// TODO(profnandaa): currently, amd64 only, to revisit for other archs.
"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",
}
// abstracted function to handle pipe dialing on windows.
// some simplification has been made to discard timeout param.
func dialPipe(address string) (net.Conn, error) {