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