Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const execAsync = promisify(exec);
// Best-effort fstrim of the sticky disk before it is unmounted and committed:
// pruned layers keep their RBD extents allocated on the backing store until
// the guest discards them. Bounded by the host-supplied budget; any failure
// (discard not negotiated, missing binary, timeout) only logs. A positive
// (discard not negotiated, missing binary, timeout) only logs. `timeout` runs
// under sudo so it has the privilege to stop root's fstrim. A positive
// minExtentBytes is passed as `fstrim -m`: free extents smaller than that are
// left alone.
async function trimFilesystem(
Expand All @@ -57,7 +58,7 @@ async function trimFilesystem(
const minimum = minExtentBytes > 0 ? ` -m ${minExtentBytes}` : "";
try {
const { stdout } = await execAsync(
`timeout ${timeoutSecs} sudo fstrim -v${minimum} -- "${mountPath}"`,
`sudo timeout ${timeoutSecs} fstrim -v${minimum} -- "${mountPath}"`,
);
core.info(
`fstrim ${mountPath}: ${stdout.trim() || "done"} in ${Date.now() - start}ms`,
Expand Down
2 changes: 1 addition & 1 deletion src/setup_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ export async function startBuildkitd(
export type FstrimFailureOutcome = "timeout" | "unsupported" | "failed";

/**
* Classifies a failed `timeout <n> sudo fstrim` run: 124 is timeout(1)'s
* Classifies a failed `sudo timeout <n> fstrim` run: 124 is timeout(1)'s
* exit code; discard not negotiated by the hypervisor (EOPNOTSUPP) or no
* fstrim binary are "unsupported"; anything else is "failed".
*/
Expand Down
Loading