77 cacheutil "github.com/moby/buildkit/cache/util"
88 "github.com/moby/buildkit/client/llb"
99 "github.com/moby/buildkit/frontend"
10- "github.com/moby/buildkit/frontend/gateway"
1110 "github.com/moby/buildkit/frontend/gateway/client"
11+ "github.com/moby/buildkit/frontend/gateway/container"
1212 gwpb "github.com/moby/buildkit/frontend/gateway/pb"
1313 "github.com/moby/buildkit/identity"
1414 "github.com/moby/buildkit/session"
@@ -26,8 +26,8 @@ import (
2626 "golang.org/x/sync/errgroup"
2727)
2828
29- func llbBridgeToGatewayClient (ctx context.Context , llbBridge frontend.FrontendLLBBridge , opts map [string ]string , inputs map [string ]* opspb.Definition , w worker.Infos , sid string , sm * session.Manager ) (* bridgeClient , error ) {
30- bc := & bridgeClient {
29+ func LLBBridgeToGatewayClient (ctx context.Context , llbBridge frontend.FrontendLLBBridge , opts map [string ]string , inputs map [string ]* opspb.Definition , w worker.Infos , sid string , sm * session.Manager ) (* BridgeClient , error ) {
30+ bc := & BridgeClient {
3131 opts : opts ,
3232 inputs : inputs ,
3333 FrontendLLBBridge : llbBridge ,
@@ -40,7 +40,7 @@ func llbBridgeToGatewayClient(ctx context.Context, llbBridge frontend.FrontendLL
4040 return bc , nil
4141}
4242
43- type bridgeClient struct {
43+ type BridgeClient struct {
4444 frontend.FrontendLLBBridge
4545 mu sync.Mutex
4646 opts map [string ]string
@@ -54,7 +54,7 @@ type bridgeClient struct {
5454 ctrs []client.Container
5555}
5656
57- func (c * bridgeClient ) Solve (ctx context.Context , req client.SolveRequest ) (* client.Result , error ) {
57+ func (c * BridgeClient ) Solve (ctx context.Context , req client.SolveRequest ) (* client.Result , error ) {
5858 res , err := c .FrontendLLBBridge .Solve (ctx , frontend.SolveRequest {
5959 Evaluate : req .Evaluate ,
6060 Definition : req .Definition ,
@@ -91,7 +91,7 @@ func (c *bridgeClient) Solve(ctx context.Context, req client.SolveRequest) (*cli
9191
9292 return cRes , nil
9393}
94- func (c * bridgeClient ) loadBuildOpts () client.BuildOpts {
94+ func (c * BridgeClient ) loadBuildOpts () client.BuildOpts {
9595 wis := c .workers .WorkerInfos ()
9696 workers := make ([]client.WorkerInfo , len (wis ))
9797 for i , w := range wis {
@@ -112,11 +112,11 @@ func (c *bridgeClient) loadBuildOpts() client.BuildOpts {
112112 }
113113}
114114
115- func (c * bridgeClient ) BuildOpts () client.BuildOpts {
115+ func (c * BridgeClient ) BuildOpts () client.BuildOpts {
116116 return c .buildOpts
117117}
118118
119- func (c * bridgeClient ) Inputs (ctx context.Context ) (map [string ]llb.State , error ) {
119+ func (c * BridgeClient ) Inputs (ctx context.Context ) (map [string ]llb.State , error ) {
120120 inputs := make (map [string ]llb.State )
121121 for key , def := range c .inputs {
122122 defop , err := llb .NewDefinitionOp (def )
@@ -128,7 +128,7 @@ func (c *bridgeClient) Inputs(ctx context.Context) (map[string]llb.State, error)
128128 return inputs , nil
129129}
130130
131- func (c * bridgeClient ) wrapSolveError (solveErr error ) error {
131+ func (c * BridgeClient ) wrapSolveError (solveErr error ) error {
132132 var (
133133 ee * llberrdefs.ExecError
134134 fae * llberrdefs.FileActionError
@@ -162,7 +162,7 @@ func (c *bridgeClient) wrapSolveError(solveErr error) error {
162162 return errdefs .WithSolveError (solveErr , subject , inputIDs , mountIDs )
163163}
164164
165- func (c * bridgeClient ) registerResultIDs (results ... solver.Result ) (ids []string , err error ) {
165+ func (c * BridgeClient ) registerResultIDs (results ... solver.Result ) (ids []string , err error ) {
166166 c .mu .Lock ()
167167 defer c .mu .Unlock ()
168168
@@ -181,7 +181,7 @@ func (c *bridgeClient) registerResultIDs(results ...solver.Result) (ids []string
181181 return ids , nil
182182}
183183
184- func (c * bridgeClient ) toFrontendResult (r * client.Result ) (* frontend.Result , error ) {
184+ func (c * BridgeClient ) toFrontendResult (r * client.Result ) (* frontend.Result , error ) {
185185 if r == nil {
186186 return nil , nil
187187 }
@@ -206,7 +206,7 @@ func (c *bridgeClient) toFrontendResult(r *client.Result) (*frontend.Result, err
206206 return res , nil
207207}
208208
209- func (c * bridgeClient ) discard (err error ) {
209+ func (c * BridgeClient ) discard (err error ) {
210210 for _ , ctr := range c .ctrs {
211211 ctr .Release (context .TODO ())
212212 }
@@ -227,16 +227,16 @@ func (c *bridgeClient) discard(err error) {
227227 }
228228}
229229
230- func (c * bridgeClient ) Warn (ctx context.Context , dgst digest.Digest , msg string , opts client.WarnOpts ) error {
230+ func (c * BridgeClient ) Warn (ctx context.Context , dgst digest.Digest , msg string , opts client.WarnOpts ) error {
231231 return c .FrontendLLBBridge .Warn (ctx , dgst , msg , opts )
232232}
233233
234- func (c * bridgeClient ) NewContainer (ctx context.Context , req client.NewContainerRequest ) (client.Container , error ) {
235- ctrReq := gateway .NewContainerRequest {
234+ func (c * BridgeClient ) NewContainer (ctx context.Context , req client.NewContainerRequest ) (client.Container , error ) {
235+ ctrReq := container .NewContainerRequest {
236236 ContainerID : identity .NewID (),
237237 NetMode : req .NetMode ,
238238 Hostname : req .Hostname ,
239- Mounts : make ([]gateway .Mount , len (req .Mounts )),
239+ Mounts : make ([]container .Mount , len (req .Mounts )),
240240 }
241241
242242 eg , ctx := errgroup .WithContext (ctx )
@@ -267,7 +267,7 @@ func (c *bridgeClient) NewContainer(ctx context.Context, req client.NewContainer
267267 return errors .Errorf ("failed to find ref %s for %q mount" , m .ResultID , m .Dest )
268268 }
269269 }
270- ctrReq .Mounts [i ] = gateway .Mount {
270+ ctrReq .Mounts [i ] = container .Mount {
271271 WorkerRef : workerRef ,
272272 Mount : & opspb.Mount {
273273 Dest : m .Dest ,
@@ -288,7 +288,7 @@ func (c *bridgeClient) NewContainer(ctx context.Context, req client.NewContainer
288288 return nil , err
289289 }
290290
291- ctrReq .ExtraHosts , err = gateway .ParseExtraHosts (req .ExtraHosts )
291+ ctrReq .ExtraHosts , err = container .ParseExtraHosts (req .ExtraHosts )
292292 if err != nil {
293293 return nil , err
294294 }
@@ -299,15 +299,15 @@ func (c *bridgeClient) NewContainer(ctx context.Context, req client.NewContainer
299299 }
300300
301301 group := session .NewGroup (c .sid )
302- ctr , err := gateway .NewContainer (ctx , w , c .sm , group , ctrReq )
302+ ctr , err := container .NewContainer (ctx , w , c .sm , group , ctrReq )
303303 if err != nil {
304304 return nil , err
305305 }
306306 c .ctrs = append (c .ctrs , ctr )
307307 return ctr , nil
308308}
309309
310- func (c * bridgeClient ) newRef (r solver.ResultProxy , s session.Group ) (* ref , error ) {
310+ func (c * BridgeClient ) newRef (r solver.ResultProxy , s session.Group ) (* ref , error ) {
311311 return & ref {resultProxy : r , session : s , c : c }, nil
312312}
313313
@@ -316,7 +316,7 @@ type ref struct {
316316 resultProxyClones []solver.ResultProxy
317317
318318 session session.Group
319- c * bridgeClient
319+ c * BridgeClient
320320}
321321
322322func (r * ref ) acquireResultProxy () solver.ResultProxy {
0 commit comments