← Back to issue list

Do not ignore symlinks to external files

View original Github issue

Metadata

Project
charmcraft
Number
#1079
Type
issue
State
open
Author
sed-i
Labels
Created
Updated
Closed

Current evaluation

Request to include symlinks pointing outside the charm project directory in packed charms (monorepo shared files). Behavior is intentional and tested; a recent experimental monorepo build-root feature (PR #2836) may address the underlying use case.

Suggested action: keep open

Reason: Maintainer @lengau (2024-09-20) triaged this as a complex craft-parts/craft-providers interaction where the build container cannot access links outside the project dir, and @luissimas (2024-12-04) confirmed an active monorepo use case. The ignore behavior is intentional and tested (charm_builder.py:117, test_build_generics_symlink_*_outside), so it is not a bug, but the recent CHARMCRAFT_EXPERIMENTAL_MONOREPO feature (#2836) suggests the project is actively working toward supporting this, so it should stay open.

Impact: 50 Quick Win: 12.5 Staleness: 35 Complexity: 75 Confidence: 60 Support Request: 20

Issue body

I have a hybrid machine/k8s repo with symlinks to shared files, instead of duplicating them: ``` . ├── common │   └── src │   ├── grafana_agent.py │   ├── grafana_dashboards │   ├── loki_alert_rules │   └── prometheus_alert_rules ├── k8s │   └── src │      ├── charm.py │      ├── grafana_agent.py -> ../../common/src/grafana_agent.py │      ├── grafana_dashboards -> ../../common/src/grafana_dashboards │      ├── loki_alert_rules -> ../../common/src/loki_alert_rules │      └── prometheus_alert_rules -> ../../common/src/prometheus_alert_rules └── machine └── src    ├── charm.py    ├── grafana_agent.py -> ../../common/src/grafana_agent.py    ├── grafana_dashboards -> ../../common/src/grafana_dashboards    ├── loki_alert_rules -> ../../common/src/loki_alert_rules    └── prometheus_alert_rules -> ../../common/src/prometheus_alert_rules ``` But `charmcraft pack` ignores them: ``` $ unzip -l grafana-agent_ubuntu-22.04-amd64_ubuntu-20.04-amd64.charm | grep 'src/' 17293 2023-04-17 18:47 src/charm.py ``` Would it be possible for charmcraft to include symlinks to "external" files in the `*.charm`? Related: https://github.com/canonical/charmcraft/issues/29

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 12.5
Staleness: 35
Complexity: 75
Confidence: 60
Support Request: 20
keep open Request to include symlinks pointing outside the charm project directory in packed charms (monorepo shared files). Behavior is intentional and tested; a recent experimental monorepo build-root feature (PR #2836) may address the underlying use case.
qwen/qwen3.6-35b-a3b
Staleness: 75
Complexity: 75
Confidence: 85
Support Request: 20
needs triage Feature request to include symlinks to external files in charmcraft packs. Currently ignored due to container build isolation. Lacks labels and maintainer categorization.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 75
Confidence: 60
Support Request: 20
keep open Request to include symlinks to external files in charmcraft pack output. Maintainers identified it as a cross-tool limitation between craft-parts and craft-providers regarding out-of-project symlinks in build containers. Still open with no resolution.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 80
Confidence: 60
Support Request: 30
keep open Request to include symlinks to external files in charmcraft packaging. Identified as a cross-tool limitation with craft-parts/craft-providers regarding build container access. Currently open with no resolution.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 80
Confidence: 85
Support Request: 10
keep open charmcraft pack ignores symlinks outside the project directory, breaking monorepo workflows. Build containers lack external path access, making this a craft-parts and craft-providers issue.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#29 (confidence 85%)

    Explicitly cross-referenced in the issue body; earlier symlink/hardlink handling in the build directory.

  • Related To: canonical/charmcraft#2836 (confidence 60%)

    Commit e06d40c1 'feat: opt into git-driven build root via CHARMCRAFT_EXPERIMENTAL_MONOREPO' directly targets the monorepo scenario this issue describes, potentially making external symlinks resolvable.

Related issues

Issue Project State Summary Similarity
#2573 Support referencing sibling directories of project root charmcraft open Feature request to build charms from a monorepo by mounting the whole git repo (sibling dirs like shared-lib) instead of only the charmcraft.yaml dir. Triaged, actively discussed; an experimental git-driven build root (CHARMCRAFT_EXPERIMENTAL_MONOREPO) has since landed.
72%
#260 Can't include symlinked file into built charm charmcraft closed Charmcraft blocked external symlinks for security. The restriction was lifted after adopting snapcraft's build system, which now handles external file inclusion via parts. Issue closed as resolved.
71%