← Back to issue list

Shared cache doesn't work with poetry plugin

View original Github issue

Metadata

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

Current evaluation

Shared-cache handling was fixed by merged PR canonical/charmcraft#2046 (commit 73a7996a), aligning provider cache directories for the Poetry plugin.

Resolution: closed resolved

Reason: PR #2046 was merged as commit 73a7996a with the message “fix: use the same cache directory in providers.” It ensures Poetry's pip cache uses the shared provider cache.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description Using charmcraft with the poetry plugin doesn't use the pip wheel cache on the LXC host machine ### To Reproduce ```bash git clone https://github.com/canonical/mysql-router-k8s-operator cd mysql-router-k8s-operator git checkout 1940ada229f9d873b7b07f6c3af66493c37cb15a mkdir ~/foocache/ CRAFT_SHARED_CACHE=/home/ubuntu/foocache/ charmcraft pack -v ls -a ~/foocache/charmcraft-buildd-base-v7/BuilddBaseAlias.JAMMY/pip/ ``` pip directory is empty ### Environment Ubuntu 22.04 ``` $ snap list Name Version Rev Tracking Publisher Notes charmcraft 3.2.2.post75+gff00a899 5394 3.x/edge canonical✓ classic,held core18 20240920 2846 latest/stable canonical✓ base core20 20240911 2434 latest/stable canonical✓ base core22 20241001 1663 latest/stable canonical✓ base juju 3.5.4 28520 3/stable canonical✓ - lxd 5.0.3-80aeff7 29351 5.0/stable/… canonical✓ - microk8s v1.29.9 7227 1.29-strict/stable canonical✓ - snapd 2.63 21759 latest/stable canonical✓ snapd ``` ### charmcraft.yaml ```yaml # 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: poetry-deps: plugin: nil build-packages: - curl override-build: | python3 -m pip install --upgrade pip==24.3.1 curl -sSL https://install.python-poetry.org | python3 - --version 1.8.4 ln -sf $HOME/.local/bin/poetry /usr/local/bin/poetry foo: plugin: poetry source: . after: - poetry-deps poetry-with: - charm-libs build-snaps: - rustup build-packages: - libffi-dev - libssl-dev - pkg-config override-build: | rustup default stable craftctl default # # files: # plugin: dump # source: . # build-packages: # - git # override-build: | # # Workaround to add unique identifier (git hash) to charm version while specification # # DA053 - Charm versioning # # (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1) # # is pending review. # python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")' # # craftctl default # stage: # # Exclude requirements.txt file during staging # # Workaround for https://github.com/canonical/charmcraft/issues/1389 on charmcraft 2 # - -requirements.txt # prime: # - charm_version # - workload_version # - scripts # charm: # build-snaps: # - rustup # build-packages: # - libffi-dev # - libssl-dev # - pkg-config # override-build: | # rustup default stable # # # Convert subset of poetry.lock to requirements.txt # curl -sSL https://install.python-poetry.org | python3 - # /root/.local/bin/poetry export --only main,charm-libs --output requirements.txt # # craftctl default # stage: # # Exclude charm_version file during staging # - -charm_version # charm-strict-dependencies: true # charm-requirements: [requirements.txt] # charm-entrypoint: src/kubernetes_charm.py ``` ### Relevant log output [charmcraft-20241115-101114.717652.log](https://github.com/user-attachments/files/17774119/charmcraft-20241115-101114.717652.log)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Shared-cache handling was fixed by merged PR canonical/charmcraft#2046 (commit 73a7996a), aligning provider cache directories for the Poetry plugin.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #2046 (commit 73a7996a), unifying provider cache directories so snap XDG_CACHE_DIR no longer overrides /root/.cache.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #2046 (commit 73a7996a), which unified provider cache directories so snap XDG_CACHE_DIR no longer overrides /root/.cache.
stealth/space-bunny-alpha — closed superseded Identified as an upstream craft-providers cache-path bug, not a poetry-plugin defect; tracked internally as CRAFT-3698 and closed without a Charmcraft code fix.
qwen3.6-35b-a3b-mtp-q6 — — Closed. Identified as a craft-providers bug where the poetry plugin uses the snap cache directory instead of the standard path. Deferred to upstream craft-providers for a fix. Internal ticket CRAFT-3698 created.
qwen/qwen3.6-35b-a3b — — Closed and deferred to upstream craft-providers after identifying the poetry plugin incorrectly uses the snap cache directory. An internal ticket tracks the required fix to include the snap cache in the provider environment.
qwen/qwen3.6-35b-a3b — — Closed and tracked internally as CRAFT-3698. The poetry plugin ignores the shared cache directory, defaulting to a hardcoded path. Resolution requires updating craft-providers to generalize environment handling and properly mount the shared cache.
qwen3.6-35b-a3b-mtp-q6 — — Closed. The shared cache path mismatch for the poetry plugin is deferred to craft-providers, which will add the snap cache directory to the cache disk to resolve the pip wheel caching issue.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#2046 (confidence 99%)

    Commit 73a7996a changes provider cache handling and directly addresses the empty shared pip cache reported in #1993.

Related issues

Issue Project State Summary Similarity
#1762 `CRAFT_SHARED_CACHE` broken or ignored in charmcraft 3.1 charmcraft closed 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.
73%