1
0
mirror of https://github.com/moby/buildkit.git synced 2025-07-30 15:03:06 +03:00

lint: unusedparams fixes

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2024-04-06 18:25:41 -07:00
parent 72e2b26280
commit 1f9988911f
46 changed files with 89 additions and 191 deletions

2
cache/manager.go vendored
View File

@ -374,7 +374,7 @@ func (cm *cacheManager) get(ctx context.Context, id string, pg progress.Controll
if rec.equalImmutable != nil { if rec.equalImmutable != nil {
return rec.equalImmutable.ref(triggerUpdate, descHandlers, pg), nil return rec.equalImmutable.ref(triggerUpdate, descHandlers, pg), nil
} }
return rec.mref(triggerUpdate, descHandlers).commit(ctx) return rec.mref(triggerUpdate, descHandlers).commit()
} }
return rec.ref(triggerUpdate, descHandlers, pg), nil return rec.ref(triggerUpdate, descHandlers, pg), nil

14
cache/refs.go vendored
View File

@ -383,7 +383,7 @@ func (cr *cacheRecord) size(ctx context.Context) (int64, error) {
} }
// caller must hold cr.mu // caller must hold cr.mu
func (cr *cacheRecord) mount(ctx context.Context, s session.Group) (_ snapshot.Mountable, rerr error) { func (cr *cacheRecord) mount(ctx context.Context) (_ snapshot.Mountable, rerr error) {
if cr.mountCache != nil { if cr.mountCache != nil {
return cr.mountCache, nil return cr.mountCache, nil
} }
@ -975,12 +975,12 @@ func (sr *immutableRef) Mount(ctx context.Context, readonly bool, s session.Grou
var mnt snapshot.Mountable var mnt snapshot.Mountable
if sr.cm.Snapshotter.Name() == "stargz" { if sr.cm.Snapshotter.Name() == "stargz" {
if err := sr.withRemoteSnapshotLabelsStargzMode(ctx, s, func() { if err := sr.withRemoteSnapshotLabelsStargzMode(ctx, s, func() {
mnt, rerr = sr.mount(ctx, s) mnt, rerr = sr.mount(ctx)
}); err != nil { }); err != nil {
return nil, err return nil, err
} }
} else { } else {
mnt, rerr = sr.mount(ctx, s) mnt, rerr = sr.mount(ctx)
} }
if rerr != nil { if rerr != nil {
return nil, rerr return nil, rerr
@ -1459,7 +1459,7 @@ func (sr *mutableRef) shouldUpdateLastUsed() bool {
return sr.triggerLastUsed return sr.triggerLastUsed
} }
func (sr *mutableRef) commit(ctx context.Context) (_ *immutableRef, rerr error) { func (sr *mutableRef) commit() (_ *immutableRef, rerr error) {
if !sr.mutable || len(sr.refs) == 0 { if !sr.mutable || len(sr.refs) == 0 {
return nil, errors.Wrapf(errInvalid, "invalid mutable ref %p", sr) return nil, errors.Wrapf(errInvalid, "invalid mutable ref %p", sr)
} }
@ -1518,12 +1518,12 @@ func (sr *mutableRef) Mount(ctx context.Context, readonly bool, s session.Group)
var mnt snapshot.Mountable var mnt snapshot.Mountable
if sr.cm.Snapshotter.Name() == "stargz" && sr.layerParent != nil { if sr.cm.Snapshotter.Name() == "stargz" && sr.layerParent != nil {
if err := sr.layerParent.withRemoteSnapshotLabelsStargzMode(ctx, s, func() { if err := sr.layerParent.withRemoteSnapshotLabelsStargzMode(ctx, s, func() {
mnt, rerr = sr.mount(ctx, s) mnt, rerr = sr.mount(ctx)
}); err != nil { }); err != nil {
return nil, err return nil, err
} }
} else { } else {
mnt, rerr = sr.mount(ctx, s) mnt, rerr = sr.mount(ctx)
} }
if rerr != nil { if rerr != nil {
return nil, rerr return nil, rerr
@ -1546,7 +1546,7 @@ func (sr *mutableRef) Commit(ctx context.Context) (ImmutableRef, error) {
sr.mu.Lock() sr.mu.Lock()
defer sr.mu.Unlock() defer sr.mu.Unlock()
return sr.commit(ctx) return sr.commit()
} }
func (sr *mutableRef) Release(ctx context.Context) error { func (sr *mutableRef) Release(ctx context.Context) error {

View File

@ -105,7 +105,7 @@ func getContentStore(ctx context.Context, sm *session.Manager, g session.Group,
if sessionID == "" { if sessionID == "" {
return nil, errors.New("local cache exporter/importer requires session") return nil, errors.New("local cache exporter/importer requires session")
} }
timeoutCtx, cancel := context.WithCancelCause(context.Background()) timeoutCtx, cancel := context.WithCancelCause(ctx)
timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded))
defer cancel(errors.WithStack(context.Canceled)) defer cancel(errors.WithStack(context.Canceled))

View File

@ -23,7 +23,7 @@ type FileRange struct {
Length int Length int
} }
func withMount(ctx context.Context, mount snapshot.Mountable, cb func(string) error) error { func withMount(mount snapshot.Mountable, cb func(string) error) error {
lm := snapshot.LocalMounter(mount) lm := snapshot.LocalMounter(mount)
root, err := lm.Mount() root, err := lm.Mount()
@ -51,7 +51,7 @@ func withMount(ctx context.Context, mount snapshot.Mountable, cb func(string) er
func ReadFile(ctx context.Context, mount snapshot.Mountable, req ReadRequest) ([]byte, error) { func ReadFile(ctx context.Context, mount snapshot.Mountable, req ReadRequest) ([]byte, error) {
var dt []byte var dt []byte
err := withMount(ctx, mount, func(root string) error { err := withMount(mount, func(root string) error {
fp, err := fs.RootPath(root, req.Filename) fp, err := fs.RootPath(root, req.Filename)
if err != nil { if err != nil {
return errors.WithStack(err) return errors.WithStack(err)
@ -95,7 +95,7 @@ func ReadDir(ctx context.Context, mount snapshot.Mountable, req ReadDirRequest)
if req.IncludePattern != "" { if req.IncludePattern != "" {
fo.IncludePatterns = append(fo.IncludePatterns, req.IncludePattern) fo.IncludePatterns = append(fo.IncludePatterns, req.IncludePattern)
} }
err := withMount(ctx, mount, func(root string) error { err := withMount(mount, func(root string) error {
fp, err := fs.RootPath(root, req.Path) fp, err := fs.RootPath(root, req.Path)
if err != nil { if err != nil {
return errors.WithStack(err) return errors.WithStack(err)
@ -122,7 +122,7 @@ func ReadDir(ctx context.Context, mount snapshot.Mountable, req ReadDirRequest)
func StatFile(ctx context.Context, mount snapshot.Mountable, path string) (*fstypes.Stat, error) { func StatFile(ctx context.Context, mount snapshot.Mountable, path string) (*fstypes.Stat, error) {
var st *fstypes.Stat var st *fstypes.Stat
err := withMount(ctx, mount, func(root string) error { err := withMount(mount, func(root string) error {
fp, err := fs.RootPath(root, path) fp, err := fs.RootPath(root, path)
if err != nil { if err != nil {
return errors.WithStack(err) return errors.WithStack(err)

View File

@ -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
} }

View File

@ -326,7 +326,7 @@ func buildAction(clicontext *cli.Context) error {
metricsCh := make(chan *client.SolveStatus) metricsCh := make(chan *client.SolveStatus)
pw = progresswriter.Tee(pw, metricsCh) pw = progresswriter.Tee(pw, metricsCh)
meg.Go(func() error { meg.Go(func() error {
vtxMap := tailVTXInfo(ctx, pw, metricsCh) vtxMap := tailVTXInfo(metricsCh)
if cacheMetricsFile == os.Stdout || cacheMetricsFile == os.Stdin { if cacheMetricsFile == os.Stdout || cacheMetricsFile == os.Stdin {
// make sure everything was printed out to get it as the last line. // make sure everything was printed out to get it as the last line.
eg.Wait() eg.Wait()

View File

@ -1,7 +1,6 @@
package main package main
import ( import (
"context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"os" "os"
@ -10,7 +9,6 @@ import (
"time" "time"
"github.com/moby/buildkit/client" "github.com/moby/buildkit/client"
"github.com/moby/buildkit/util/progress/progresswriter"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
) )
@ -21,7 +19,7 @@ type vtxInfo struct {
name string name string
} }
func tailVTXInfo(ctx context.Context, pw progresswriter.Writer, metricsCh <-chan *client.SolveStatus) map[digest.Digest]*vtxInfo { func tailVTXInfo(metricsCh <-chan *client.SolveStatus) map[digest.Digest]*vtxInfo {
fromRegexp := regexp.MustCompile(`^\[.*\] FROM`) fromRegexp := regexp.MustCompile(`^\[.*\] FROM`)
vtxMap := make(map[digest.Digest]*vtxInfo) vtxMap := make(map[digest.Digest]*vtxInfo)

View File

@ -19,11 +19,11 @@ func applyPlatformFlags(context *cli.Context) {
} }
// registerUnregisterService is only relevant on Windows. // registerUnregisterService is only relevant on Windows.
func registerUnregisterService(root string) (bool, error) { func registerUnregisterService(_ string) (bool, error) {
return false, nil return false, nil
} }
// launchService is only relevant on Windows. // launchService is only relevant on Windows.
func launchService(s *grpc.Server) error { func launchService(_ *grpc.Server) error {
return nil return nil
} }

View File

@ -102,7 +102,7 @@ func (w *containerdExecutor) prepareExecutionEnv(ctx context.Context, rootMount
return resolvConf, hostsFile, releaseAll, nil return resolvConf, hostsFile, releaseAll, nil
} }
func (w *containerdExecutor) ensureCWD(ctx context.Context, details *containerState, meta executor.Meta) error { func (w *containerdExecutor) ensureCWD(_ context.Context, details *containerState, meta executor.Meta) error {
newp, err := fs.RootPath(details.rootfsPath, meta.Cwd) newp, err := fs.RootPath(details.rootfsPath, meta.Cwd)
if err != nil { if err != nil {
return errors.Wrapf(err, "working dir %s points to invalid target", newp) return errors.Wrapf(err, "working dir %s points to invalid target", newp)

View File

@ -445,7 +445,7 @@ func (w *runcExecutor) Exec(ctx context.Context, id string, process executor.Pro
spec.Process.Env = process.Meta.Env spec.Process.Env = process.Meta.Env
} }
err = w.exec(ctx, id, state.Bundle, spec.Process, process, nil) err = w.exec(ctx, id, spec.Process, process, nil)
return exitError(ctx, err) return exitError(ctx, err)
} }

View File

@ -1,88 +0,0 @@
//go:build !linux
// +build !linux
package runcexecutor
import (
"context"
runc "github.com/containerd/go-runc"
"github.com/moby/buildkit/executor"
"github.com/moby/buildkit/util/bklog"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)
var errUnsupportedConsole = errors.New("tty for runc is only supported on linux")
func updateRuncFieldsForHostOS(runtime *runc.Runc) {}
func (w *runcExecutor) run(ctx context.Context, id, bundle string, process executor.ProcessInfo, started func(), keep bool) error {
if process.Meta.Tty {
return errUnsupportedConsole
}
extraArgs := []string{}
if keep {
extraArgs = append(extraArgs, "--keep")
}
killer := newRunProcKiller(w.runc, id)
return w.commonCall(ctx, id, bundle, process, started, killer, func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error {
_, err := w.runc.Run(ctx, id, bundle, &runc.CreateOpts{
NoPivot: w.noPivot,
Started: started,
IO: io,
ExtraArgs: extraArgs,
})
return err
})
}
func (w *runcExecutor) exec(ctx context.Context, id, bundle string, specsProcess *specs.Process, process executor.ProcessInfo, started func()) error {
if process.Meta.Tty {
return errUnsupportedConsole
}
killer, err := newExecProcKiller(w.runc, id)
if err != nil {
return errors.Wrap(err, "failed to initialize process killer")
}
defer killer.Cleanup()
return w.commonCall(ctx, id, bundle, process, started, killer, func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error {
return w.runc.Exec(ctx, id, *specsProcess, &runc.ExecOpts{
Started: started,
IO: io,
PidFile: pidfile,
})
})
}
type runcCall func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error
// commonCall is the common run/exec logic used for non-linux runtimes. A tty
// is only supported for linux, so this really just handles signal propagation
// to the started runc process.
func (w *runcExecutor) commonCall(ctx context.Context, id, bundle string, process executor.ProcessInfo, started func(), killer procKiller, call runcCall) error {
runcProcess, ctx := runcProcessHandle(ctx, killer)
defer runcProcess.Release()
eg, ctx := errgroup.WithContext(ctx)
defer func() {
if err := eg.Wait(); err != nil && !errors.Is(err, context.Canceled) {
bklog.G(ctx).Errorf("runc process monitoring error: %s", err)
}
}()
defer runcProcess.Shutdown()
startedCh := make(chan int, 1)
eg.Go(func() error {
return runcProcess.WaitForStart(ctx, startedCh, started)
})
eg.Go(func() error {
return handleSignals(ctx, runcProcess, process.Signal)
})
return call(ctx, startedCh, &forwardIO{stdin: process.Stdin, stdout: process.Stdout, stderr: process.Stderr}, killer.pidfile)
}

View File

@ -23,7 +23,7 @@ func updateRuncFieldsForHostOS(runtime *runc.Runc) {
func (w *runcExecutor) run(ctx context.Context, id, bundle string, process executor.ProcessInfo, started func(), keep bool) error { func (w *runcExecutor) run(ctx context.Context, id, bundle string, process executor.ProcessInfo, started func(), keep bool) error {
killer := newRunProcKiller(w.runc, id) killer := newRunProcKiller(w.runc, id)
return w.callWithIO(ctx, id, bundle, process, started, killer, func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error { return w.callWithIO(ctx, process, started, killer, func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error {
extraArgs := []string{} extraArgs := []string{}
if keep { if keep {
extraArgs = append(extraArgs, "--keep") extraArgs = append(extraArgs, "--keep")
@ -38,14 +38,14 @@ func (w *runcExecutor) run(ctx context.Context, id, bundle string, process execu
}) })
} }
func (w *runcExecutor) exec(ctx context.Context, id, bundle string, specsProcess *specs.Process, process executor.ProcessInfo, started func()) error { func (w *runcExecutor) exec(ctx context.Context, id string, specsProcess *specs.Process, process executor.ProcessInfo, started func()) error {
killer, err := newExecProcKiller(w.runc, id) killer, err := newExecProcKiller(w.runc, id)
if err != nil { if err != nil {
return errors.Wrap(err, "failed to initialize process killer") return errors.Wrap(err, "failed to initialize process killer")
} }
defer killer.Cleanup() defer killer.Cleanup()
return w.callWithIO(ctx, id, bundle, process, started, killer, func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error { return w.callWithIO(ctx, process, started, killer, func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error {
return w.runc.Exec(ctx, id, *specsProcess, &runc.ExecOpts{ return w.runc.Exec(ctx, id, *specsProcess, &runc.ExecOpts{
Started: started, Started: started,
IO: io, IO: io,
@ -56,7 +56,7 @@ func (w *runcExecutor) exec(ctx context.Context, id, bundle string, specsProcess
type runcCall func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error type runcCall func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error
func (w *runcExecutor) callWithIO(ctx context.Context, id, bundle string, process executor.ProcessInfo, started func(), killer procKiller, call runcCall) error { func (w *runcExecutor) callWithIO(ctx context.Context, process executor.ProcessInfo, started func(), killer procKiller, call runcCall) error {
runcProcess, ctx := runcProcessHandle(ctx, killer) runcProcess, ctx := runcProcessHandle(ctx, killer)
defer runcProcess.Release() defer runcProcess.Release()

View File

@ -70,7 +70,7 @@ func MakeInTotoStatements(ctx context.Context, s session.Group, attestations []e
switch att.Kind { switch att.Kind {
case gatewaypb.AttestationKindInToto: case gatewaypb.AttestationKindInToto:
stmt, err := makeInTotoStatement(ctx, content, att, defaultSubjects) stmt, err := makeInTotoStatement(content, att, defaultSubjects)
if err != nil { if err != nil {
return err return err
} }
@ -87,7 +87,7 @@ func MakeInTotoStatements(ctx context.Context, s session.Group, attestations []e
return statements, nil return statements, nil
} }
func makeInTotoStatement(ctx context.Context, content []byte, attestation exporter.Attestation, defaultSubjects []intoto.Subject) (*intoto.Statement, error) { func makeInTotoStatement(content []byte, attestation exporter.Attestation, defaultSubjects []intoto.Subject) (*intoto.Statement, error) {
if len(attestation.InToto.Subjects) == 0 { if len(attestation.InToto.Subjects) == 0 {
attestation.InToto.Subjects = []result.InTotoSubject{{ attestation.InToto.Subjects = []result.InTotoSubject{{
Kind: gatewaypb.InTotoSubjectKindSelf, Kind: gatewaypb.InTotoSubjectKindSelf,

View File

@ -59,7 +59,7 @@ func Unbundle(ctx context.Context, s session.Group, bundled []exporter.Attestati
} }
defer lm.Unmount() defer lm.Unmount()
atts, err := unbundle(ctx, src, att) atts, err := unbundle(src, att)
if err != nil { if err != nil {
return err return err
} }
@ -116,7 +116,7 @@ func sort(atts []exporter.Attestation) []exporter.Attestation {
return result return result
} }
func unbundle(ctx context.Context, root string, bundle exporter.Attestation) ([]exporter.Attestation, error) { func unbundle(root string, bundle exporter.Attestation) ([]exporter.Attestation, error) {
dir, err := fs.RootPath(root, bundle.Path) dir, err := fs.RootPath(root, bundle.Path)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -448,7 +448,7 @@ func (e *imageExporterInstance) unpackImage(ctx context.Context, img images.Imag
} }
} }
layers, err := getLayers(ctx, remote.Descriptors, manifest) layers, err := getLayers(remote.Descriptors, manifest)
if err != nil { if err != nil {
return err return err
} }
@ -478,7 +478,7 @@ func (e *imageExporterInstance) unpackImage(ctx context.Context, img images.Imag
return err return err
} }
func getLayers(ctx context.Context, descs []ocispecs.Descriptor, manifest ocispecs.Manifest) ([]rootfs.Layer, error) { func getLayers(descs []ocispecs.Descriptor, manifest ocispecs.Manifest) ([]rootfs.Layer, error) {
if len(descs) != len(manifest.Layers) { if len(descs) != len(manifest.Layers) {
return nil, errors.Errorf("mismatched image rootfs and manifest layers") return nil, errors.Errorf("mismatched image rootfs and manifest layers")
} }

View File

@ -12,7 +12,7 @@ import (
ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
) )
func patchImageLayers(ctx context.Context, remote *solver.Remote, history []ocispecs.History, ref cache.ImmutableRef, opts *ImageCommitOpts, sg session.Group) (*solver.Remote, []ocispecs.History, error) { func patchImageLayers(ctx context.Context, remote *solver.Remote, history []ocispecs.History, ref cache.ImmutableRef, opts *ImageCommitOpts, _ session.Group) (*solver.Remote, []ocispecs.History, error) {
remote, history = normalizeLayersAndHistory(ctx, remote, history, ref, opts.OCITypes) remote, history = normalizeLayersAndHistory(ctx, remote, history, ref, opts.OCITypes)
return remote, history, nil return remote, history, nil
} }

View File

@ -312,7 +312,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session
return nil, err return nil, err
} }
desc, err := ic.commitAttestationsManifest(ctx, opts, p, desc.Digest.String(), stmts) desc, err := ic.commitAttestationsManifest(ctx, opts, desc.Digest.String(), stmts)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -553,7 +553,7 @@ func (ic *ImageWriter) commitDistributionManifest(ctx context.Context, opts *Ima
}, &configDesc, nil }, &configDesc, nil
} }
func (ic *ImageWriter) commitAttestationsManifest(ctx context.Context, opts *ImageCommitOpts, p exptypes.Platform, target string, statements []intoto.Statement) (*ocispecs.Descriptor, error) { func (ic *ImageWriter) commitAttestationsManifest(ctx context.Context, opts *ImageCommitOpts, target string, statements []intoto.Statement) (*ocispecs.Descriptor, error) {
var ( var (
manifestType = ocispecs.MediaTypeImageManifest manifestType = ocispecs.MediaTypeImageManifest
configType = ocispecs.MediaTypeImageConfig configType = ocispecs.MediaTypeImageConfig

View File

@ -8,6 +8,6 @@ import (
"github.com/moby/buildkit/frontend/dockerfile/instructions" "github.com/moby/buildkit/frontend/dockerfile/instructions"
) )
func dispatchRunSecurity(c *instructions.RunCommand) (llb.RunOption, error) { func dispatchRunSecurity(_ *instructions.RunCommand) (llb.RunOption, error) {
return nil, nil return nil, nil
} }

View File

@ -462,7 +462,7 @@ func parseWorkdir(req parseRequest) (*WorkdirCommand, error) {
}, nil }, nil
} }
func parseShellDependentCommand(req parseRequest, command string, emptyAsNil bool) (ShellDependantCmdLine, error) { func parseShellDependentCommand(req parseRequest, emptyAsNil bool) (ShellDependantCmdLine, error) {
var files []ShellInlineFile var files []ShellInlineFile
for _, heredoc := range req.heredocs { for _, heredoc := range req.heredocs {
file := ShellInlineFile{ file := ShellInlineFile{
@ -498,7 +498,7 @@ func parseRun(req parseRequest) (*RunCommand, error) {
} }
cmd.FlagsUsed = req.flags.Used() cmd.FlagsUsed = req.flags.Used()
cmdline, err := parseShellDependentCommand(req, "RUN", false) cmdline, err := parseShellDependentCommand(req, false)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -520,7 +520,7 @@ func parseCmd(req parseRequest) (*CmdCommand, error) {
return nil, err return nil, err
} }
cmdline, err := parseShellDependentCommand(req, "CMD", false) cmdline, err := parseShellDependentCommand(req, false)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -536,7 +536,7 @@ func parseEntrypoint(req parseRequest) (*EntrypointCommand, error) {
return nil, err return nil, err
} }
cmdline, err := parseShellDependentCommand(req, "ENTRYPOINT", true) cmdline, err := parseShellDependentCommand(req, true)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -28,9 +28,7 @@ var validJSONArraysOfStrings = map[string][]string{
func TestJSONArraysOfStrings(t *testing.T) { func TestJSONArraysOfStrings(t *testing.T) {
for json, expected := range validJSONArraysOfStrings { for json, expected := range validJSONArraysOfStrings {
d := newDefaultDirectives() if node, _, err := parseJSON(json); err != nil {
if node, _, err := parseJSON(json, d); err != nil {
t.Fatalf("%q should be a valid JSON array of strings, but wasn't! (err: %q)", json, err) t.Fatalf("%q should be a valid JSON array of strings, but wasn't! (err: %q)", json, err)
} else { } else {
i := 0 i := 0
@ -50,9 +48,7 @@ func TestJSONArraysOfStrings(t *testing.T) {
} }
} }
for _, json := range invalidJSONArraysOfStrings { for _, json := range invalidJSONArraysOfStrings {
d := newDefaultDirectives() if _, _, err := parseJSON(json); err != errDockerfileNotStringArray {
if _, _, err := parseJSON(json, d); err != errDockerfileNotStringArray {
t.Fatalf("%q should be an invalid JSON array of strings, but wasn't!", json) t.Fatalf("%q should be an invalid JSON array of strings, but wasn't!", json)
} }
} }

View File

@ -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

View File

@ -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
} }

View File

@ -68,7 +68,12 @@ func (c *Store) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content
} }
func (c *Store) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { func (c *Store) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) {
return c.writer(ctx, 3, opts...) ctx = namespaces.WithNamespace(ctx, c.ns)
w, err := c.Store.Writer(ctx, opts...)
if err != nil {
return nil, err
}
return &nsWriter{Writer: w, ns: c.ns}, nil
} }
func (c *Store) WithFallbackNS(ns string) content.Store { func (c *Store) WithFallbackNS(ns string) content.Store {
@ -78,15 +83,6 @@ func (c *Store) WithFallbackNS(ns string) content.Store {
} }
} }
func (c *Store) writer(ctx context.Context, retries int, opts ...content.WriterOpt) (content.Writer, error) {
ctx = namespaces.WithNamespace(ctx, c.ns)
w, err := c.Store.Writer(ctx, opts...)
if err != nil {
return nil, err
}
return &nsWriter{Writer: w, ns: c.ns}, nil
}
type nsWriter struct { type nsWriter struct {
content.Writer content.Writer
ns string ns string

View File

@ -235,7 +235,7 @@ func (a *applier) Apply(ctx context.Context, c *change) error {
dstStat: dstStat, dstStat: dstStat,
} }
if done, err := a.applyDelete(ctx, ca); err != nil { if done, err := a.applyDelete(ca); err != nil {
return errors.Wrap(err, "failed to delete during apply") return errors.Wrap(err, "failed to delete during apply")
} else if done { } else if done {
return nil return nil
@ -253,7 +253,7 @@ func (a *applier) Apply(ctx context.Context, c *change) error {
return nil return nil
} }
func (a *applier) applyDelete(ctx context.Context, ca *changeApply) (bool, error) { func (a *applier) applyDelete(ca *changeApply) (bool, error) {
// Even when not deleting, we may be overwriting a file, in which case we should // Even when not deleting, we may be overwriting a file, in which case we should
// delete the existing file at the path, if any. Don't delete when both are dirs // delete the existing file at the path, if any. Don't delete when both are dirs
// in this case though because they should get merged, not overwritten. // in this case though because they should get merged, not overwritten.

View File

@ -32,12 +32,12 @@ func (ei *edgeIndex) Release(e *edge) {
defer ei.mu.Unlock() defer ei.mu.Unlock()
for id := range ei.backRefs[e] { for id := range ei.backRefs[e] {
ei.releaseEdge(id, e) ei.releaseEdge(id)
} }
delete(ei.backRefs, e) delete(ei.backRefs, e)
} }
func (ei *edgeIndex) releaseEdge(id string, e *edge) { func (ei *edgeIndex) releaseEdge(id string) {
item, ok := ei.items[id] item, ok := ei.items[id]
if !ok { if !ok {
return return

View File

@ -27,7 +27,7 @@ func timestampToTime(ts int64) *time.Time {
return &tm return &tm
} }
func mkdir(ctx context.Context, d string, action pb.FileActionMkDir, user *copy.User, idmap *idtools.IdentityMapping) error { func mkdir(d string, action pb.FileActionMkDir, user *copy.User, idmap *idtools.IdentityMapping) error {
p, err := fs.RootPath(d, action.Path) p, err := fs.RootPath(d, action.Path)
if err != nil { if err != nil {
return err return err
@ -60,7 +60,7 @@ func mkdir(ctx context.Context, d string, action pb.FileActionMkDir, user *copy.
return nil return nil
} }
func mkfile(ctx context.Context, d string, action pb.FileActionMkFile, user *copy.User, idmap *idtools.IdentityMapping) error { func mkfile(d string, action pb.FileActionMkFile, user *copy.User, idmap *idtools.IdentityMapping) error {
p, err := fs.RootPath(d, filepath.Join("/", action.Path)) p, err := fs.RootPath(d, filepath.Join("/", action.Path))
if err != nil { if err != nil {
return err return err
@ -86,7 +86,7 @@ func mkfile(ctx context.Context, d string, action pb.FileActionMkFile, user *cop
return nil return nil
} }
func rm(ctx context.Context, d string, action pb.FileActionRm) error { func rm(d string, action pb.FileActionRm) error {
if action.AllowWildcard { if action.AllowWildcard {
src, err := cleanPath(action.Path) src, err := cleanPath(action.Path)
if err != nil { if err != nil {
@ -246,7 +246,7 @@ func (fb *Backend) Mkdir(ctx context.Context, m, user, group fileoptypes.Mount,
return err return err
} }
return mkdir(ctx, dir, action, u, mnt.m.IdentityMapping()) return mkdir(dir, action, u, mnt.m.IdentityMapping())
} }
func (fb *Backend) Mkfile(ctx context.Context, m, user, group fileoptypes.Mount, action pb.FileActionMkFile) error { func (fb *Backend) Mkfile(ctx context.Context, m, user, group fileoptypes.Mount, action pb.FileActionMkFile) error {
@ -267,7 +267,7 @@ func (fb *Backend) Mkfile(ctx context.Context, m, user, group fileoptypes.Mount,
return err return err
} }
return mkfile(ctx, dir, action, u, mnt.m.IdentityMapping()) return mkfile(dir, action, u, mnt.m.IdentityMapping())
} }
func (fb *Backend) Rm(ctx context.Context, m fileoptypes.Mount, action pb.FileActionRm) error { func (fb *Backend) Rm(ctx context.Context, m fileoptypes.Mount, action pb.FileActionRm) error {
@ -283,7 +283,7 @@ func (fb *Backend) Rm(ctx context.Context, m fileoptypes.Mount, action pb.FileAc
} }
defer lm.Unmount() defer lm.Unmount()
return rm(ctx, dir, action) return rm(dir, action)
} }
func (fb *Backend) Copy(ctx context.Context, m1, m2, user, group fileoptypes.Mount, action pb.FileActionCopy) error { func (fb *Backend) Copy(ctx context.Context, m1, m2, user, group fileoptypes.Mount, action pb.FileActionCopy) error {

View File

@ -5,7 +5,7 @@ import (
copy "github.com/tonistiigi/fsutil/copy" copy "github.com/tonistiigi/fsutil/copy"
) )
func mapUserToChowner(user *copy.User, idmap *idtools.IdentityMapping) (copy.Chowner, error) { func mapUserToChowner(user *copy.User, _ *idtools.IdentityMapping) (copy.Chowner, error) {
if user == nil || user.SID == "" { if user == nil || user.SID == "" {
return func(old *copy.User) (*copy.User, error) { return func(old *copy.User) (*copy.User, error) {
if old == nil || old.SID == "" { if old == nil || old.SID == "" {

View File

@ -423,7 +423,7 @@ func (e *ExecOp) Exec(ctx context.Context, g session.Group, inputs []solver.Resu
return nil, err return nil, err
} }
emu, err := getEmulator(ctx, e.platform, e.cm.IdentityMapping()) emu, err := getEmulator(ctx, e.platform)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -85,7 +85,7 @@ func (m *staticEmulatorMount) IdentityMapping() *idtools.IdentityMapping {
return m.idmap return m.idmap
} }
func getEmulator(ctx context.Context, p *pb.Platform, idmap *idtools.IdentityMapping) (*emulator, error) { func getEmulator(ctx context.Context, p *pb.Platform) (*emulator, error) {
all := archutil.SupportedPlatforms(false) all := archutil.SupportedPlatforms(false)
pp := platforms.Normalize(ocispecs.Platform{ pp := platforms.Normalize(ocispecs.Platform{
Architecture: p.Architecture, Architecture: p.Architecture,

View File

@ -13,7 +13,7 @@ import (
copy "github.com/tonistiigi/fsutil/copy" copy "github.com/tonistiigi/fsutil/copy"
) )
func getReadUserFn(worker worker.Worker) func(chopt *pb.ChownOpt, mu, mg snapshot.Mountable) (*copy.User, error) { func getReadUserFn(_ worker.Worker) func(chopt *pb.ChownOpt, mu, mg snapshot.Mountable) (*copy.User, error) {
return readUser return readUser
} }

View File

@ -11,7 +11,7 @@ import (
copy "github.com/tonistiigi/fsutil/copy" copy "github.com/tonistiigi/fsutil/copy"
) )
func getReadUserFn(worker worker.Worker) func(chopt *pb.ChownOpt, mu, mg snapshot.Mountable) (*copy.User, error) { func getReadUserFn(_ worker.Worker) func(chopt *pb.ChownOpt, mu, mg snapshot.Mountable) (*copy.User, error) {
return readUser return readUser
} }

View File

@ -58,7 +58,7 @@ type puller struct {
*pull.Puller *pull.Puller
} }
func mainManifestKey(ctx context.Context, desc ocispecs.Descriptor, platform ocispecs.Platform, layerLimit *int) (digest.Digest, error) { func mainManifestKey(desc ocispecs.Descriptor, platform ocispecs.Platform, layerLimit *int) (digest.Digest, error) {
dt, err := json.Marshal(struct { dt, err := json.Marshal(struct {
Digest digest.Digest Digest digest.Digest
OS string OS string
@ -164,7 +164,7 @@ func (p *puller) CacheKey(ctx context.Context, g session.Group, index int) (cach
} }
desc := p.manifest.MainManifestDesc desc := p.manifest.MainManifestDesc
k, err := mainManifestKey(ctx, desc, p.Platform, p.layerLimit) k, err := mainManifestKey(desc, p.Platform, p.layerLimit)
if err != nil { if err != nil {
return struct{}{}, err return struct{}{}, err
} }

View File

@ -312,7 +312,7 @@ func (gs *gitSourceHandler) mountSSHAuthSock(ctx context.Context, sshID string,
return sock, cleanup, nil return sock, cleanup, nil
} }
func (gs *gitSourceHandler) mountKnownHosts(ctx context.Context) (string, func() error, error) { func (gs *gitSourceHandler) mountKnownHosts() (string, func() error, error) {
if gs.src.KnownSSHHosts == "" { if gs.src.KnownSSHHosts == "" {
return "", nil, errors.Errorf("no configured known hosts forwarded from the client") return "", nil, errors.Errorf("no configured known hosts forwarded from the client")
} }
@ -692,7 +692,7 @@ func (gs *gitSourceHandler) gitCli(ctx context.Context, g session.Group, opts ..
var knownHosts string var knownHosts string
if gs.src.KnownSSHHosts != "" { if gs.src.KnownSSHHosts != "" {
var unmountKnownHosts func() error var unmountKnownHosts func() error
knownHosts, unmountKnownHosts, err = gs.mountKnownHosts(ctx) knownHosts, unmountKnownHosts, err = gs.mountKnownHosts()
if err != nil { if err != nil {
cleanup() cleanup()
return nil, nil, err return nil, nil, err

View File

@ -129,7 +129,7 @@ func (e *Engine) evaluatePolicy(ctx context.Context, pol *spb.Policy, srcOp *pb.
var deny bool var deny bool
for _, rule := range pol.Rules { for _, rule := range pol.Rules {
selector := e.selectorCache(rule.Selector) selector := e.selectorCache(rule.Selector)
matched, err := match(ctx, selector, ident, srcOp.Attrs) matched, err := match(selector, ident, srcOp.Attrs)
if err != nil { if err != nil {
return false, errors.Wrap(err, "error matching source policy") return false, errors.Wrap(err, "error matching source policy")
} }

View File

@ -1,14 +1,13 @@
package sourcepolicy package sourcepolicy
import ( import (
"context"
"regexp" "regexp"
spb "github.com/moby/buildkit/sourcepolicy/pb" spb "github.com/moby/buildkit/sourcepolicy/pb"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func match(ctx context.Context, src *selectorCache, ref string, attrs map[string]string) (bool, error) { func match(src *selectorCache, ref string, attrs map[string]string) (bool, error) {
for _, c := range src.Constraints { for _, c := range src.Constraints {
if c == nil { if c == nil {
return false, errors.Errorf("invalid nil constraint for %v", src) return false, errors.Errorf("invalid nil constraint for %v", src)

View File

@ -1,7 +1,6 @@
package sourcepolicy package sourcepolicy
import ( import (
"context"
"testing" "testing"
spb "github.com/moby/buildkit/sourcepolicy/pb" spb "github.com/moby/buildkit/sourcepolicy/pb"
@ -305,7 +304,7 @@ func TestMatch(t *testing.T) {
for _, tc := range cases { for _, tc := range cases {
tc := tc tc := tc
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
matches, err := match(context.Background(), &selectorCache{Selector: &tc.src}, tc.ref, tc.attrs) matches, err := match(&selectorCache{Selector: &tc.src}, tc.ref, tc.attrs)
if !tc.xErr { if !tc.xErr {
require.NoError(t, err) require.NoError(t, err)
} else { } else {

View File

@ -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()

View File

@ -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
} }

View File

@ -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

View File

@ -189,7 +189,7 @@ func Changes(ctx context.Context, changeFn fs.ChangeFunc, upperdir, upperdirView
} }
// Check if this is a deleted entry // Check if this is a deleted entry
isDelete, skip, err := checkDelete(upperdir, path, base, f) isDelete, skip, err := checkDelete(path, base, f)
if err != nil { if err != nil {
return err return err
} else if skip { } else if skip {
@ -247,7 +247,7 @@ func Changes(ctx context.Context, changeFn fs.ChangeFunc, upperdir, upperdirView
} }
// checkDelete checks if the specified file is a whiteout // checkDelete checks if the specified file is a whiteout
func checkDelete(upperdir string, path string, base string, f os.FileInfo) (delete, skip bool, _ error) { func checkDelete(path string, base string, f os.FileInfo) (delete, skip bool, _ error) {
if f.Mode()&os.ModeCharDevice != 0 { if f.Mode()&os.ModeCharDevice != 0 {
if _, ok := f.Sys().(*syscall.Stat_t); ok { if _, ok := f.Sys().(*syscall.Stat_t); ok {
maj, min, err := devices.DeviceInfo(f) maj, min, err := devices.DeviceInfo(f)

View File

@ -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{

View File

@ -267,7 +267,7 @@ func newAuthHandler(host string, client *http.Client, scheme auth.Authentication
func (ah *authHandler) authorize(ctx context.Context, sm *session.Manager, g session.Group) (string, error) { func (ah *authHandler) authorize(ctx context.Context, sm *session.Manager, g session.Group) (string, error) {
switch ah.scheme { switch ah.scheme {
case auth.BasicAuth: case auth.BasicAuth:
return ah.doBasicAuth(ctx) return ah.doBasicAuth()
case auth.BearerAuth: case auth.BearerAuth:
return ah.doBearerAuth(ctx, sm, g) return ah.doBearerAuth(ctx, sm, g)
default: default:
@ -275,7 +275,7 @@ func (ah *authHandler) authorize(ctx context.Context, sm *session.Manager, g ses
} }
} }
func (ah *authHandler) doBasicAuth(ctx context.Context) (string, error) { func (ah *authHandler) doBasicAuth() (string, error) {
username, secret := ah.common.Username, ah.common.Secret username, secret := ah.common.Username, ah.common.Secret
if username == "" || secret == "" { if username == "" || secret == "" {

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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
} }