`CRAFT_SHARED_CACHE` broken or ignored in charmcraft 3.1
Metadata
Current evaluation
Fixed in merged PR canonical/charmcraft#1763 (commit e0eaee74), which forwards the host shared-cache path to the build provider so CRAFT_SHARED_CACHE is populated and reused.
Resolution: closed resolved
Reason: PR canonical/charmcraft#1763 was merged as commit e0eaee74. It fixes provider cache-path forwarding, restoring population and reuse of CRAFT_SHARED_CACHE.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
`CRAFT_SHARED_CACHE` appears to be broken in charmcraft 3.1
charmcraft ignores wheels in `CRAFT_SHARED_CACHE` and doesn't appear to populate `CRAFT_SHARED_CACHE` after running a pack
### To Reproduce
Reproduce issue with `CRAFT_SHARED_CACHE` not being populated
```
$ git clone https://github.com/canonical/mysql-router-k8s-operator/
$ cd mysql-router-k8s-operator
$ sudo snap install charmcraft --channel candidate --classic
charmcraft (candidate) 3.1.1 from Canonical✓ installed
$ ls ~/snap/
lxd
$ tox run -e build-production -- -v
[...]
$ ls ~/snap/charmcraft/common/cache/charmcraft/ -a
. ..
```
Reproduce issue with wheels in `CRAFT_SHARED_CACHE` being ignored
```
$ git clone https://github.com/canonical/mysql-router-k8s-operator/
$ cd mysql-router-k8s-operator
$ sudo snap install charmcraft --channel candidate --classic
charmcraft (candidate) 3.1.1 from Canonical✓ installed
$ tox run -e build-dev -- -v
[...]
# Charmcraft builds wheels from source when it should use already built wheels
```
### Environment
Ubuntu 22.04
### charmcraft.yaml
```shell
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
type: charm
bases:
- name: ubuntu
channel: "22.04"
architectures: [amd64]
- name: ubuntu
channel: "22.04"
architectures: [arm64]
parts:
charm:
override-pull: |
craftctl default
if [[ ! -f requirements.txt ]]
then
echo 'ERROR: Use "tox run -e build-dev" instead of calling "charmcraft pack" directly' >&2
exit 1
fi
charm-strict-dependencies: true
charm-entrypoint: src/kubernetes_charm.py
prime:
- charm_version
- workload_version
- scripts
build-packages:
- libffi-dev
- libssl-dev
- pkg-config
- rustc
- cargo
```
### Relevant log output
For issue with `CRAFT_SHARED_CACHE` not being populated
[terminal_output_no_cache.txt](https://github.com/user-attachments/files/16372863/terminal_output_no_cache.txt)
[charmcraft-20240725-074836.719086.log](https://github.com/user-attachments/files/16372866/charmcraft-20240725-074836.719086.log)
For issue with wheels in `CRAFT_SHARED_CACHE` being ignored
[terminal_output_cache.txt](https://github.com/user-attachments/files/16373073/terminal_output_cache.txt)
[charmcraft-20240725-081921.214270.log](https://github.com/user-attachments/files/16373080/charmcraft-20240725-081921.214270.log)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed in merged PR canonical/charmcraft#1763 (commit e0eaee74), which forwards the host shared-cache path to the build provider so CRAFT_SHARED_CACHE is populated and reused. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR canonical/charmcraft#1763 (commit e0eaee74), forwarding the shared-cache path into the build provider so CRAFT_SHARED_CACHE is honored. | |
| stealth/space-bunny-alpha | — | closed stale | Report of CRAFT_SHARED_CACHE being neither populated nor reused in Charmcraft 3.1 was closed without a fix, comment, or replacement reference. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution or comments. The reported CRAFT_SHARED_CACHE bug in charmcraft 3.1 appears abandoned, with no fix or follow-up activity recorded. | |
| qwen/qwen3.6-35b-a3b | — | — | Abandoned. CRAFT_SHARED_CACHE population and wheel caching issues in charmcraft 3.1 remain unaddressed due to inactivity. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without documented resolution. The report details CRAFT_SHARED_CACHE failing to populate or ignore cached wheels in charmcraft 3.1, but no fix or follow-up action was recorded. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without comments or resolution. The CRAFT_SHARED_CACHE population and wheel caching issues in charmcraft 3.1 appear abandoned. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#1763
(confidence 100%)
Merged fix forwarding the shared-cache path into the build provider.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1888 fix: lock shared cache directory | charmcraft | merged | Merged PR #1888 in commit 4cce11b0, locking Charmcraft's shared cache to prevent concurrent-build cache races; fixes #1845. | |
| #1993 Shared cache doesn't work with poetry plugin | charmcraft | closed | Shared-cache handling was fixed by merged PR canonical/charmcraft#2046 (commit 73a7996a), aligning provider cache directories for the Poetry plugin. | |
| #1270 feat(pack): add shared cache support | charmcraft | merged | Merged PR #1270 (commit f2353279) added default shared pip caching for pack, using ~/.cache/charmcraft and honoring CRAFT_SHARED_CACHE, fixing #1256. | |
| #1763 fix(provider): forward shared cache | charmcraft | merged | Merged PR #1763 (commit e0eaee74) forwards the provider shared-cache path, restoring CRAFT_SHARED_CACHE handling and fixing #1762. | |
| #1752 Document `CRAFT_SHARED_CACHE` | charmcraft | closed | Closed as a duplicate of #1431; CRAFT_SHARED_CACHE documentation was later merged in #1989 via commit 406fdb44. |