charmcraft.yaml deleted while packing (working tree not clean)
Metadata
Current evaluation
charmcraft pack deletes charmcraft.yaml from the working tree, making git describe --dirty report -dirty on clean release builds. Reported with charmcraft 3.4.3, no maintainer response or labels in ~13 months.
Suggested action: needs triage
Reason: No labels, no comments, and no maintainer interaction since filing 490 days ago, so it has never been triaged. The bug is real and reproducible (dedicated repro repo, charmcraft 3.4.3) and affects release workflows relying on git describe --dirty, but I found no fix commit or related PR in the repo, so it should stay open pending triage rather than being closed as stale.
Impact:
50
Quick Win:
22.5
Staleness:
75
Complexity:
55
Confidence:
55
Support Request:
5
Issue body
### Bug Description
### Expected behavior
When `git describe` is ran in a charmcraft.yaml part, the working tree is clean
```
:: + git status
:: On branch main
:: Your branch is up to date with 'origin/main'.
::
:: nothing to commit, working tree clean
:: + git describe --dirty
:: v14/1.0.0
```
### Actual behavior
When `git describe` is ran in a charmcraft.yaml part, the `charmcraft.yaml` file has been deleted
```
:: + git status
:: On branch main
:: Your branch is up to date with 'origin/main'.
::
:: Changes not staged for commit:
:: (use "git add/rm <file>..." to update what will be committed)
:: (use "git restore <file>..." to discard changes in working directory)
:: deleted: charmcraft.yaml
::
:: no changes added to commit (use "git add" and/or "git commit -a")
:: + git describe --dirty
:: v14/1.0.0-dirty
```
### Impact
On the data charms, we create a git tag with a [refresh compatibility version](https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1&tab=t.0) at release time (i.e. after merge, before build). We use `git describe --dirty` so that if a customer accidentally deploys a development/modified build, the refresh is marked as incompatible. Release builds (with no changes from what is committed) should not be getting marked as dirty
### To Reproduce
```
git clone https://github.com/carlcsaposs-canonical/bug-report-charmcraft-deletes-charmcraft-yaml
cd bug-report-charmcraft-deletes-charmcraft-yaml/
charmcraft pack -v
```
### Environment
Ubuntu 24
Charmcraft 3.4.3
### charmcraft.yaml
```yaml
type: charm
platforms:
ubuntu@22.04:amd64:
parts:
poetry-deps:
plugin: nil
build-packages:
- curl
override-build: |
PIP_BREAK_SYSTEM_PACKAGES=true python3 -m pip install --user --upgrade pip==25.0.1 # renovate: charmcraft-pip-latest
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.6.13/uv-installer.sh | sh # renovate: charmcraft-uv-latest
"$HOME/.local/bin/uv" tool install --no-python-downloads --python '>=3.9' poetry==2.1.2 --with poetry-plugin-export==1.9.0 # renovate: charmcraft-poetry-latest
ln -sf "$HOME/.local/bin/poetry" /usr/local/bin/poetry
charm-poetry:
plugin: poetry
source: .
after:
- poetry-deps
files:
plugin: dump
source: .
build-packages:
- git
override-build: |
git status
git describe --dirty
craftctl default
```
### Relevant log output
```shell
See above
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.8-27b |
Impact:
50
Quick Win:
22.5
Staleness:
75
Complexity:
55
Confidence:
55
Support Request:
5
|
needs triage | charmcraft pack deletes charmcraft.yaml from the working tree, making git describe --dirty report -dirty on clean release builds. Reported with charmcraft 3.4.3, no maintainer response or labels in ~13 months. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
90
Complexity:
40
Confidence:
85
Support Request:
10
|
needs triage | charmcraft pack unexpectedly deletes charmcraft.yaml during build, causing git describe to report a dirty state. Untriaged, no maintainer response. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
90
Complexity:
45
Confidence:
85
Support Request:
10
|
needs triage | Bug report where charmcraft pack unexpectedly deletes the charmcraft.yaml file during the build process, causing git to report a dirty working tree. Unlabeled, no maintainer response, inactive for over a year. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
92
Complexity:
35
Confidence:
70
Support Request:
10
|
needs triage | charmcraft pack deletes charmcraft.yaml during build, causing git describe to report a dirty working tree. Unlabelled, no maintainer response, open for over a year. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
85
Complexity:
45
Confidence:
75
Support Request:
10
|
needs triage | charmcraft pack unexpectedly deletes charmcraft.yaml during builds, causing false dirty git status and breaking release compatibility checks. Open, untriaged, inactive for 300+ days, zero comments, awaiting triage. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #710 `charmcraft pack` retains no longer existing files from previous packs | charmcraft | open | charmcraft pack includes files deleted from the working directory in the charm archive; clean fixes it. Triaged as a known bug, re-confirmed present in Oct 2024, upstream craft-parts bug filed, per-part clean workaround documented. | |
| #1530 Changing charmcraft.yaml doesn't update the resulting charm's metadata.yaml | charmcraft | open | Bug: editing charmcraft.yaml then re-running `charmcraft pack` does not update the resulting charm's metadata.yaml. Filed by a maintainer (lengau); last comment (2024-09-09) says it's unclear if still reproducible. Related open craft-application#821 describes the same 'Already packed' skip behavior. | |
| #693 Charms packed using the reactive plugin shows dirty version | charmcraft | closed | Fixed by modifying the reactive plugin to stop removing charmcraft.yaml before building. This prevented git describe from incorrectly marking packed charm versions as dirty. | |
| #1160 `charmcraft pack` does not recognize updated `charmcraft.yaml` file | charmcraft | open | charmcraft pack ignores updated build-snaps channel in charmcraft.yaml without a clean; tracked as a craft-parts bug (canonical/craft-parts#496, still open) awaiting a dependency patch release to pull into charmcraft. | |
| #2707 Charmcraft confuses the current directory with the project directory when both has a charmcraft.yaml | charmcraft | open | Regression in charmcraft 4.2.1 where 'charmcraft pack -p' fails if both CWD and project directory contain charmcraft.yaml. Untriaged, 101 days old. | |
| #501 charmcraft pack fails trying to include a non-existing charm/src/.tox/ | charmcraft | closed | charmcraft pack failed when copying non-existent build directories or files. Users worked around it with charmcraft clean. The issue was closed as fixed upstream in the underlying parts lifecycle code. |