Skip to content

Work/charmcraft 710 prototype e2e - #2772

Draft
lengau wants to merge 6 commits into
mainfrom
work/CHARMCRAFT-710-prototype-e2e
Draft

Work/charmcraft 710 prototype e2e#2772
lengau wants to merge 6 commits into
mainfrom
work/CHARMCRAFT-710-prototype-e2e

Conversation

@lengau

@lengau lengau commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Describe your changes.


  • I've followed the contribution guidelines.
  • I've signed the CLA.
  • I've successfully run make lint && make test.
  • I've added or updated any relevant documentation.
  • In documents I changed, I added a meta description if one was missing.
  • I've updated the relevant release notes.

Workshop and others added 5 commits July 8, 2026 13:27
…REPO

When CHARMCRAFT_EXPERIMENTAL_MONOREPO is set to a truthy value,
charmcraft passes use_git_build_root=True to craft-application, which
mounts the git repository root as the build root. This enables charms
in a monorepo to access shared local dependencies (e.g. ../common)
during pack.

CHARMCRAFT-710

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When a charm uses a source-subdir (as happens with root_dir/monorepo
builds), the charm files live at part_build_subdir not part_build_dir.
Fix get_charm_copy_commands in all three charm plugins (poetry, python,
uv) to use part_build_subdir so that src/, lib/ etc. are found
correctly.

CHARMCRAFT-710

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move microk8s setup out of the charms/ suite-level prepare and into
  k8s-operator/task.yaml (the only test that uses a k8s Juju controller)
  so monorepo tests don't require microk8s.
- Add tests/spread/charms/monorepo/ with four variants covering
  mysql-operators and mysql-router-operators × machines + kubernetes.
- Add tests/spread/commands/git-build-root/ as a lightweight unit-level
  smoke test for the feature flag.

CHARMCRAFT-710

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ype branches

Temporarily pin both dependencies to the work/CHARMCRAFT-710-prototype
branches while the upstream PRs are in review.

CHARMCRAFT-710

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update craft-parts and craft-application pins to the e2e branch, which
propagates root_dir end-to-end without mutating parts data.

CHARMCRAFT-710

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 18:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prototypes “monorepo”/git-root build support by wiring a new experimental env var into the Charmcraft application, adjusting plugin copy behavior to use the part build subdirectory, and adding spread E2E coverage for packing charms from monorepos.

Changes:

  • Add CHARMCRAFT_EXPERIMENTAL_MONOREPO and pass use_git_build_root into craft_application.AppMetadata.
  • Update Python/Poetry/uv plugins to copy charm src/ and lib/ from part_build_subdir instead of part_build_dir.
  • Add spread tasks to validate monorepo packing, and move microk8s bootstrap/setup into the k8s-operator task.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
uv.lock Switches several craft-* dependencies to git sources for this prototype lock state.
pyproject.toml Adds tool.uv.sources overrides pointing craft-* deps at git branches.
charmcraft/application/main.py Enables git-root build behavior via CHARMCRAFT_EXPERIMENTAL_MONOREPO.
charmcraft/const.py Introduces EXPERIMENTAL_MONOREPO_ENV_VAR.
charmcraft/parts/plugins/_uv.py Copies charm sources from build subdir to support monorepo layouts.
charmcraft/parts/plugins/_python.py Same copy-path adjustment for the Python plugin.
charmcraft/parts/plugins/_poetry.py Same copy-path adjustment for the Poetry plugin.
tests/spread/commands/git-build-root/task.yaml New spread test intended to validate git-root/monorepo packing.
tests/spread/charms/monorepo/task.yaml New spread test that packs multiple real monorepo charms with the feature enabled.
tests/spread/charms/k8s-operator/task.yaml Adds per-task microk8s setup/juju bootstrap.
spread.yaml Removes suite-level microk8s setup from the charms suite prepare step.

Comment on lines +51 to +53
arch=$(dpkg --print-architecture)
artifact=/tmp/monorepo/charm/monorepo-test-charm_${arch}.charm
test -f "${artifact}"
Comment on lines +20 to +22
git clone --depth=1 https://github.com/canonical/"${REPO}".git /tmp/"${REPO}"
python3 - << 'EOF'
import os, yaml, pathlib
Comment thread tests/spread/charms/monorepo/task.yaml Outdated
d = yaml.safe_load(p.read_text())
d["parts"].pop("files", None)
d["parts"].get("charm-poetry", {}).pop("override-build", None)
p.write_text(yaml.dump(d))
Comment on lines +34 to +36
snap install microk8s --channel=1.28-strict/stable
microk8s enable hostpath-storage
microk8s enable dns
Comment thread pyproject.toml
Comment on lines 507 to +514
[tool.uv.sources]
craft-application = { git = "https://github.com/canonical/craft-application.git", branch = "work/CHARMCRAFT-710-prototype-e2e" }
craft-cli = { git = "https://github.com/canonical/craft-cli.git", branch = "main" }
craft-grammar = { git = "https://github.com/canonical/craft-grammar.git", branch = "main" }
craft-parts = { git = "https://github.com/canonical/craft-parts.git", branch = "work/CHARMCRAFT-710-prototype-e2e" }
craft-providers = { git = "https://github.com/canonical/craft-providers.git", branch = "main" }
craft-platforms = { git = "https://github.com/canonical/craft-platforms.git", branch = "main" }
craft-store = { git = "https://github.com/canonical/craft-store.git", branch = "main" }
- Install python3-yaml explicitly rather than relying on it being present
- Use yaml.safe_dump instead of yaml.dump
- Add microk8s status --wait-ready before enabling addons

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants