Skip to content

Commit 73b4e04

Browse files
committed
controller: remove MetadataFile from CommonOptions
Signed-off-by: CrazyMax <[email protected]>
1 parent 9df1970 commit 73b4e04

File tree

4 files changed

+157
-167
lines changed

4 files changed

+157
-167
lines changed

commands/bake.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ import (
2525
)
2626

2727
type bakeOptions struct {
28-
files []string
29-
overrides []string
30-
printOnly bool
31-
sbom string
32-
provenance string
28+
files []string
29+
overrides []string
30+
printOnly bool
31+
sbom string
32+
provenance string
33+
metadataFile string
3334

3435
controllerapi.CommonOptions
3536
//control.ControlOptions
@@ -212,12 +213,12 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions, cFlags com
212213
return wrapBuildError(err, true)
213214
}
214215

215-
if len(in.MetadataFile) > 0 {
216+
if len(in.metadataFile) > 0 {
216217
dt := make(map[string]interface{})
217218
for t, r := range resp {
218219
dt[t] = decodeExporterResponse(r.ExporterResponse)
219220
}
220-
if err := writeMetadataFile(in.MetadataFile, dt); err != nil {
221+
if err := writeMetadataFile(in.metadataFile, dt); err != nil {
221222
return err
222223
}
223224
}
@@ -242,7 +243,7 @@ func bakeCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
242243
cFlags.pull = nil
243244
}
244245
options.Builder = rootOpts.builder
245-
options.MetadataFile = cFlags.metadataFile
246+
options.metadataFile = cFlags.metadataFile
246247
// Other common flags (noCache, pull and progress) are processed in runBake function.
247248
return runBake(dockerCli, args, options, cFlags)
248249
},

commands/build.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ type buildOptions struct {
6363
dockerfileName string
6464
extraHosts []string
6565
imageIDFile string
66+
metadataFile string
6667
labels []string
6768
networkMode string
6869
noCacheFilter []string
@@ -75,17 +76,15 @@ type buildOptions struct {
7576
tags []string
7677
target string
7778
ulimits *dockeropts.UlimitOpt
79+
attests []string
80+
sbom string
81+
provenance string
82+
progress string
83+
quiet bool
7884

7985
invoke *invokeConfig
8086
noBuild bool
8187

82-
attests []string
83-
sbom string
84-
provenance string
85-
86-
progress string
87-
quiet bool
88-
8988
controllerapi.CommonOptions
9089
control.ControlOptions
9190
}
@@ -284,8 +283,8 @@ func runBuild(dockerCli command.Cli, options buildOptions) (err error) {
284283
return errors.Wrap(err, "writing image ID file")
285284
}
286285
}
287-
if options.MetadataFile != "" {
288-
if err := writeMetadataFile(options.MetadataFile, decodeExporterResponse(resp.ExporterResponse)); err != nil {
286+
if options.metadataFile != "" {
287+
if err := writeMetadataFile(options.metadataFile, decodeExporterResponse(resp.ExporterResponse)); err != nil {
289288
return err
290289
}
291290
}
@@ -414,7 +413,7 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
414413
RunE: func(cmd *cobra.Command, args []string) error {
415414
options.contextPath = args[0]
416415
options.Builder = rootOpts.builder
417-
options.MetadataFile = cFlags.metadataFile
416+
options.metadataFile = cFlags.metadataFile
418417
options.NoCache = false
419418
if cFlags.noCache != nil {
420419
options.NoCache = *cFlags.noCache

0 commit comments

Comments
 (0)