mirror of
https://github.com/docker/build-push-action.git
synced 2025-08-11 02:52:11 +00:00
fix: add timeout to buildx export operation to prevent hanging
Add a 30-second timeout to the buildxHistory.export() call to prevent workflow jobs from hanging indefinitely when the buildx dial-stdio process crashes or becomes unresponsive. The build will continue with reporting even if the export fails or times out. Fixes issue where docker run export-build command would hang with "broken pipe" errors when buildx backend is unavailable. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c213746489
commit
3cf0b00a1a
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
20
src/main.ts
20
src/main.ts
@ -248,9 +248,25 @@ actionsToolkit.run(
|
||||
let exportRes;
|
||||
if (!buildError) {
|
||||
const buildxHistory = new BuildxHistory();
|
||||
exportRes = await buildxHistory.export({
|
||||
refs: ref ? [ref] : []
|
||||
|
||||
// Create a timeout promise that rejects after 30 seconds
|
||||
const exportTimeout = new Promise<never>((_, reject) => {
|
||||
setTimeout(() => reject(new Error('Export operation timed out after 30 seconds')), 30000);
|
||||
});
|
||||
|
||||
try {
|
||||
// Race between the export operation and the timeout
|
||||
exportRes = await Promise.race([
|
||||
buildxHistory.export({
|
||||
refs: ref ? [ref] : []
|
||||
}),
|
||||
exportTimeout
|
||||
]);
|
||||
} catch (exportError) {
|
||||
// Log the error but continue with reporting
|
||||
core.warning(`Build export failed: ${(exportError as Error).message}`);
|
||||
core.info('Continuing with build reporting without export data');
|
||||
}
|
||||
}
|
||||
|
||||
if (buildId && isBlacksmithBuilder) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user