← Back to issue list

lxd: always remove tmp_dir after execution

View original Github issue

Metadata

Project
snapcraft
Number
#1742
Type
pull request
State
merged
Author
kalikiana
Labels
—
Created
Updated
Closed

Current evaluation

Merged in PR #1742 as commit cd8013851, ensuring LXD container builds always delete their temporary build directory, including after errors, to prevent disk-space waste.

Resolution: closed resolved

Reason: PR #1742 was merged as commit cd8013851. Cleanup now runs after every container-build attempt, removing tmp_dir even when execution fails, with unit tests updated accordingly.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- Currently the tmp_dir used when building in containers is not removed if there was an error. As per [discussion on the forum](https://forum.snapcraft.io/t/snapcraft-snapped-lxd-disk-space-waste/2857/5) I'm proposing this change to always remove the temporary folder. Unit tests are updated accordingly.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in PR #1742 as commit cd8013851, ensuring LXD container builds always delete their temporary build directory, including after errors, to prevent disk-space waste.
stealth/space-bunny-alpha — closed resolved Merged as commit cd8013851 via PR #1742: LXD container builds now always remove tmp_dir, including after errors, preventing temporary-build disk-space waste.
stealth/space-bunny-alpha — closed resolved Merged PR #1742 ensured LXD container builds always remove the temporary directory, including after errors; related unit tests were updated.
qwen/qwen3.6-35b-a3b — — Merged fix ensuring the temporary directory is always removed after LXD container builds, preventing disk space waste on errors. Approved and passed CI.
qwen3.6-35b-a3b-mtp-q6 — — Merged a fix ensuring the LXD container build temporary directory is always removed after execution, preventing disk space leaks on build failures. Unit tests were updated to verify cleanup behavior.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1519 lxd: use a unique temporary folder snapcraft merged Merged #1519 in commit fcda45133, giving each LXD build a unique temporary directory so parallel cleanbuilds no longer share one folder.
78%
#1488 lxd: always remove existing device for project folder snapcraft merged Merged PR #1488 in commit 11450b469, ensuring an existing LXD device for the project folder is always removed; it followed up the path fix in #1483.
71%
#1762 lxd: delete container only if parts is empty snapcraft merged Merged PR #1762 (dbce9a058), changing LXD cleanup to delete a build container only after all parts are removed, preserving it for targeted cleans and making repeated cleans safe.
71%