← Back to issue list

charmcraft.yaml deleted while packing (working tree not clean)

View original Github issue

Metadata

Project
charmcraft
Number
#2273
Type
issue
State
open
Author
carlcsaposs-canonical
Labels
—
Created
Updated
Closed
—

Current evaluation

Packing a Charmcraft 3.4.3 reproducer deletes tracked charmcraft.yaml before a dump part, making git describe --dirty tag release builds incompatible; untriaged and apparently unresolved

Suggested action: needs triage

Reason: The report is valid and consequential for release compatibility metadata: git status explicitly shows charmcraft.yaml deleted and git describe --dirty adds -dirty. However, it has no labels, maintainer response, or triage activity; current AppMetadata still excludes charmcraft.yaml from part sources, so the build-part source-handling path needs investigation.

Evaluated by: mr-cal-bot

Impact: 56 Quick Win: 25 Complexity: 48 Confidence: 87 Actionability: 86

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
stealth/space-bunny-alpha
Impact: 56
Quick Win: 25
Complexity: 48
Confidence: 87
Actionability: 86
needs triage Packing a Charmcraft 3.4.3 reproducer deletes tracked charmcraft.yaml before a dump part, making git describe --dirty tag release builds incompatible; untriaged and apparently unresolved
qwen/qwen3.6-35b-a3b
Impact: 50
Quick Win: 16
Complexity: 60
Confidence: 60
Actionability: 80
needs triage charmcraft.yaml deleted during packing, causing git describe --dirty to report dirty working tree; issue is open with no maintainer response or labels
qwen/qwen3.8-27b
Impact: 50
Quick Win: 22
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.

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 Repacking reuses the part's build container, so files deleted from the working tree linger in the resulting charm until `charmcraft clean <part>`. Maintainers confirmed it still reproduces; root cause tracked upstream in craft-parts#851.
75%
#693 Charms packed using the reactive plugin shows dirty version charmcraft closed Fixed in merged PR #777 (CRAFT-928): reactive packing now leaves charmcraft.yaml in place, preventing charm build from adding a -dirty version.
73%
#1160 `charmcraft pack` does not recognize updated `charmcraft.yaml` file charmcraft open Tracked upstream: charmcraft pack ignores build-snaps channel changes in charmcraft.yaml unless clean is run. Root cause is craft-parts#496 (build-snaps missing from properties_of_interest), still unfixed; charmcraft only needs a craft-parts bump once patched.
71%