cache-buildkite-plugin
cache-buildkite-plugin copied to clipboard
Buildkite cache plugin not cleaning up
It seems if a job is cancelled during the pre-command hook (before it gets to deleting the temp folder), the temp files aren't cleaned up.
<head></head>
download: s3://dovetail-tooling-buildkite-cache/arm64/c543fe5bffefe6ca3bcbab1a9eb68e8bf6791742 to ../../../../../../../tmp/tmp.fyql3rk4h5
--
 | 2025-04-08 11:31:27 AEST | Cache is compressed, decompressing with tgz...
 | 2025-04-08 11:31:50 AEST | # Received cancellation signal, interrupting
 | 2025-04-08 11:31:50 AEST | 🚨 Error: running "plugin cache pre-command" shell hook: The plugin cache pre-command hook exited with status -1
 | 2025-04-08 11:31:50 AEST | Running global pre-exit hook
 | 2025-04-08 11:31:50 AEST | Stopping ssh-agent 3441
 | 2025-04-08 11:31:50 AEST | Running plugin docker-compose pre-exit hook
 | 2025-04-08 11:31:50 AEST | Cleaning up after docker-compose
I'm fairly certain that this has caused our agents to fill up their temporary file directory because it didn't get a chance to remove the temporary folder.
I think that adding a pre-exit hook, should allow for the temporary folder to be cleared regardless of how far into the pre-command the plugin is.