← Back to issue list

Can't include symlinked file into built charm

View original Github issue

Metadata

Project
charmcraft
Number
#260
Type
issue
State
closed
Author
knkski
Labels
—
Created
Updated
Closed

Current evaluation

Resolved by Charmcraft’s craft-parts build flow in PR #458 (implementation 437dab55, merge 9dc20872), enabling build-time handling of linked project files.

Resolution: closed resolved

Reason: PR #458 integrated the craft-parts lifecycle and was merged as 9dc20872, with implementation commit 437dab55. A maintainer confirmed on 2021-08-27 that the requested build-time solution was already in place.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I have a project with a directory structure like this: ``` / ├─ docs/ │ ├─ images/ │ │ ├─ icon.svg ├─ operators/ │ ├─ katib-controller/ │ │ ├─ icon.svg ``` I have symlinked `/operators/katib-controller-icon.svg` to `/docs/images/icon.svg`. It symlinks fine, but when building the charm, I get this message: Ignoring symlink because targets outside the project: 'icon.svg' I would like charmcraft to copy over the linked file (and not the symlink itself). This is not limited to simple things like icon.svg (that is relatively easy to copy once and it won't fail to stay in-sync), but being able to symlink directly to upstream files such as this: https://github.com/kubeflow/katib/blob/master/manifests/v1beta1/webhooks/webhooks.yaml We have upstreamed charms into that repository, and if I just copy/paste that file once, it could very easily get out of sync.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Resolved by Charmcraft’s craft-parts build flow in PR #458 (implementation 437dab55, merge 9dc20872), enabling build-time handling of linked project files.
stealth/space-bunny-alpha — closed resolved Closed as resolved after adoption of the craft-parts build flow in PR #458 (437dab55); a maintainer confirmed the replacement was already in place.
qwen3.6-35b-a3b-mtp-q6 — — 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.
qwen/qwen3.6-35b-a3b — — The request to include symlinked files in the built charm was resolved and implemented. The maintainer confirmed the feature is already in place, addressing the initial security concerns.
qwen/qwen3.6-35b-a3b — — Charmcraft blocked external symlinks for security. Maintainers closed the issue stating the feature is already implemented, likely via the adopted snapcraft parts-based build system.
qwen3.6-35b-a3b-mtp-q6 — — Closed. Maintainers resolved the issue by adopting snapcraft's parts-based build system. The new architecture handles source linking differently, addressing the symlink restriction without a dedicated flag.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#458 (confidence 98%)

    Merged the craft-parts build lifecycle used to resolve the reported symlink limitation.

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.
76%
#1079 Do not ignore symlinks to external files charmcraft closed 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.
73%
#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.
73%
#1719 Charmcraft 3.x not including symlinked directories in resulting charm charmcraft closed Charmcraft 3.x dropped symlinked directories (e.g. hooks/charmhelpers) from charm ZIPs due to Path.rglob() not following dir symlinks. Fixed by PR #1745, commit ac08e98e, which restored 2.x os.walk(followlinks=True) behaviour; shipped in Charmcraft 3.1.0.
70%