controller: don't write metadata file in controller

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell
2023-04-24 10:21:02 +01:00
parent 75ed3e296b
commit 2bf996d9ad
5 changed files with 130 additions and 188 deletions

View File

@ -111,7 +111,6 @@ func (o *buildOptions) toControllerOptions() (*controllerapi.BuildOptions, error
Target: o.target,
Ulimits: dockerUlimitToControllerUlimit(o.ulimits),
Builder: o.builder,
MetadataFile: o.metadataFile,
NoCache: o.noCache,
Pull: o.pull,
ExportPush: o.exportPush,
@ -263,7 +262,11 @@ func runBuild(dockerCli command.Cli, options buildOptions) (err error) {
}
return os.WriteFile(options.imageIDFile, []byte(dgst), 0644)
}
if options.metadataFile != "" {
if err := writeMetadataFile(options.metadataFile, decodeExporterResponse(resp.ExporterResponse)); err != nil {
return err
}
}
return nil
}
@ -895,13 +898,6 @@ func resolvePaths(options *controllerapi.BuildOptions) (_ *controllerapi.BuildOp
}
options.SSH = ssh
if options.MetadataFile != "" {
options.MetadataFile, err = filepath.Abs(options.MetadataFile)
if err != nil {
return nil, err
}
}
return options, nil
}

View File

@ -235,15 +235,6 @@ func TestResolvePaths(t *testing.T) {
},
},
},
{
name: "metadatafile",
options: controllerapi.BuildOptions{
MetadataFile: "test1",
},
want: controllerapi.BuildOptions{
MetadataFile: filepath.Join(tmpwd, "test1"),
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {