← Back to issue list

Unable to build a charm using the dump plugin

View original Github issue

Metadata

Project
charmcraft
Number
#590
Type
issue
State
closed
Author
wolsen
Labels
—
Created
Updated
Closed

Current evaluation

Implicit charm part was merged into user-defined 'charm' part, adding invalid charm-entrypoint/charm-requirements keys. Fixed by PR #596 (merge commit 0dacae0a, CRAFT-633) which skips the implicit part when a parts: section exists.

Resolution: closed resolved

Reason: Maintainer cmatsuoka pointed to PR #596, which was merged (merge commit 0dacae0a, commit bcbdd278) and made charmcraft skip creating the implicit charm/bundle part when an explicit parts section is given, so the dump plugin no longer inherits charm-entrypoint/charm-requirements defaults.

Evaluated by: mr-cal-bot

No scores available.

Issue body

When attempting to use the dump plugin for a classic charm, I get an error indicating that validation failed due to extra fields that are not permitted. ``` $ charmcraft build Packing charm 'ceph-mon_ubuntu-20.04-amd64.charm'... Part 'charm' validation failed. - extra field 'charm-entrypoint' not permitted - extra field 'charm-requirements' not permitted Review part 'charm' and make sure it's correct. (full execution logs in '/tmp/charmcraft.log') Failed to build charm for bases index '0'. (full execution logs in '/home/wolsen/snap/charmcraft/common/charmcraft-log-_k6m7d44') ``` My charmcraft.yaml file looks as follows: ```yaml type: charm parts: charm: plugin: dump source: . prime: - actions/* - files/* - hooks/* - lib/* - templates/* - actions.yaml - config.yaml - copyright - hardening.yaml - icon.svg - LICENSE - Makefile - metadata.yaml - README.md build-packages: - python3-dev bases: - name: ubuntu channel: "20.04" architectures: - amd64 ``` If interested, the classic charm with this change is [in this repository](https://github.com/wolsen/charm-ceph-mon/tree/charmcraft) (charmcraft branch). Relevant part from the logs (below) appears to indicate that while the plugin did change to dump, the charm-requirements and charm-entrypoints are left behind with the default values. However, when validating the dump plugin does not define those as valid parameters, which causes the build to fail: ``` 2021-11-04 18:58:06,608 charmcraft.providers DEBUG Logs captured from managed instance: mm 2021-11-05 01:58:06,147 charmcraft.guard DEBUG Starting charmcraft version 1.2.1 mm 2021-11-05 01:58:06,148 charmcraft.main DEBUG Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'project_dir': None} filtered=['pack', '--bases-index', '0'] mm 2021-11-05 01:58:06,159 charmcraft.main DEBUG General parsed sysargs: command='pack' args=['--bases-index', '0'] mm 2021-11-05 01:58:06,161 charmcraft.main DEBUG Command parsed sysargs: Namespace(bases_index=[0], destructive_mode=False, entrypoint=None, force=False, requirement=None) mm 2021-11-05 01:58:06,162 charmcraft.commands.pack DEBUG Working arguments: {'from': PosixPath('/root/project'), 'destructive_mode': False, 'entrypoint': None, 'requirement': [], 'bases_indices': None, 'force': False} mm 2021-11-05 01:58:06,162 charmcraft.metadata DEBUG Parsing '/root/project/metadata.yaml' mm 2021-11-05 01:58:06,171 charmcraft.commands.build DEBUG Building for 'bases[0]' as host matches 'build-on[0]'. mm 2021-11-05 01:58:06,171 charmcraft.commands.build DEBUG Building charm in '/root/project/build' mm 2021-11-05 01:58:06,171 charmcraft.commands.build DEBUG Parts definition: {'charm': {'plugin': 'dump', 'source': '/root/project', 'prime': ['actions/*', 'files/*', 'hooks/*', 'lib/*', 'templates/*', 'actions.yaml', 'config.yaml', 'copyright', 'hardening.yaml', 'icon.svg', 'LICENSE', 'Makefile', 'metadata.yaml', 'README.md', 'src', 'venv', 'metadata.yaml', 'dispatch', 'hooks', 'config.yaml', 'actions.yaml', 'templates', 'lib', 'LICENSE', 'icon.svg', 'README.md'], 'build-packages': ['python3-dev'], 'charm-requirements': ['requirements.txt'], 'charm-entrypoint': 'src/charm.py'}} mm 2021-11-05 01:58:06,172 craft_parts.utils.os_utils DEBUG is_snap: True, SNAP_NAME set to charmcraft mm 2021-11-05 01:58:06,172 craft_parts.infos DEBUG Setting target machine to x86_64 mm 2021-11-05 01:58:06,172 charmcraft ERROR Part 'charm' validation failed. - extra field 'charm-entrypoint' not permitted - extra field 'charm-requirements' not permitted Review part 'charm' and make sure it's correct. (full execution logs in '/tmp/charmcraft.log') ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Implicit charm part was merged into user-defined 'charm' part, adding invalid charm-entrypoint/charm-requirements keys. Fixed by PR #596 (merge commit 0dacae0a, CRAFT-633) which skips the implicit part when a parts: section exists.
stealth/space-bunny-alpha — closed resolved Builds failed because explicit parts were augmented with implicit charm defaults; PR #596 fixed implicit part creation and resolved the dump-plugin validation error.
qwen3.6-35b-a3b-mtp-q6 — — Build validation failed due to leftover default fields when using the dump plugin. Resolved by PR #596, which updated part handling to prevent these extra fields from causing validation errors.
qwen/qwen3.6-35b-a3b — — Fixed by PR #596. The dump plugin validation error from leftover charm-entrypoint and charm-requirements fields was resolved by updating part handling to prevent unsupported fields from persisting.
qwen3.6-35b-a3b-mtp-q6 — — Fixed in PR #596. The dump plugin previously failed validation due to leftover default fields like charm-entrypoint and charm-requirements. The update resolves the validation error, enabling successful classic charm builds.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#596 (confidence 97%)

    PR 'build: don't create implicit part if parts section specified (CRAFT-633)' merged as 0dacae0a; cited by cmatsuoka as the fix

Related issues

Issue Project State Summary Similarity
#596 build: don't create implicit part if parts section specified (CRAFT-633) charmcraft merged PR #596 merged (merge commit 0dacae0a, bcbdd278) by cmatsuoka: charmcraft now skips the implicit `charm`/`bundle` part when an explicit `parts:` section exists (CRAFT-633), fixing #590; tests added.
76%
#1616 Default `charm` or `bundle` part is not added if `parts` is defined but empty in `charmcraft.yaml`. charmcraft closed Fixed by merged PR canonical/charmcraft#1815 (commit 2a0eb973), correcting default charm/bundle part handling in charmcraft.yaml.
71%
#215 fix(charm): accept redundant multi-base charms craft-platforms merged Merged PR #215 as commit 4879309, allowing redundant multi-base charms when they produce equivalent valid build plans and addressing canonical/charmcraft#2620.
70%