Skip to content

Conversation

@lengau
Copy link
Collaborator

@lengau lengau commented Dec 15, 2025

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run make lint && make test?
  • Have you added an entry to the changelog (docs/reference/changelog.rst)?

This adds the ability to choose plugin groups to the Lifecycle service.

This works differently from the default plugin setup in the Application,
which is now deprecated in favour of this. Apps that move over will be
rewarded with a happy fuzzy feeling and the ability to get the plugin
group based simply on the BuildInfo object.

Fixes #966 CRAFT-4933

Add `dev-resolute` dependency group to allow development on Ubuntu
Resolute, with `python-apt` version pinned to `3.0.0`.
This adds the ability to choose plugin groups to the Lifecycle service.

This works differently from the default plugin setup in the Application,
which is now deprecated in favour of this. Apps that move over will be
rewarded with a happy fuzzy feeling and the ability to get the plugin
group based simply on the BuildInfo object.
@lengau lengau requested a review from a team as a code owner December 15, 2025 23:33
"craft-grammar>=2.3.0",
"craft-parts>=2.26.0",
#"craft-parts>=2.26.0",
"craft-parts @ git+https://github.com/canonical/craft-parts.git@main",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We need a craft-parts release before merge.

@lengau lengau requested a review from a team as a code owner December 15, 2025 23:44

Testing
=======
Testing with pytest
Copy link
Collaborator Author

@lengau lengau Dec 15, 2025

Choose a reason for hiding this comment

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

This is just so that the pre-commit hooks stop complaining because the ======= looked like a merge conflict.

Copy link

Copilot AI left a comment

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 introduces plugin group selection capability to the Lifecycle service, allowing applications to dynamically choose plugin sets based on BuildInfo. This deprecates the previous Application-based plugin registration approach in favor of a more flexible, build-specific plugin configuration system.

  • Adds get_plugin_group() method to LifecycleService for dynamic plugin selection based on BuildInfo
  • Implements witchcraft-specific plugin groups (MERLIN for Ubuntu ≤22.04 with Python, MORGANA for Ubuntu >22.04 with Rust)
  • Deprecates Application.register_plugins() with a warning directing users to the new Lifecycle service approach

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
witchcraft/services/lifecycle.py New lifecycle service implementation with plugin group selection logic for witchcraft
witchcraft/services/init.py Registers the custom lifecycle service with the ServiceFactory
craft_application/services/lifecycle.py Adds base get_plugin_group() method and plugin group setup logic in LifecycleService
craft_application/application.py Adds deprecation warning to register_plugins() method
tests/integration/services/test_lifecycle.py Adds integration test for plugin group setup with different plugin configurations
tests/spread/witchcraft/plugin-groups/ Adds spread tests validating plugin group behavior on Ubuntu 22.04 and 24.04
pyproject.toml Updates craft-parts dependency to git source (temporary development dependency)
uv.lock Updates lockfile to reflect git-based craft-parts dependency
docs/reference/services/lifecycle.rst New documentation page for LifecycleService
docs/reference/services/index.rst Adds lifecycle service to documentation index
docs/reference/changelog.rst Documents new feature and deprecation in 6.1.0 changelog

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,17 @@
name: morgana-build
summary: A witchcraft cauldron that packs on Ubuntu 22.04 with the rust plugin.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The summary incorrectly states "Ubuntu 22.04" when the base is "ubuntu@24.04". This should be corrected to "Ubuntu 24.04".

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +11
#"craft-parts>=2.26.0",
"craft-parts @ git+https://github.com/canonical/craft-parts.git@main",
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The commented-out line with the pinned craft-parts version should be removed. Keeping commented-out dependencies in the file creates confusion and makes it unclear what the intended state is. If this git dependency is temporary for development, consider documenting that in a comment, or if it's permanent, remove the commented line.

Copilot uses AI. Check for mistakes.
@lengau lengau requested review from smethnani and removed request for a team December 17, 2025 14:57
Copy link

@smethnani smethnani left a comment

Choose a reason for hiding this comment

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

Small nit re the warning message but the rest looks good to me. Thanks @lengau!

lengau and others added 2 commits December 19, 2025 09:19
Co-authored-by: Michael DuBelko <michael.dubelko@canonical.com>
Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
Copy link
Contributor

@jahn-junior jahn-junior left a comment

Choose a reason for hiding this comment

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

LGTM! Consider my suggestions optional :)

Co-authored-by: JJ Coldiron <jj.coldiron@canonical.com>
Signed-off-by: Alex Lowe <alex.lowe@canonical.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.

Make an easy way for apps to set their plugin groups

6 participants