src: dont fatal on shutdown

This commit is contained in:
Aditya Maru 2024-11-04 16:24:12 -05:00
parent 0f425d2ea6
commit 6211bc2630
3 changed files with 15 additions and 11 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -57,7 +57,7 @@ async function reportBuildCompleted() {
await postWithRetry(client, '/stickydisks', formData, retryCondition);
return;
} catch (error) {
core.warning('Error completing Blacksmith build:', error);
core.warning('Error reporting build completed:', error);
throw error;
}
}
@ -75,7 +75,7 @@ async function reportBuildFailed() {
await postWithRetry(client, '/stickydisks', formData, retryCondition);
return;
} catch (error) {
core.warning('Error completing Blacksmith build:', error);
core.warning('Error reporting build failed:', error);
throw error;
}
}
@ -584,13 +584,17 @@ actionsToolkit.run(
});
}
if (stateHelper.remoteDockerBuildStatus != '') {
await shutdownBuildkitd();
await execAsync(`sudo umount ${mountPoint}`);
core.debug(`${device} has been unmounted`);
if (stateHelper.remoteDockerBuildStatus == 'success') {
await reportBuildCompleted();
} else {
await reportBuildFailed();
try {
await shutdownBuildkitd();
await execAsync(`sudo umount ${mountPoint}`);
core.debug(`${device} has been unmounted`);
if (stateHelper.remoteDockerBuildStatus == 'success') {
await reportBuildCompleted();
} else {
await reportBuildFailed();
}
} catch (error) {
core.warning(`Error during Blacksmith builder shutdown: ${error.message}`);
}
}
if (stateHelper.tmpDir.length > 0) {