feat: reactive support for 26.04#2678
Conversation
Signed-off-by: Peter Sabaini <peter.sabaini@canonical.com>
| def get_build_packages(self) -> set[str]: | ||
| """Return a set of required packages to install in the build environment.""" | ||
| return set() | ||
| return { |
There was a problem hiding this comment.
Is this new, or should this always have been this way?
| craft_parts.plugins.plugins.get_plugin_class("charm") | ||
| with pytest.raises(ValueError, match="plugin not registered: 'reactive'"): | ||
|
|
||
| if charm_dir.name in { |
There was a problem hiding this comment.
Rather than putting this conditional here, could you parametrize the match and which plugin is removed instead?
There was a problem hiding this comment.
Thanks for this! LGTM presuming the re-run of the Reactive plugin in https://github.com/canonical/charmcraft/actions/runs/25121675165/job/73846475235?pr=2678 succeeds, with one question for my own curiosity (that info predates me) and one requested test re-org.
There was a problem hiding this comment.
Pull request overview
This PR updates Charmcraft to treat Ubuntu 26.04 (“resolute”) as a supported base for reactive charms, including dependency constraints, base/schema updates, plugin gating, and updated unit/integration/spread tests.
Changes:
- Extend base/support constants and schema to include
ubuntu@26.04, and adjust legacy plugin (charm/reactive) allow-lists accordingly. - Update plugin registration/validation so
reactiveremains available on 26.04 whilecharmis rejected on 26.04. - Update tests and spread smoke configuration to exercise reactive builds on 26.04.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Bumps craft-providers constraint to a newer supported range. |
uv.lock |
Lockfile update matching the craft-providers constraint bump. |
charmcraft/const.py |
Introduces separate base allow-lists for charm vs reactive; adds ubuntu@26.04 to supported bases and adjusts devel base list. |
schema/charmcraft.json |
Adds ubuntu@26.04 into the enumerated base/build-base values. |
charmcraft/application/main.py |
Updates app plugin gating logic to enable/disable charm and reactive plugins per build base set. |
charmcraft/models/project.py |
Refactors validation for legacy plugin usage to check supported bases and provide more specific errors (e.g., charm plugin rejected on 26.04). |
charmcraft/parts/plugins/_reactive.py |
Changes reactive plugin to declare additional build packages instead of none. |
tests/unit/services/test_provider.py |
Adds ubuntu@26.04 to the provider base list used by unit tests. |
tests/unit/parts/plugins/test_reactive.py |
Updates expected reactive plugin build packages. |
tests/unit/models/test_project.py |
Updates/extends project model tests for 26.04 behavior and new error messaging. |
tests/unit/models/test_charmcraft.py |
Adds parsing coverage for ubuntu@26.04 base strings. |
tests/spread/smoketests/reactive/task.yaml |
Adds a resolute track; generates a 26.04-specific charmcraft.yaml for the reactive smoke test. |
tests/spread/smoketests/reactive/reactivecharm/charmcraft.yaml |
Parameterizes base channel and adds reactive build arguments used by spread tests. |
tests/integration/test_application.py |
Adjusts expectations for whether the reactive plugin is registered depending on the sample charm directory. |
tests/integration/sample-charms/platforms-resolute-reactive/charmcraft.yaml |
New sample charm exercising reactive plugin on ubuntu@26.04. |
tests/integration/sample-charms/platforms-resolute-reactive/expected.yaml |
Expected output for the new resolute reactive sample charm. |
tests/integration/invalid-charms/resolute-reactive-plugin/charmcraft.yaml |
Removed: reactive plugin is no longer invalid on 26.04. |
tests/integration/invalid-charms/resolute-reactive-plugin/errors.json |
Removed: corresponding expected error removed. |
tests/integration/invalid-charms/resolute-charm-plugin/charmcraft.yaml |
Updates invalid charm definition for charm plugin on 26.04 (now single-base, updated metadata). |
tests/integration/invalid-charms/resolute-charm-plugin/errors.json |
Updates expected error text to reflect charm-only rejection on 26.04. |
tests/integration/invalid-charms/multibase-resolute-charm-plugin/charmcraft.yaml |
Updates invalid multi-base charm YAML for resolute charm-plugin case (naming and key formatting). |
tests/integration/invalid-charms/multibase-resolute-charm-plugin/errors.json |
Updates expected error text to reflect charm-only rejection on 26.04. |
tests/integration/invalid-charms/multibase-charm-plugin/errors.json |
Updates expected error text for mixed-base invalid legacy plugin usage. |
| return { | ||
| "git", | ||
| "python3-pip", | ||
| "python3-setuptools", | ||
| "python3-venv", | ||
| "python3-wheel", | ||
| "virtualenv", |
| if invalid_bases := build_bases - const.CHARM_OR_REACTIVE_BASES: | ||
|
|
||
| if base := info.data.get("base"): | ||
| build_bases = {base} |
| build_bases = { | ||
| str(info.build_base) | ||
| for info in craft_platforms.charm.get_platforms_charm_build_plan( | ||
| base=None, | ||
| platforms=pydantic.TypeAdapter(PlatformsDict).dump_python( | ||
| info.data["platforms"], mode="json", by_alias=True | ||
| ), | ||
| ) | ||
| } |
| def test_get_build_package(plugin): | ||
| assert plugin.get_build_packages() == set() | ||
| assert plugin.get_build_packages() == { | ||
| "git", | ||
| "python3-pip", | ||
| "python3-setuptools", | ||
| "python3-venv", | ||
| "python3-wheel", | ||
| "virtualenv", | ||
| } |
Enable reactive charms for 26.04
make lint && make test.