← 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
2025-04-28 13:40:14+00:00
Updated
2025-08-15 15:17:50+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

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

No evaluation history available.