mirror of https://github.com/docker/buildx.git
vendor: update buildkit to 71f99c52a669
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
1b16594f4a
commit
13653fb84d
2
go.mod
2
go.mod
|
@ -26,7 +26,7 @@ require (
|
||||||
github.com/hashicorp/go-cty-funcs v0.0.0-20230405223818-a090f58aa992
|
github.com/hashicorp/go-cty-funcs v0.0.0-20230405223818-a090f58aa992
|
||||||
github.com/hashicorp/hcl/v2 v2.20.1
|
github.com/hashicorp/hcl/v2 v2.20.1
|
||||||
github.com/in-toto/in-toto-golang v0.5.0
|
github.com/in-toto/in-toto-golang v0.5.0
|
||||||
github.com/moby/buildkit v0.13.0-rc3.0.20240411143343-549891b34890 // v0.14.0-dev
|
github.com/moby/buildkit v0.13.0-rc3.0.20240417151852-71f99c52a669 // v0.14.0-dev
|
||||||
github.com/moby/sys/mountinfo v0.7.1
|
github.com/moby/sys/mountinfo v0.7.1
|
||||||
github.com/moby/sys/signal v0.7.0
|
github.com/moby/sys/signal v0.7.0
|
||||||
github.com/morikuni/aec v1.0.0
|
github.com/morikuni/aec v1.0.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -293,8 +293,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
|
||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||||
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||||
github.com/moby/buildkit v0.13.0-rc3.0.20240411143343-549891b34890 h1:ikD8s7J6fN9kme4Yq1nUKlpZhEnakiMEcN9XeKFZXbs=
|
github.com/moby/buildkit v0.13.0-rc3.0.20240417151852-71f99c52a669 h1:DnnuoY7BDEXoW4qbDHBvWy2lCzus6AO4CJGaEq94e7M=
|
||||||
github.com/moby/buildkit v0.13.0-rc3.0.20240411143343-549891b34890/go.mod h1:iqJg3dy9wLt5maCeC8WBbDISnLvuSX+R9jVNzg2zACU=
|
github.com/moby/buildkit v0.13.0-rc3.0.20240417151852-71f99c52a669/go.mod h1:iqJg3dy9wLt5maCeC8WBbDISnLvuSX+R9jVNzg2zACU=
|
||||||
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
|
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
|
||||||
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
|
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
|
||||||
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
|
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
|
||||||
|
|
|
@ -642,7 +642,7 @@ type fileActionState struct {
|
||||||
fa *FileAction
|
fa *FileAction
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms *marshalState) addInput(st *fileActionState, c *Constraints, o Output) (pb.InputIndex, error) {
|
func (ms *marshalState) addInput(c *Constraints, o Output) (pb.InputIndex, error) {
|
||||||
inp, err := o.ToInput(ms.ctx, c)
|
inp, err := o.ToInput(ms.ctx, c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
@ -684,7 +684,7 @@ func (ms *marshalState) add(fa *FileAction, c *Constraints) (*fileActionState, e
|
||||||
}
|
}
|
||||||
|
|
||||||
if source := fa.state.Output(); source != nil {
|
if source := fa.state.Output(); source != nil {
|
||||||
inp, err := ms.addInput(st, c, source)
|
inp, err := ms.addInput(c, source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -700,7 +700,7 @@ func (ms *marshalState) add(fa *FileAction, c *Constraints) (*fileActionState, e
|
||||||
if a, ok := fa.action.(*fileActionCopy); ok {
|
if a, ok := fa.action.(*fileActionCopy); ok {
|
||||||
if a.state != nil {
|
if a.state != nil {
|
||||||
if out := a.state.Output(); out != nil {
|
if out := a.state.Output(); out != nil {
|
||||||
inp, err := ms.addInput(st, c, out)
|
inp, err := ms.addInput(c, out)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,7 @@ func parseString(rest string, d *directives) (*Node, map[string]bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseJSON converts JSON arrays to an AST.
|
// parseJSON converts JSON arrays to an AST.
|
||||||
func parseJSON(rest string, d *directives) (*Node, map[string]bool, error) {
|
func parseJSON(rest string) (*Node, map[string]bool, error) {
|
||||||
rest = strings.TrimLeftFunc(rest, unicode.IsSpace)
|
rest = strings.TrimLeftFunc(rest, unicode.IsSpace)
|
||||||
if !strings.HasPrefix(rest, "[") {
|
if !strings.HasPrefix(rest, "[") {
|
||||||
return nil, nil, errors.Errorf("Error parsing %q as a JSON array", rest)
|
return nil, nil, errors.Errorf("Error parsing %q as a JSON array", rest)
|
||||||
|
@ -307,7 +307,7 @@ func parseMaybeJSON(rest string, d *directives) (*Node, map[string]bool, error)
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
node, attrs, err := parseJSON(rest, d)
|
node, attrs, err := parseJSON(rest)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return node, attrs, nil
|
return node, attrs, nil
|
||||||
|
@ -325,7 +325,7 @@ func parseMaybeJSON(rest string, d *directives) (*Node, map[string]bool, error)
|
||||||
// so, passes to parseJSON; if not, attempts to parse it as a whitespace
|
// so, passes to parseJSON; if not, attempts to parse it as a whitespace
|
||||||
// delimited string.
|
// delimited string.
|
||||||
func parseMaybeJSONToList(rest string, d *directives) (*Node, map[string]bool, error) {
|
func parseMaybeJSONToList(rest string, d *directives) (*Node, map[string]bool, error) {
|
||||||
node, attrs, err := parseJSON(rest, d)
|
node, attrs, err := parseJSON(rest)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return node, attrs, nil
|
return node, attrs, nil
|
||||||
|
|
|
@ -6,13 +6,14 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"sort"
|
"sort"
|
||||||
"text/tabwriter"
|
|
||||||
|
|
||||||
"github.com/moby/buildkit/client/llb"
|
"github.com/moby/buildkit/client/llb"
|
||||||
"github.com/moby/buildkit/frontend/dockerfile/parser"
|
"github.com/moby/buildkit/frontend/dockerfile/parser"
|
||||||
"github.com/moby/buildkit/frontend/gateway/client"
|
"github.com/moby/buildkit/frontend/gateway/client"
|
||||||
"github.com/moby/buildkit/frontend/subrequests"
|
"github.com/moby/buildkit/frontend/subrequests"
|
||||||
|
"github.com/moby/buildkit/solver/errdefs"
|
||||||
"github.com/moby/buildkit/solver/pb"
|
"github.com/moby/buildkit/solver/pb"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
const RequestLint = "frontend.lint"
|
const RequestLint = "frontend.lint"
|
||||||
|
@ -26,16 +27,10 @@ var SubrequestLintDefinition = subrequests.Request{
|
||||||
Metadata: []subrequests.Named{
|
Metadata: []subrequests.Named{
|
||||||
{Name: "result.json"},
|
{Name: "result.json"},
|
||||||
{Name: "result.txt"},
|
{Name: "result.txt"},
|
||||||
|
{Name: "result.statuscode"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
type Source struct {
|
|
||||||
Filename string `json:"fileName"`
|
|
||||||
Language string `json:"language"`
|
|
||||||
Definition *pb.Definition `json:"definition"`
|
|
||||||
Data []byte `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Warning struct {
|
type Warning struct {
|
||||||
RuleName string `json:"ruleName"`
|
RuleName string `json:"ruleName"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
|
@ -45,19 +40,19 @@ type Warning struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type LintResults struct {
|
type LintResults struct {
|
||||||
Warnings []Warning `json:"warnings"`
|
Warnings []Warning `json:"warnings"`
|
||||||
Sources []Source `json:"sources"`
|
Sources []*pb.SourceInfo `json:"sources"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (results *LintResults) AddSource(sourceMap *llb.SourceMap) int {
|
func (results *LintResults) AddSource(sourceMap *llb.SourceMap) int {
|
||||||
newSource := Source{
|
newSource := &pb.SourceInfo{
|
||||||
Filename: sourceMap.Filename,
|
Filename: sourceMap.Filename,
|
||||||
Language: sourceMap.Language,
|
Language: sourceMap.Language,
|
||||||
Definition: sourceMap.Definition.ToPB(),
|
Definition: sourceMap.Definition.ToPB(),
|
||||||
Data: sourceMap.Data,
|
Data: sourceMap.Data,
|
||||||
}
|
}
|
||||||
for i, source := range results.Sources {
|
for i, source := range results.Sources {
|
||||||
if sourceEqual(source, newSource) {
|
if sourceInfoEqual(source, newSource) {
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,13 +87,6 @@ func (results *LintResults) AddWarning(rulename, description, url, fmtmsg string
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func sourceEqual(a, b Source) bool {
|
|
||||||
if a.Filename != b.Filename || a.Language != b.Language {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return bytes.Equal(a.Data, b.Data)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (results *LintResults) ToResult() (*client.Result, error) {
|
func (results *LintResults) ToResult() (*client.Result, error) {
|
||||||
res := client.NewResult()
|
res := client.NewResult()
|
||||||
dt, err := json.MarshalIndent(results, "", " ")
|
dt, err := json.MarshalIndent(results, "", " ")
|
||||||
|
@ -113,51 +101,91 @@ func (results *LintResults) ToResult() (*client.Result, error) {
|
||||||
}
|
}
|
||||||
res.AddMeta("result.txt", b.Bytes())
|
res.AddMeta("result.txt", b.Bytes())
|
||||||
|
|
||||||
|
status := 0
|
||||||
|
if len(results.Warnings) > 0 {
|
||||||
|
status = 1
|
||||||
|
}
|
||||||
|
res.AddMeta("result.statuscode", []byte(fmt.Sprintf("%d", status)))
|
||||||
|
|
||||||
res.AddMeta("version", []byte(SubrequestLintDefinition.Version))
|
res.AddMeta("version", []byte(SubrequestLintDefinition.Version))
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func PrintLintViolations(dt []byte, w io.Writer) error {
|
func (results *LintResults) validateWarnings() error {
|
||||||
var warnings LintResults
|
for _, warning := range results.Warnings {
|
||||||
|
if int(warning.Location.SourceIndex) >= len(results.Sources) {
|
||||||
|
return errors.Errorf("sourceIndex is out of range")
|
||||||
|
}
|
||||||
|
if warning.Location.SourceIndex > 0 {
|
||||||
|
warningSource := results.Sources[warning.Location.SourceIndex]
|
||||||
|
if warningSource == nil {
|
||||||
|
return errors.Errorf("sourceIndex points to nil source")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(dt, &warnings); err != nil {
|
func PrintLintViolations(dt []byte, w io.Writer) error {
|
||||||
|
var results LintResults
|
||||||
|
|
||||||
|
if err := json.Unmarshal(dt, &results); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here, we're grouping the warnings by rule name
|
if err := results.validateWarnings(); err != nil {
|
||||||
lintWarnings := make(map[string][]Warning)
|
return err
|
||||||
lintWarningRules := []string{}
|
|
||||||
for _, warning := range warnings.Warnings {
|
|
||||||
if _, ok := lintWarnings[warning.RuleName]; !ok {
|
|
||||||
lintWarningRules = append(lintWarningRules, warning.RuleName)
|
|
||||||
lintWarnings[warning.RuleName] = []Warning{}
|
|
||||||
}
|
|
||||||
lintWarnings[warning.RuleName] = append(lintWarnings[warning.RuleName], warning)
|
|
||||||
}
|
|
||||||
sort.Strings(lintWarningRules)
|
|
||||||
|
|
||||||
tw := tabwriter.NewWriter(w, 0, 0, 2, ' ', 0)
|
|
||||||
for _, rule := range lintWarningRules {
|
|
||||||
fmt.Fprintf(tw, "Lint Rule %s\n", rule)
|
|
||||||
for _, warning := range lintWarnings[rule] {
|
|
||||||
source := warnings.Sources[warning.Location.SourceIndex]
|
|
||||||
sourceData := bytes.Split(source.Data, []byte("\n"))
|
|
||||||
firstRange := warning.Location.Ranges[0]
|
|
||||||
if firstRange.Start.Line != firstRange.End.Line {
|
|
||||||
fmt.Fprintf(tw, "\t%s:%d-%d\n", source.Filename, firstRange.Start.Line, firstRange.End.Line)
|
|
||||||
} else {
|
|
||||||
fmt.Fprintf(tw, "\t%s:%d\n", source.Filename, firstRange.Start.Line)
|
|
||||||
}
|
|
||||||
fmt.Fprintf(tw, "\t%s\n", warning.Detail)
|
|
||||||
for _, r := range warning.Location.Ranges {
|
|
||||||
for i := r.Start.Line; i <= r.End.Line; i++ {
|
|
||||||
fmt.Fprintf(tw, "\t%d\t|\t%s\n", i, sourceData[i-1])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Fprintln(tw)
|
|
||||||
}
|
|
||||||
fmt.Fprintln(tw)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tw.Flush()
|
sort.Slice(results.Warnings, func(i, j int) bool {
|
||||||
|
warningI := results.Warnings[i]
|
||||||
|
warningJ := results.Warnings[j]
|
||||||
|
sourceIndexI := warningI.Location.SourceIndex
|
||||||
|
sourceIndexJ := warningJ.Location.SourceIndex
|
||||||
|
if sourceIndexI < 0 && sourceIndexJ < 0 {
|
||||||
|
return warningI.RuleName < warningJ.RuleName
|
||||||
|
} else if sourceIndexI < 0 || sourceIndexJ < 0 {
|
||||||
|
return sourceIndexI < 0
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceInfoI := results.Sources[warningI.Location.SourceIndex]
|
||||||
|
sourceInfoJ := results.Sources[warningJ.Location.SourceIndex]
|
||||||
|
if sourceInfoI.Filename != sourceInfoJ.Filename {
|
||||||
|
return sourceInfoI.Filename < sourceInfoJ.Filename
|
||||||
|
}
|
||||||
|
if len(warningI.Location.Ranges) == 0 && len(warningJ.Location.Ranges) == 0 {
|
||||||
|
return warningI.RuleName < warningJ.RuleName
|
||||||
|
} else if len(warningI.Location.Ranges) == 0 || len(warningJ.Location.Ranges) == 0 {
|
||||||
|
return len(warningI.Location.Ranges) == 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return warningI.Location.Ranges[0].Start.Line < warningJ.Location.Ranges[0].Start.Line
|
||||||
|
})
|
||||||
|
|
||||||
|
for _, warning := range results.Warnings {
|
||||||
|
fmt.Fprintf(w, "\n- %s\n%s\n", warning.Detail, warning.Description)
|
||||||
|
if warning.URL != "" {
|
||||||
|
fmt.Fprintf(w, "URL: %s\n", warning.URL)
|
||||||
|
}
|
||||||
|
if warning.Location.SourceIndex < 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
sourceInfo := results.Sources[warning.Location.SourceIndex]
|
||||||
|
source := errdefs.Source{
|
||||||
|
Info: sourceInfo,
|
||||||
|
Ranges: warning.Location.Ranges,
|
||||||
|
}
|
||||||
|
err := source.Print(w)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func sourceInfoEqual(a, b *pb.SourceInfo) bool {
|
||||||
|
if a.Filename != b.Filename || a.Language != b.Language {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return bytes.Equal(a.Data, b.Data)
|
||||||
}
|
}
|
||||||
|
|
2
vendor/github.com/moby/buildkit/session/sshforward/sshprovider/agentprovider_unix.go
generated
vendored
2
vendor/github.com/moby/buildkit/session/sshforward/sshprovider/agentprovider_unix.go
generated
vendored
|
@ -11,6 +11,6 @@ func getFallbackAgentPath() (string, error) {
|
||||||
return "", errors.Errorf("make sure SSH_AUTH_SOCK is set")
|
return "", errors.Errorf("make sure SSH_AUTH_SOCK is set")
|
||||||
}
|
}
|
||||||
|
|
||||||
func getWindowsPipeDialer(path string) *socketDialer {
|
func getWindowsPipeDialer(_ string) *socketDialer {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ type Upload struct {
|
||||||
cc Upload_PullClient
|
cc Upload_PullClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Upload) WriteTo(w io.Writer) (int, error) {
|
func (u *Upload) WriteTo(w io.Writer) (int64, error) {
|
||||||
n := 0
|
var n int64
|
||||||
for {
|
for {
|
||||||
var bm BytesMessage
|
var bm BytesMessage
|
||||||
if err := u.cc.RecvMsg(&bm); err != nil {
|
if err := u.cc.RecvMsg(&bm); err != nil {
|
||||||
|
@ -48,7 +48,7 @@ func (u *Upload) WriteTo(w io.Writer) (int, error) {
|
||||||
return n, errors.WithStack(err)
|
return n, errors.WithStack(err)
|
||||||
}
|
}
|
||||||
nn, err := w.Write(bm.Data)
|
nn, err := w.Write(bm.Data)
|
||||||
n += nn
|
n += int64(nn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return n, errors.WithStack(err)
|
return n, errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,14 +113,14 @@ func (b *buffer) Writer(ctx context.Context, opts ...content.WriterOpt) (content
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *buffer) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) {
|
func (b *buffer) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) {
|
||||||
r, err := b.getBytesReader(ctx, desc.Digest)
|
r, err := b.getBytesReader(desc.Digest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &readerAt{Reader: r, Closer: io.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) {
|
func (b *buffer) getBytesReader(dgst digest.Digest) (*bytes.Reader, error) {
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
defer b.mu.Unlock()
|
defer b.mu.Unlock()
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ func ParseGitRef(ref string) (*GitRef, error) {
|
||||||
} else {
|
} else {
|
||||||
remote, err = ParseURL(ref)
|
remote, err = ParseURL(ref)
|
||||||
if errors.Is(err, ErrUnknownProtocol) {
|
if errors.Is(err, ErrUnknownProtocol) {
|
||||||
remote, err = ParseURL("https://" + ref)
|
return nil, err
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -115,7 +115,7 @@ func Config(ctx context.Context, str string, resolver remotes.Resolver, cache Co
|
||||||
}
|
}
|
||||||
|
|
||||||
if desc.MediaType == images.MediaTypeDockerSchema1Manifest {
|
if desc.MediaType == images.MediaTypeDockerSchema1Manifest {
|
||||||
dgst, dt, err := readSchema1Config(ctx, ref.String(), desc, fetcher, cache)
|
dgst, dt, err := readSchema1Config(ctx, desc, fetcher)
|
||||||
return dgst, dt, err
|
return dgst, dt, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func readSchema1Config(ctx context.Context, ref string, desc ocispecs.Descriptor, fetcher remotes.Fetcher, cache ContentCache) (digest.Digest, []byte, error) {
|
func readSchema1Config(ctx context.Context, desc ocispecs.Descriptor, fetcher remotes.Fetcher) (digest.Digest, []byte, error) {
|
||||||
rc, err := fetcher.Fetch(ctx, desc)
|
rc, err := fetcher.Fetch(ctx, desc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
|
|
|
@ -155,7 +155,7 @@ func NewDisplay(out io.Writer, mode DisplayMode, opts ...DisplayOpt) (Display, e
|
||||||
case PlainMode:
|
case PlainMode:
|
||||||
return newPlainDisplay(out, opts...), nil
|
return newPlainDisplay(out, opts...), nil
|
||||||
case RawJSONMode:
|
case RawJSONMode:
|
||||||
return newRawJSONDisplay(out, opts...), nil
|
return newRawJSONDisplay(out), nil
|
||||||
case QuietMode:
|
case QuietMode:
|
||||||
return newDiscardDisplay(), nil
|
return newDiscardDisplay(), nil
|
||||||
default:
|
default:
|
||||||
|
@ -283,7 +283,7 @@ type rawJSONDisplay struct {
|
||||||
|
|
||||||
// newRawJSONDisplay creates a new Display that outputs an unbuffered
|
// newRawJSONDisplay creates a new Display that outputs an unbuffered
|
||||||
// output of status update events.
|
// output of status update events.
|
||||||
func newRawJSONDisplay(w io.Writer, opts ...DisplayOpt) Display {
|
func newRawJSONDisplay(w io.Writer) Display {
|
||||||
enc := json.NewEncoder(w)
|
enc := json.NewEncoder(w)
|
||||||
enc.SetIndent("", " ")
|
enc.SetIndent("", " ")
|
||||||
return Display{
|
return Display{
|
||||||
|
|
|
@ -231,7 +231,7 @@ disabled_plugins = ["cri"]
|
||||||
"nsenter", "-U", "--preserve-credentials", "-m", "-t", fmt.Sprintf("%d", pid)},
|
"nsenter", "-U", "--preserve-credentials", "-m", "-t", fmt.Sprintf("%d", pid)},
|
||||||
append(buildkitdArgs, "--containerd-worker-snapshotter=native")...)
|
append(buildkitdArgs, "--containerd-worker-snapshotter=native")...)
|
||||||
}
|
}
|
||||||
buildkitdSock, stop, err := runBuildkitd(ctx, cfg, buildkitdArgs, cfg.Logs, c.UID, c.GID, c.ExtraEnv)
|
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, c.UID, c.GID, c.ExtraEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
integration.PrintLogs(cfg.Logs, log.Println)
|
integration.PrintLogs(cfg.Logs, log.Println)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|
|
@ -77,7 +77,7 @@ func (s *OCI) New(ctx context.Context, cfg *integration.BackendConfig) (integrat
|
||||||
if runtime.GOOS != "windows" && s.Snapshotter != "native" {
|
if runtime.GOOS != "windows" && s.Snapshotter != "native" {
|
||||||
extraEnv = append(extraEnv, "BUILDKIT_DEBUG_FORCE_OVERLAY_DIFF=true")
|
extraEnv = append(extraEnv, "BUILDKIT_DEBUG_FORCE_OVERLAY_DIFF=true")
|
||||||
}
|
}
|
||||||
buildkitdSock, stop, err := runBuildkitd(ctx, cfg, buildkitdArgs, cfg.Logs, s.UID, s.GID, extraEnv)
|
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, s.UID, s.GID, extraEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
integration.PrintLogs(cfg.Logs, log.Println)
|
integration.PrintLogs(cfg.Logs, log.Println)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|
|
@ -2,7 +2,6 @@ package workers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -27,7 +26,6 @@ func (osp otelSocketPath) UpdateConfigFile(in string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func runBuildkitd(
|
func runBuildkitd(
|
||||||
ctx context.Context,
|
|
||||||
conf *integration.BackendConfig,
|
conf *integration.BackendConfig,
|
||||||
args []string,
|
args []string,
|
||||||
logs map[string]*bytes.Buffer,
|
logs map[string]*bytes.Buffer,
|
||||||
|
|
|
@ -35,11 +35,11 @@ func getContainerdDebugSock(tmpdir string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// no-op for parity with unix
|
// no-op for parity with unix
|
||||||
func mountInfo(tmpdir string) error {
|
func mountInfo(_ string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func chown(name string, uid, gid int) error {
|
func chown(_ string, _, _ int) error {
|
||||||
// Chown not supported on Windows
|
// Chown not supported on Windows
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ func (c *Connection) StartConnection(ctx context.Context) error {
|
||||||
c.disconnectedCh = make(chan bool, 1)
|
c.disconnectedCh = make(chan bool, 1)
|
||||||
c.backgroundConnectionDoneCh = make(chan struct{})
|
c.backgroundConnectionDoneCh = make(chan struct{})
|
||||||
|
|
||||||
if err := c.connect(ctx); err == nil {
|
if err := c.connect(); err == nil {
|
||||||
c.setStateConnected()
|
c.setStateConnected()
|
||||||
} else {
|
} else {
|
||||||
c.SetStateDisconnected(err)
|
c.SetStateDisconnected(err)
|
||||||
|
@ -148,7 +148,7 @@ func (c *Connection) indefiniteBackgroundConnection() {
|
||||||
// Normal scenario that we'll wait for
|
// Normal scenario that we'll wait for
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.connect(context.Background()); err == nil {
|
if err := c.connect(); err == nil {
|
||||||
c.setStateConnected()
|
c.setStateConnected()
|
||||||
} else {
|
} else {
|
||||||
// this code is unreachable in most cases
|
// this code is unreachable in most cases
|
||||||
|
@ -168,7 +168,7 @@ func (c *Connection) indefiniteBackgroundConnection() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Connection) connect(ctx context.Context) error {
|
func (c *Connection) connect() error {
|
||||||
c.newConnectionHandler(c.cc)
|
c.newConnectionHandler(c.cc)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,7 +510,7 @@ github.com/mitchellh/mapstructure
|
||||||
# github.com/mitchellh/reflectwalk v1.0.2
|
# github.com/mitchellh/reflectwalk v1.0.2
|
||||||
## explicit
|
## explicit
|
||||||
github.com/mitchellh/reflectwalk
|
github.com/mitchellh/reflectwalk
|
||||||
# github.com/moby/buildkit v0.13.0-rc3.0.20240411143343-549891b34890
|
# github.com/moby/buildkit v0.13.0-rc3.0.20240417151852-71f99c52a669
|
||||||
## explicit; go 1.21
|
## explicit; go 1.21
|
||||||
github.com/moby/buildkit/api/services/control
|
github.com/moby/buildkit/api/services/control
|
||||||
github.com/moby/buildkit/api/types
|
github.com/moby/buildkit/api/types
|
||||||
|
|
Loading…
Reference in New Issue