lxd: always remove tmp_dir after execution
Metadata
Current evaluation
Merged fix ensuring the temporary directory is always removed after LXD container builds, preventing disk space waste on errors. Approved and passed CI.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix resolving disk space waste by ensuring temporary build directories are always removed after LXD container execution, regardless of errors. Unit tests updated. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1408 lxd: Stop setting $HOME in containers | snapcraft | merged | Stopped setting $HOME in LXD containers to prevent .cache files from writing to the mounted project directory. Merged after reviewer approval and CI checks, addressing bug 1703642. | |
| #1403 lxd: Only remove container if one exists | snapcraft | merged | Merged following two reviewer approvals and passing CI. The update resolves duplicate exceptions during failed LXD container creation by adding a conditional check before attempting container removal. | |
| #1762 lxd: delete container only if parts is empty | snapcraft | merged | Merged fix resolving bug 1734145 by updating LXD container cleanup logic to only delete containers when parts are empty. Approved by one reviewer, passed CI checks, and modified two files. | |
| #1488 lxd: always remove existing device for project folder | snapcraft | merged | Merged as a follow-up to #1483, ensuring existing devices are always removed for the LXD project folder. Approved by two reviewers with zero unresolved comments. The change modifies three files, adds 64 lines, removes one, and passed all CI checks. | |
| #1519 lxd: use a unique temporary folder | snapcraft | merged | Merged to resolve parallel snapcraft cleanbuild failures by moving the temporary folder initialization to the constructor. Removed the is_snap condition, relocated tests, and passed CI review. Modified 5 files. |