4
4
"context"
5
5
"encoding/base64"
6
6
"encoding/json"
7
- "fmt"
8
7
"io"
9
8
"os"
10
9
"path/filepath"
@@ -131,25 +130,6 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
131
130
return nil , err
132
131
}
133
132
134
- type exporter struct {
135
- ExportEntry
136
- id string
137
- }
138
-
139
- var exporters []exporter
140
- ids := make (map [string ]int )
141
- for _ , exp := range opt .Exports {
142
- if id , ok := ids [exp .Type ]; ! ok {
143
- ids [exp .Type ] = 1
144
- } else {
145
- ids [exp .Type ] = id + 1
146
- }
147
- exporters = append (exporters , exporter {
148
- ExportEntry : exp ,
149
- id : fmt .Sprint (exp .Type , ids [exp .Type ]),
150
- })
151
- }
152
-
153
133
storesToUpdate := []string {}
154
134
155
135
if ! opt .SessionPreInitialized {
@@ -174,7 +154,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
174
154
}
175
155
176
156
var syncTargets []filesync.FSSyncTarget
177
- for _ , ex := range exporters {
157
+ for exID , ex := range opt . Exports {
178
158
var supportFile bool
179
159
var supportDir bool
180
160
switch ex .Type {
@@ -199,7 +179,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
199
179
if ex .Output == nil {
200
180
return nil , errors .Errorf ("output file writer is required for %s exporter" , ex .Type )
201
181
}
202
- syncTargets = append (syncTargets , filesync .WithFSSync (ex . id , ex .Output ))
182
+ syncTargets = append (syncTargets , filesync .WithFSSync (exID , ex .Output ))
203
183
}
204
184
if supportDir {
205
185
if ex .OutputDir == "" {
@@ -217,7 +197,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
217
197
contentStores ["export" ] = cs
218
198
storesToUpdate = append (storesToUpdate , ex .OutputDir )
219
199
default :
220
- syncTargets = append (syncTargets , filesync .WithFSSyncDir (ex . id , ex .OutputDir ))
200
+ syncTargets = append (syncTargets , filesync .WithFSSyncDir (exID , ex .OutputDir ))
221
201
}
222
202
}
223
203
}
@@ -280,13 +260,12 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
280
260
exports := make ([]* controlapi.Exporter , 0 , len (opt .Exports ))
281
261
exportDeprecated := ""
282
262
exportAttrDeprecated := map [string ]string {}
283
- for i , exp := range exporters {
263
+ for i , exp := range opt . Exports {
284
264
if i == 0 {
285
265
exportDeprecated = exp .Type
286
266
exportAttrDeprecated = exp .Attrs
287
267
}
288
268
exports = append (exports , & controlapi.Exporter {
289
- ID : exp .id ,
290
269
Type : exp .Type ,
291
270
Attrs : exp .Attrs ,
292
271
})
0 commit comments