Skip to content

Commit 793f1ea

Browse files
committed
history: finalize when exporting
Signed-off-by: CrazyMax <[email protected]>
1 parent a4662bb commit 793f1ea

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/buildx/history.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ export class History {
105105
return await this.exportLegacy(builderName, nodeName, refs, outDir, opts.image);
106106
}
107107

108-
// wait 3 seconds to ensure build records are finalized: https://github.com/moby/buildkit/pull/5109
109-
await Util.sleep(3);
108+
if (await this.buildx.versionSatisfies('<0.24.0')) {
109+
// wait 3 seconds to ensure build records are finalized: https://github.com/moby/buildkit/pull/5109
110+
// not necessary since buildx 0.24.0: https://github.com/docker/buildx/pull/3152
111+
await Util.sleep(3);
112+
}
110113

111114
const summaries: Summaries = {};
112115
if (!opts.noSummaries) {
@@ -139,7 +142,12 @@ export class History {
139142

140143
const dockerbuildPath = path.join(outDir, `${History.exportFilename(refs)}.dockerbuild`);
141144

142-
const cmd = await this.getExportCommand(['--builder', builderName, '--output', dockerbuildPath, ...refs]);
145+
const exportArgs = ['--builder', builderName, '--output', dockerbuildPath, ...refs];
146+
if (await this.buildx.versionSatisfies('>=0.24.0')) {
147+
exportArgs.push('--finalize');
148+
}
149+
150+
const cmd = await this.getExportCommand(exportArgs);
143151
await Exec.getExecOutput(cmd.command, cmd.args);
144152

145153
const dockerbuildStats = fs.statSync(dockerbuildPath);

0 commit comments

Comments
 (0)