← Back to issue list

Charm plugin can include unexpected files

View original Github issue

Metadata

Project
charmcraft
Number
#1900
Type
issue
State
open
Author
lengau
Labels
Created
2024-09-13 15:48:49+00:00
Updated
2025-08-15 15:18:11+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Bug Description Currently the charm plugin includes everything from its current directory, whereas it previously (2.x) only included limited items. Changing this behaviour could be complex and breaking, because a user may accidentally depend on this behaviour to include certain files in their charm. Some ideas for minimal impact: 1. The `tests` directory from the template is almost certainly not included intentionally - this is probably fine to break if someone is depending on it. Likewise for `tox.ini` 2. The same for hidden files and directories under the root directory. (Hidden files levels down should be kept as-is). This would remove directories such as `.git`, `.tox`, etc. 3. We could warn about unexpected files in the charm. At an initial glance, this would be anything in the root directory of the charm part's output except: - `actions.yaml`, `charmcraft.yaml`, `config.yaml`, `manifest.yaml`, `metadata.yaml` - `requirements.txt` - `src/` - `lib/` - `venv/` - Files like `CONTRIBUTING`, `LICENSE`, `README`, etc. - `hooks/` - `dispatch` The previous filter: https://github.com/canonical/charmcraft/blob/hotfix/2.7/charmcraft/package.py#L227-L263 ### To Reproduce Add a THIS_SHOULD_NO_BE_INCLUDED file to an existing charm that uses the charm plugin

Evaluation history

No evaluation history available.