Skip to content

Commit e75024e

Browse files
adityamaruCodesmith
andcommitted
fix: prevent sticky disk commit after buildkitd SIGKILL
Add an in-memory _sigkillUsed flag alongside the existing core.saveState persistence. This ensures getSigkillUsed() returns true within the same process even if the GitHub Actions state mechanism has issues during post-action cleanup. Also log a warning (instead of the misleading 'gracefully') when buildkitd was actually terminated with SIGKILL. Co-authored-by: Codesmith <codesmith@blacksmith.sh>
1 parent 6078dc1 commit e75024e

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,11 @@ void actionsToolkit.run(
707707
Metric_MetricType.BPA_BUILDKITD_SHUTDOWN_DURATION_MS,
708708
buildkitdShutdownDurationMs,
709709
);
710-
core.info("Shutdown buildkitd gracefully");
710+
if (stateHelper.getSigkillUsed()) {
711+
core.warning("buildkitd was terminated with SIGKILL after graceful shutdown failed");
712+
} else {
713+
core.info("Shutdown buildkitd gracefully");
714+
}
711715
} else {
712716
// Check if buildkitd was expected to be running (we have state indicating it was started)
713717
const buildkitdAddr = stateHelper.getBuildkitdAddr();

src/state-helper.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ export function getBuilderName(): string {
3838
return core.getState("builderName");
3939
}
4040

41+
let _sigkillUsed = false;
42+
4143
export function setSigkillUsed(used: boolean) {
44+
_sigkillUsed = used;
4245
core.saveState("sigkillUsed", used.toString());
4346
}
4447

4548
export function getSigkillUsed(): boolean {
46-
return core.getState("sigkillUsed") === "true";
49+
return _sigkillUsed || core.getState("sigkillUsed") === "true";
4750
}

0 commit comments

Comments
 (0)