← Back to issue list

Do not ignore symlinks to external files

View original Github issue

Metadata

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

Current evaluation

Symlinks to files outside the charm project were skipped during packing. Closed as resolved: PR #2836 (commit e06d40c1) added opt-in CHARMCRAFT_EXPERIMENTAL_MONOREPO, mounting the enclosing git repo root into the build instance; shipped in Charmcraft 4.5 with docs and spread tests.

Resolution: closed resolved

Reason: Maintainer mr-cal closed the issue citing merged PR #2836, commit e06d40c1 "feat: opt into git-driven build root via CHARMCRAFT_EXPERIMENTAL_MONOREPO". That commit introduces const.EXPERIMENTAL_MONOREPO_ENV_VAR, ships tests/spread/commands/git-build-root, and is documented in docs/howto/pack-a-charm-in-a-monorepo.rst plus the 4.5 release notes.

Evaluated by: mr-cal-bot

No scores available.

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
stealth/space-bunny-alpha — closed resolved Symlinks to files outside the charm project were skipped during packing. Closed as resolved: PR #2836 (commit e06d40c1) added opt-in CHARMCRAFT_EXPERIMENTAL_MONOREPO, mounting the enclosing git repo root into the build instance; shipped in Charmcraft 4.5 with docs and spread tests.
stealth/space-bunny-alpha — closed resolved Landed via merged PR #2836 (e06d40c1): opt-in CHARMCRAFT_EXPERIMENTAL_MONOREPO mounts the enclosing git root into the build instance so charms in monorepos can reach shared/symlinked files. Documented in docs/howto/pack-a-charm-in-a-monorepo.rst, released in Charmcraft 4.5.
stealth/space-bunny-alpha — closed resolved External symlinks are now supported through opt-in Git-based monorepo builds. PR #2836 added CHARMCRAFT_EXPERIMENTAL_MONOREPO and was merged in commit e06d40c1.
stealth/space-bunny-alpha — closed resolved Symlinks to files outside the project were ignored because the build container only sees the charmcraft.yaml dir. Fixed by merged PR #2836 (commit e06d40c1), adding opt-in CHARMCRAFT_EXPERIMENTAL_MONOREPO that mounts the git repo root as build root; shipped in Charmcraft 4.5.
stealth/space-bunny-alpha — closed resolved External monorepo file support was added by merged PR #2836 (commit e06d40c1) and released in Charmcraft 4.5 via CHARMCRAFT_EXPERIMENTAL_MONOREPO.
stealth/space-bunny-alpha — closed resolved External symlinks are supported via opt-in git-based build roots; PR #2836 (e06d40c1) added CHARMCRAFT_EXPERIMENTAL_MONOREPO and was merged.
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 12
Complexity: 60
Confidence: 85
Actionability: 75
keep open charmcraft pack ignores symlinks pointing outside the project directory, breaking monorepo setups with shared code. Maintainers identified the root cause in craft-parts/craft-providers container isolation.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 12
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.

Update history

Date Change
updated
closed

Related work

  • Likely Fixed By: canonical/charmcraft#2836 (confidence 97%)

    Merged PR explicitly cited in the closing comment; commit e06d40c1 adds CHARMCRAFT_EXPERIMENTAL_MONOREPO git-root build root.

  • Related To: canonical/charmcraft#2835 (confidence 45%)

    Commit 4dd1ae35 "fix(plugins): use part_build_subdir for charm source copy" landed just before the monorepo work and concerns the same source-copy path.

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

    Original linked request for external/shared file inclusion, referenced in the issue body.

Related issues

Issue Project State Summary Similarity
#131 Respect the symlink even if it's a directory when building. charmcraft merged Merged PR #131 as commit 6f36923a (implementation 53e92d41), updating Charmcraft builds to respect directory symlinks.
74%
#260 Can't include symlinked file into built charm charmcraft closed Resolved by Charmcraft’s craft-parts build flow in PR #458 (implementation 437dab55, merge 9dc20872), enabling build-time handling of linked project files.
73%
#2836 feat: opt into git-driven build root via CHARMCRAFT_EXPERIMENTAL_MONOREPO charmcraft merged Merged in #2836 (commit e06d40c1): adds CHARMCRAFT_EXPERIMENTAL_MONOREPO env var and APP_METADATA.allow_git_build_root so charmcraft packs charms from a monorepo, with unit and spread tests.
72%
#2573 Support referencing sibling directories of project root charmcraft closed Resolved experimentally by opt-in Git-root builds: PR #2836 (commit e06d40c1) added CHARMCRAFT_EXPERIMENTAL_MONOREPO, with craft-application PR #1109 supporting the underlying project-root behavior.
72%
#514 `charmcraft build` silently omits files called out in `charmcraft.yaml` if executed from an external directory charmcraft closed Fixed by merged PR canonical/charmcraft#525 (merge commit 0d78f540), which runs the parts lifecycle from the project directory so relative globbed paths resolve during external builds.
72%