GeezerVison is showing github.com — Merge pull request #690 from crazy-max/history-export-finalize · docker/actions-toolkit@34ddc49
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/buildx/history.ts +11-3Lines changed: 11 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -105,8 +105,11 @@ export class History { |
105 | 105 | return await this.exportLegacy(builderName, nodeName, refs, outDir, opts.image); |
106 | 106 | } |
107 | 107 |
|
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 | + } |
110 | 113 |
|
111 | 114 | const summaries: Summaries = {}; |
112 | 115 | if (!opts.noSummaries) { |
@@ -139,7 +142,12 @@ export class History { |
139 | 142 |
|
140 | 143 | const dockerbuildPath = path.join(outDir, `${History.exportFilename(refs)}.dockerbuild`); |
141 | 144 |
|
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); |
143 | 151 | await Exec.getExecOutput(cmd.command, cmd.args); |
144 | 152 |
|
145 | 153 | const dockerbuildStats = fs.statSync(dockerbuildPath); |
|