build-for architecture 'all' for arch-independent charms not supported
Metadata
Current evaluation
Support for build-for: all landed in #1894 (f1755e8f), with architecture-independent charm tests merged in #1895 (f136def1).
Resolution: closed resolved
Reason: Merged PR #1894, commit f1755e8f, moved build-plan generation to craft-platforms, enabling build-for: all. PR #1895, commit f136def1, added dedicated tests for architecture-independent charms and resolved #1698.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
The following should be a valid platform description for a charm:
```yaml
platforms:
all:
build-on: [amd64]
build-for: [all]
```
When included, the user should receive a warning from charmcraft that it does not validate that charms are architecture independent but allow the charm to build anyway.
### To Reproduce
`charmcraft pack`
### Environment
n/a
### charmcraft.yaml
```shell
type: charm
base: ubuntu@24.04
platforms:
all:
build-on:
- amd64
build-for: all
parts:
charm:
plugin: dump
source: .
```
### Relevant log output
```shell
2024-06-10 14:22:40.681 Starting charmcraft, version 3.0.0.post46+ga44c03e
2024-06-10 14:22:40.681 Log verbosity level set to BRIEF
2024-06-10 14:22:40.681 Configuring application...
2024-06-10 14:22:40.681 Preparing application...
2024-06-10 14:22:40.682 Build plan: platform=None, build_for=None
2024-06-10 14:22:40.683 Loading project file '/home/lengau/Work/Code/charm-nova-compute/charmcraft.yaml'
2024-06-10 14:22:40.684 Warning: use of 'prime' in a charm part is deprecated and no longer works, see https://juju.is/docs/sdk/include-extra-files-in-a-charm
2024-06-10 14:22:40.715 Architecture 'all' is not supported.
2024-06-10 14:22:40.716 Traceback (most recent call last):
2024-06-10 14:22:40.716 File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_application/application.py", line 508, in run
2024-06-10 14:22:40.716 self.services.project = self.get_project(
2024-06-10 14:22:40.716 File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_application/application.py", line 303, in get_project
2024-06-10 14:22:40.716 yaml_data = self._transform_project_yaml(yaml_data, build_on, build_for)
2024-06-10 14:22:40.716 File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_application/application.py", line 601, in _transform_project_yaml
2024-06-10 14:22:40.716 self._expand_environment(yaml_data=yaml_data, build_for=build_for)
2024-06-10 14:22:40.716 File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_application/application.py", line 629, in _expand_environment
2024-06-10 14:22:40.716 info = craft_parts.ProjectInfo(
2024-06-10 14:22:40.716 File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_parts/infos.py", line 99, in __init__
2024-06-10 14:22:40.716 self._set_machine(arch)
2024-06-10 14:22:40.716 File "/snap/charmcraft/3838/lib/python3.10/site-packages/craft_parts/infos.py", line 333, in _set_machine
2024-06-10 14:22:40.716 raise errors.InvalidArchitecture(arch)
2024-06-10 14:22:40.716 craft_parts.errors.InvalidArchitecture: Architecture 'all' is not supported.
2024-06-10 14:22:40.716 Make sure the architecture name is correct.
2024-06-10 14:22:40.716 Recommended resolution: Make sure the architecture name is correct.
2024-06-10 14:22:40.716 Full execution log: '/home/lengau/.local/state/charmcraft/log/charmcraft-20240610-142240.681125.log'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Support for build-for: all landed in #1894 (f1755e8f), with architecture-independent charm tests merged in #1895 (f136def1). | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by switching build-plan generation to craft-platforms in PR #1894 (f1755e8f); architecture-independent charm tests were added in PR #1895 (f136def1). | |
| stealth/space-bunny-alpha | — | closed resolved | Support for `build-for: all` was added in #1876, with dedicated architecture-independent charm tests added in #1895 (commit f136def1). | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed by PR 1876, which added support for build-for all in charmcraft. The issue was closed after the feature was merged and corresponding tests were implemented. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved via #1876. The fix addresses the build-for: [all] architecture error for arch-independent charms, with additional tests added to validate the implementation. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as superseded by issue #1876. Support for build-for: [all] will be implemented alongside that PR, with tests added here. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Deferred to PR #1876. The maintainer stated the fix will be implemented when that pull request is merged, with additional tests planned. Closed as superseded. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#1895
(confidence 100%)
Merged tests specifically covering architecture-independent charms built with build-for: all.
-
Likely Fixed By:
canonical/charmcraft#1894
(confidence 98%)
Merged build-plan refactor that enabled the all destination architecture.
-
Related To:
canonical/charmcraft#1876
(confidence 95%)
Maintainer identified this broader craft-platforms migration as the implementation dependency.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1895 tests: check that architecture "all" works | charmcraft | merged | Merged as f136def1, adding tests for architecture-independent charms using build-for: all and fixing #1698; prerequisite #1894 was merged. | |
| #1818 fix(lifecycle): allow building multi-arch charms | charmcraft | merged | Merged to main as commit c787ea23 (PR #1818), letting Charmcraft's lifecycle builds handle charms with multiple run-on architectures; landed alongside Ruff 0.6.0 fixes from #1825. Fixes #1697. | |
| #360 Allow build-for "all" for platform-independent builds. | craft-application | closed | Merged PR #365 to support build-for [all] for platform-independent builds, including validation, an application-level opt-out, and tests; resolved #360 and CRAFT-3016. |