fix: prevent sticky disk commit after buildkitd SIGKILL#77
Merged
adityamaru merged 1 commit intomainfrom Mar 25, 2026
Merged
Conversation
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>
d5c25ac to
e75024e
Compare
eltonkl
approved these changes
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #68.
The
sigkillUsedflag was written withcore.saveStatebut read withcore.getState. These two functions communicate via theGITHUB_STATEfile andSTATE_*environment variables respectively — a channel that only works between the main step and post-job step. Since bothsetSigkillUsed(true)(in the SIGKILL path ofshutdownBuildkitd) andgetSigkillUsed()(in the sticky-disk commit guard) run inside the same post-job process, the flag was alwaysfalse, and sticky disks were committed even after a forced kill.How it works:
_sigkillUsedvariable instate-helper.tsnow tracks the flag in-memory.setSigkillUsedsets both the variable andcore.saveState(belt-and-suspenders).getSigkillUsedreads the variable first, falling back tocore.getStatefor any future cross-step use.core.info("Shutdown buildkitd gracefully")log aftershutdownBuildkitd()returns is now gated ongetSigkillUsed(), so it won't misleadingly print after a SIGKILL termination.The change is confined to two files (
state-helper.ts,main.ts) and has no effect on the happy path — the in-memory variable defaults tofalse, matching the previous behavior when SIGKILL isn't used. Thedist/bundle will need a CI rebuild.View Codesmith session