vendor: update buildkit to 3e38a2d

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2022-04-03 20:40:33 +02:00
parent c3db06cda0
commit a49ad031a5
87 changed files with 2964 additions and 4427 deletions

View File

@ -4,9 +4,9 @@ import (
"context"
"crypto/tls"
"crypto/x509"
"io/ioutil"
"net"
"net/url"
"os"
"strings"
"github.com/containerd/containerd/defaults"
@ -212,7 +212,7 @@ func WithCredentials(serverName, ca, cert, key string) ClientOpt {
}
func loadCredentials(opts *withCredentials) (grpc.DialOption, error) {
ca, err := ioutil.ReadFile(opts.CACert)
ca, err := os.ReadFile(opts.CACert)
if err != nil {
return nil, errors.Wrap(err, "could not read ca certificate")
}

View File

@ -2,7 +2,6 @@ package llb
import (
"io"
"io/ioutil"
"github.com/containerd/containerd/platforms"
"github.com/moby/buildkit/solver/pb"
@ -67,7 +66,7 @@ func WriteTo(def *Definition, w io.Writer) error {
}
func ReadFrom(r io.Reader) (*Definition, error) {
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
return nil, err
}

View File

@ -230,13 +230,7 @@ func (s State) WithOutput(o Output) State {
}
func (s State) WithImageConfig(c []byte) (State, error) {
var img struct {
Config struct {
Env []string `json:"Env,omitempty"`
WorkingDir string `json:"WorkingDir,omitempty"`
User string `json:"User,omitempty"`
} `json:"config,omitempty"`
}
var img ocispecs.Image
if err := json.Unmarshal(c, &img); err != nil {
return State{}, err
}
@ -251,6 +245,13 @@ func (s State) WithImageConfig(c []byte) (State, error) {
}
}
s = s.Dir(img.Config.WorkingDir)
if img.Architecture != "" && img.OS != "" {
s = s.Platform(ocispecs.Platform{
OS: img.OS,
Architecture: img.Architecture,
Variant: img.Variant,
})
}
return s, nil
}

View File

@ -2,7 +2,7 @@ package ociindex
import (
"encoding/json"
"io/ioutil"
"io"
"os"
"github.com/gofrs/flock"
@ -62,7 +62,7 @@ func PutDescToIndexJSONFileLocked(indexJSONPath string, desc ocispecs.Descriptor
}
defer f.Close()
var idx ocispecs.Index
b, err := ioutil.ReadAll(f)
b, err := io.ReadAll(f)
if err != nil {
return errors.Wrapf(err, "could not read %s", indexJSONPath)
}
@ -101,7 +101,7 @@ func ReadIndexJSONFileLocked(indexJSONPath string) (*ocispecs.Index, error) {
lock.Unlock()
os.RemoveAll(lockPath)
}()
b, err := ioutil.ReadFile(indexJSONPath)
b, err := os.ReadFile(indexJSONPath)
if err != nil {
return nil, errors.Wrapf(err, "could not read %s", indexJSONPath)
}

View File

@ -3,7 +3,6 @@ package authprovider
import (
"crypto/rand"
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"sync"
@ -47,7 +46,7 @@ func (ts *tokenSeeds) getSeed(host string) ([]byte, error) {
fp := filepath.Join(ts.dir, ".token_seed")
// we include client side randomness to avoid chosen plaintext attack from the daemon side
dt, err := ioutil.ReadFile(fp)
dt, err := os.ReadFile(fp)
if err != nil {
if !errors.Is(err, os.ErrNotExist) && !errors.Is(err, syscall.ENOTDIR) && !errors.Is(err, os.ErrPermission) {
return nil, err
@ -68,7 +67,7 @@ func (ts *tokenSeeds) getSeed(host string) ([]byte, error) {
return nil, err
}
if err := ioutil.WriteFile(fp, dt, 0600); err != nil {
if err := os.WriteFile(fp, dt, 0600); err != nil {
if !errors.Is(err, syscall.EROFS) && !errors.Is(err, os.ErrPermission) {
return nil, err
}

View File

@ -2,7 +2,6 @@ package secretsprovider
import (
"context"
"io/ioutil"
"os"
"github.com/moby/buildkit/session/secrets"
@ -57,7 +56,7 @@ func (fs *fileStore) GetSecret(ctx context.Context, id string) ([]byte, error) {
if v.Env != "" {
return []byte(os.Getenv(v.Env)), nil
}
dt, err := ioutil.ReadFile(v.FilePath)
dt, err := os.ReadFile(v.FilePath)
if err != nil {
return nil, err
}

View File

@ -1,7 +1,6 @@
package sshforward
import (
"io/ioutil"
"net"
"os"
"path/filepath"
@ -64,7 +63,7 @@ type SocketOpt struct {
}
func MountSSHSocket(ctx context.Context, c session.Caller, opt SocketOpt) (sockPath string, closer func() error, err error) {
dir, err := ioutil.TempDir("", ".buildkit-ssh-sock")
dir, err := os.MkdirTemp("", ".buildkit-ssh-sock")
if err != nil {
return "", nil, errors.WithStack(err)
}

View File

@ -3,7 +3,6 @@ package sshprovider
import (
"context"
"io"
"io/ioutil"
"net"
"os"
"runtime"
@ -166,7 +165,7 @@ func toAgentSource(paths []string) (source, error) {
if err != nil {
return source{}, errors.Wrapf(err, "failed to open %s", p)
}
dt, err := ioutil.ReadAll(&io.LimitedReader{R: f, N: 100 * 1024})
dt, err := io.ReadAll(&io.LimitedReader{R: f, N: 100 * 1024})
if err != nil {
return source{}, errors.Wrapf(err, "failed to read %s", p)
}

View File

@ -1038,7 +1038,7 @@ func (m *SecretOpt) GetOptional() bool {
return false
}
// SSHOpt defines options describing secret mounts
// SSHOpt defines options describing ssh mounts
type SSHOpt struct {
// ID of exposed ssh rule. Used for quering the value.
ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`

View File

@ -157,7 +157,7 @@ message SecretOpt {
bool optional = 5;
}
// SSHOpt defines options describing secret mounts
// SSHOpt defines options describing ssh mounts
message SSHOpt {
// ID of exposed ssh rule. Used for quering the value.
string ID = 1;

View File

@ -3,7 +3,7 @@ package contentutil
import (
"bytes"
"context"
"io/ioutil"
"io"
"sync"
"time"
@ -64,7 +64,7 @@ func (b *buffer) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (conten
if err != nil {
return nil, err
}
return &readerAt{Reader: r, Closer: ioutil.NopCloser(r), size: int64(r.Len())}, nil
return &readerAt{Reader: r, Closer: io.NopCloser(r), size: int64(r.Len())}, nil
}
func (b *buffer) getBytesReader(ctx context.Context, dgst digest.Digest) (*bytes.Reader, error) {

View File

@ -3,7 +3,7 @@ package imageutil
import (
"context"
"encoding/json"
"io/ioutil"
"io"
"strings"
"time"
@ -19,7 +19,7 @@ func readSchema1Config(ctx context.Context, ref string, desc ocispecs.Descriptor
return "", nil, err
}
defer rc.Close()
dt, err := ioutil.ReadAll(rc)
dt, err := io.ReadAll(rc)
if err != nil {
return "", nil, errors.Wrap(err, "failed to fetch schema1 manifest")
}

View File

@ -256,7 +256,7 @@ func (p *textMux) print(t *trace) {
}
// make any open vertex active
for dgst, v := range t.byDigest {
if v.isStarted() && !v.isCompleted() {
if v.isStarted() && !v.isCompleted() && v.ProgressGroup == nil && !v.hidden {
p.printVtx(t, dgst)
return
}
@ -281,6 +281,10 @@ func (p *textMux) print(t *trace) {
if !ok {
continue
}
if v.lastBlockTime == nil {
// shouldn't happen, but not worth crashing over
continue
}
tm := now.Sub(*v.lastBlockTime)
speed := float64(v.count) / tm.Seconds()
overLimit := tm > maxDelay && dgst != current

View File

@ -60,7 +60,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() {
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