← Back to issue list

Charmcraft confuses the current directory with the project directory when both has a charmcraft.yaml

View original Github issue

Metadata

Project
charmcraft
Number
#2707
Type
issue
State
open
Author
gycsaba96
Labels
Created
2026-05-26 17:00:50+00:00
Updated
2026-05-26 17:00:50+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Check existing issues - [x] I've verified that this bug isn't described by any existing issues. ### Bug description When both the current working directory and the project directory provided by -p contain a charmcraft.yaml, charmcraft gets confused (somehow mixes the two and fails). ### Steps to reproduce 1. Clone and enter `https://github.com/canonical/istio-beacon-k8s-operator.git` 2. Run `charmcraft pack -p ./tests/integration/testers/service-mesh-tester` 3. Observe an error: ``` ubuntu@microk8s-vm:~/istio-beacon-k8s-operator$ charmcraft pack -p ./tests/integration/testers/service-mesh-tester Platform 'ubuntu@22.04:amd64' not found in the project definition. Detailed information: Valid platforms are: 'ubuntu-20.04-amd64'. Failed to run charmcraft in instance Full execution log: '/home/ubuntu/.local/state/charmcraft/log/charmcraft-20260526-184109.244315.log' ``` 4. Run `charmcraft pack` and observe a successful build. 5. Remove the charmcraft file from the current dir: `rm charmcraft.yaml` 6. Run `charmcraft pack -p ./tests/integration/testers/service-mesh-tester` and see it succeed. ### Environment Charmcraft version: 4.2.1 OS: Ubuntu 24.04 (inside my development VM) (It worked before updating from 4.0.1 to 4.2.1) It also fails CI pipelines with a similar setup. ### charmcraft.yaml ```yaml ``` ### Log output ```shell ```

Evaluation history

No evaluation history available.