build providers: destroy on create failures
Metadata
Current evaluation
Merged PR #2374 (commit ec0fbe2be, LP #1792242) adds cleanup so build providers are destroyed when creation/launch fails, preventing VMs from being left running.
Resolution: closed resolved
Reason: PR #2374 by maintainer sergiusens was approved and merged into master as commit ec0fbe2be, which wraps provider launch so the build provider is destroyed when create/launch raises, plus unit tests for the cleanup path (LP bug #1792242).
Evaluated by: mr-cal-bot
No scores available.
Issue body
When launch fails within the context manager, there is not logic that
ensures the build provider is actually destroyed so the VM does not
stay running.
LP: #1792242
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] 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)?
- [ ] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2374 (commit ec0fbe2be, LP #1792242) adds cleanup so build providers are destroyed when creation/launch fails, preventing VMs from being left running. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2374 in commit ec0fbe2be: build providers now destroy VMs when creation/launch fails, preventing leftover running instances and adding cleanup tests. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged. Resolves a bug where build providers and VMs remained running after launch failures. Adds cleanup logic and tests across seven files, approved by a reviewer and passing CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged changes implement cleanup logic to destroy build provider VMs after creation failures, resolving LP #1792242. Comprehensive tests ensure proper resource teardown, achieving 93.33% diff coverage. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2474 build providers: remove dead code | snapcraft | merged | Merged PR #2474 as commit 4308dd8d3, removing obsolete build-provider methods left over from legacy cleanbuild support. | |
| #2515 build providers: support for provider setup | snapcraft | merged | Merged PR #2515 as e4a578823, moving build-provider checks and setup into provider implementations and resolving LP #1821586. | |
| #2282 build providers: cleaner start and launch messaging | snapcraft | merged | Merged PR #2282 via commit edc4a9f16, improving build-provider startup and instance-launch messaging for LP #1793101. | |
| #2508 Build provider errors | snapcraft | merged | Merged PR #2508 in commit 8d8f411b3, enhancing build-provider error handling across two files (+353/-85 lines). | |
| #2529 build providers: idempotent destroy for LXD | snapcraft | merged | Merged PR #2529 made LXD cleanup idempotent, preventing missing-container errors from masking launch failures; landed as commit 1b2905885. | |
| #2460 build providers: recreate instance if base changed | snapcraft | merged | Merged via commit 63d052f65: build providers now detect project base changes and recreate instances, resolving Launchpad bug #1794506. |