enhancement: let `destructive-mode` build to pick the correct build automatically
Metadata
Current evaluation
Enhancement request to auto-select the host-compatible build under --destructive-mode was declined: @lengau closed it as not planned, discouraging destructive mode; the author switched their release flow to LXD.
Resolution: closed not a bug
Reason: Maintainer @lengau closed the issue stating no features are planned for destructive mode because it is for development/debugging only and can produce artifacts differing from managed mode. No code change was made; the author agreed and moved to using LXD instead of --destructive-mode for release builds.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### What needs to get done
Allow `--destructive-mode` to automatically pick the correct build as the host platform can be determined on multi-base artifacts e.g. charms.
`--destructive-mode` already implies building in the host platform (arch, version) so it could potentially target directly the correct build while still failing if you attempt to use an incorrect build explicitly or if there is no compatible platform with the host.
### Why it needs to get done
Recently I tried to use the [upload-charm](https://github.com/canonical/charming-actions/tree/main/upload-charm) action which does `--destructive-mode`, however, on charms that have multiple bases e.g. 22.04 and 24.04 the action fails because there are multiple builds that match the current platform.
I found a workaround for the above (pre-building the charm) but the build process is already smart enough to reject builds on incorrect platforms so this could be improved to auto-pick (or filter) the correct platform(s) instead, based on host.
It will go from:
```
charmcraft pack --destructive-mode
Multiple builds match the current platform: 'ubuntu@22.04:amd64' and 'ubuntu@24.04:amd64'.
Recommended resolution: Check the "--platform" and "--build-for" parameters.
```
To:
```
# platform implicit e.g ubuntu@22.04:amd64 if running on jammy runner
charmcraft pack --destructive-mode -v
[DEBUG] Only build "ubuntu@22.04:amd64" compatible with host
[DEBUG] Ignoring "ubuntu@24.04:amd64" build plan(s).
```
Rejection should still be made if targeting an incorrect platform explicitly:
```
charmcraft pack --destructive-mode --platform ubuntu@24.04:amd64
Ubuntu 24.04 builds cannot be performed on this Ubuntu 22.04 system.
```
If this is in fact something worth to consider that could be easily achieved (without major implications to other craft products) I'm happy to take on this one!
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed not a bug | Enhancement request to auto-select the host-compatible build under --destructive-mode was declined: @lengau closed it as not planned, discouraging destructive mode; the author switched their release flow to LXD. | |
| stealth/space-bunny-alpha | — | closed not a bug | Enhancement rejected: maintainers said destructive mode will not gain automatic build selection and discouraged its use; the author switched release builds to LXD. | |
| qwen/qwen3.6-35b-a3b |
Impact:
35
Quick Win:
15
Complexity:
45
Confidence:
75
Actionability:
80
|
needs triage | Feature request to auto-select the correct build platform when using --destructive-mode with multi-base artifacts like charms. |
Update history
| Date | Change |
|---|---|
| updated | |
| closed | |
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #57 Add "destructive" mode | craft-application | closed | Added support for --destructive-mode in commit c0dd21a3, delivering the requested in-host build feature parity. |