← Back to issue list

`charmcraft analyze` - check for invalid `config.yaml`

View original Github issue

Metadata

Project
charmcraft
Number
#547
Type
issue
State
closed
Author
jnsgruk
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by merged PR canonical/charmcraft#556 (a585aec6): charm packing now rejects an existing config.yaml without the required top-level options dictionary.

Resolution: closed resolved

Reason: PR #556 added Juju YAML validation and was merged in commit a585aec6, causing analysis to reject invalid config.yaml files before packing.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Follow on from [canonical/operator#618](https://github.com/canonical/operator/pull/618). At present, it is possible to successfully `charmcraft pack` on a charm with an empty `config.yaml`, i.e. one that does not contain an `options:` map. Given that Juju will refuse to deploy a charm with such a `config.yaml`, we should probably try to catch this using the `charmcraft analyze` machinery that is invoked when a charm is packed. As I understand, you can completely omit `config.yaml`, but if it exists it must have a top level key named `options`.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by merged PR canonical/charmcraft#556 (a585aec6): charm packing now rejects an existing config.yaml without the required top-level options dictionary.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #556 (merge commit a585aec6): Charmcraft now rejects an existing config.yaml without the required top-level options dictionary, matching Juju’s requirements.
qwen3.6-35b-a3b-mtp-q6 — — Closed after consensus to validate config.yaml content. Charmcraft will fail if the file lacks the required options: map, aligning with Juju's deployment requirements.
qwen/qwen3.6-35b-a3b — — Closed after consensus to fail charmcraft analyze if config.yaml lacks an options map, aligning with Juju. Validation rules were agreed upon, but the issue was not fixed or linked to a follow-up PR.
qwen/qwen3.6-35b-a3b — — Closed without implementation after agreeing charmcraft should validate config.yaml to match Juju's behavior. The team decided to enforce that existing config.yaml files must contain an options map, rejecting dynamic file inclusion based on content.
qwen3.6-35b-a3b-mtp-q6 — — Closed with a decision to implement validation of config.yaml contents in charmcraft analyze. The team agreed to fail the build if the file exists but lacks the required options map, aligning charmcraft behavior with Juju deployment requirements.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#556 (confidence 100%)

    Merged PR implementing config.yaml and actions.yaml validation.

  • Related To: canonical/charmcraft#310 (confidence 98%)

    Earlier YAML-validation issue that was reopened and ultimately addressed by the same PR.

Related issues

No related issues found above the similarity threshold.