← Back to issue list

Support referencing sibling directories of project root

View original Github issue

Metadata

Project
charmcraft
Number
#2573
Type
issue
State
open
Author
steinbro
Labels
Status: Triaged
Created
Updated
Closed

Current evaluation

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.

Suggested action: keep open

Reason: Labelled Status: Triaged and actively discussed (6 comments, last activity 86 days ago) with multiple maintainers and users (Valkey, Sunbeam's 80-charm monorepo, Cargo workspaces) expressing strong need. A related experimental implementation (CHARMCRAFT_EXPERIMENTAL_MONOREPO, PR #2836) has landed in the codebase, but it is opt-in/experimental and not the finalized top-level project-root design discussed in-thread, so the issue remains a valid open feature request.

Impact: 80 Quick Win: 24.0 Staleness: 15 Complexity: 70 Confidence: 75 Support Request: 10

Issue body

### Check existing issues - [x] I've verified that this request isn't described by any existing issues. ### Request Consider the following directory structure: ``` my-repo/ shared-lib/ ... charm-1/ charmcraft.yaml ... charm-2/ charmcraft.yaml ... ``` Currently, Charmcraft cannot readily build the individual charms without some preprocessing, because the `shared-lib` directory will not be accessible from the build containers for each of the charms. Instead of using the folder containing charmcraft.yaml as the project root, the build environment should mount the entire containing repository and then set the working directory to the charmcraft.yaml directory. Each charm could then define a part with `source: ../shared-lib`. ### The problem it solves This would fix the limitations encountered in e.g. https://github.com/canonical/charmcraft/issues/1079 and https://github.com/canonical/rockcraft/issues/959.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 80
Quick Win: 24.0
Staleness: 15
Complexity: 70
Confidence: 75
Support Request: 10
keep 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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 25
Complexity: 60
Confidence: 90
Support Request: 5
keep open Feature request to enable referencing sibling directories via a new project-root configuration. Currently triaged with active maintainer design discussions and multiple user endorsements.
qwen3.6-35b-a3b-mtp-q6
Staleness: 30
Complexity: 65
Confidence: 85
Support Request: 10
keep open Feature request to allow charmcraft to reference sibling directories via a project root configuration. Currently triaged with active design discussions and maintainer feedback on implementation approach.
qwen3.6-35b-a3b-mtp-q6
Staleness: 15
Complexity: 70
Confidence: 90
Support Request: 5
keep open Feature request to allow charms to reference sibling directories via a project-root configuration. Triaged, under active discussion with design proposals and strong community interest.
qwen3.6-35b-a3b-mtp-q6
Staleness: 15
Complexity: 65
Confidence: 90
Support Request: 0
keep open Proposes a project-root setting to let monorepo charms reference sibling directories like shared libraries. Triaged and currently under design discussion for implementation in craft-application. Last updated 18 days ago.

Update history

No update history recorded yet.

Related work

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

    Referenced in the issue body as a limitation this feature would fix (symlinks to external files ignored).

  • Related To: canonical/rockcraft#959 (confidence 85%)

    Referenced in the issue body as a cross-craft limitation (custom build contexts for multi-rock repos).

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

    Commit e06d40c1 'feat: opt into git-driven build root via CHARMCRAFT_EXPERIMENTAL_MONOREPO' implements mounting the git root, matching the core request, though still experimental/opt-in.

Related issues

Issue Project State Summary Similarity
#2836 feat: opt into git-driven build root via CHARMCRAFT_EXPERIMENTAL_MONOREPO charmcraft merged Merged. Adds CHARMCRAFT_EXPERIMENTAL_MONOREPO env var to enable a git-driven build root. When set, it configures allow_git_build_root=True, mounting the repository root as the build directory for monorepo support. Fixes CHARMCRAFT-710 and CHARMCRAFT-720.
74%
#1079 Do not ignore symlinks to external files charmcraft 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.
72%