← Back to issue list

providers: refactor to better support multiple providers (CRAFT-362)

View original Github issue

Metadata

Project
charmcraft
Number
#484
Type
pull request
State
merged
Author
cjp256
Labels
Created
Updated
Closed

Current evaluation

Merged following two approvals and passing CI. Refactored the providers module into a package introducing a common Provider interface and LXDProvider subclass to accommodate future providers like Multipass. No behavioral changes. Minor naming adjustments applied during review.

Suggested action:

No scores available.

Issue body

With the upcoming introduction of Multipass, the providers module would grow significantly in complexity. Convert providers module into a package, splitting out functionality into well scoped modules. Introduce a common Provider class to be the general interface for any Charmcraft-supported providers, and refactor the LXD-specifics into a new subclass LXDProvider. Add interface get_provider() for users of providers to get the correct provider (only returns an instance of LXDProvider at this time). There should be no change in behaviors with this commit, the large diff is to accompany the shuffling of the whole module into a new package, folding this functionality into the new provider classes, and updating the test mocks. Signed-off-by: Chris Patterson <chris.patterson@canonical.com>

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged following two approvals and passing CI. Refactored the providers module into a package introducing a common Provider interface and LXDProvider subclass to accommodate future providers like Multipass. No behavioral changes. Minor naming adjustments applied during review.
qwen3.6-35b-a3b-mtp-q6 Merged a refactor converting the providers module into a package with a base Provider class and LXDProvider subclass to support future providers. No behavioral changes were made, mocks updated, and _helpers renamed to _logs.
qwen3.6-35b-a3b-mtp-q6 Merged a refactor converting the providers module into a package with a base Provider class and LXDProvider subclass to support future providers. No behavioral changes were introduced, test mocks were updated, and a minor naming adjustment was applied.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#504 providers: improve error handling (CRAFT-472) charmcraft merged Improved error handling for provider-generated exceptions by adding try/except blocks for LXD and Multipass, chaining exceptions, and adding test coverage. Merged after approval and passing CI checks.
80%
#3660 providers: integrate craft-providers support snapcraft merged Integrated craft-providers support to run lifecycle commands in LXD or Multipass build providers. Merged with 1338 additions and 41 deletions across 22 files, adapting Charmcraft's implementation after reviewer approval.
79%
#3943 providers: use new craft-providers interface snapcraft merged Merged to main. Replaced internal Provider classes with the craft-providers interface and consolidated the providers module. Approved after passing CI and spread tests. Coverage dropped 0.15% with 100% diff coverage; unrelated test failure tracked in PR #3944.
79%
#120 providers: use new craft-providers interface rockcraft merged Merged after review and CI approval. Replaced custom Provider classes with the new craft-providers interface, relocated providers.py, and refactored 17 files. Reduced codebase by over 1200 lines, resolving CRAFT-1349.
78%
#92 providers: refactor get_provider() rockcraft merged Merged after approval and passing CI. Refactored and moved get_provider() from _get_provider.py to providers.py across seven files, reducing code by 25 lines. Resolves CRAFT-1375.
78%
#899 providers: use new craft-providers interface charmcraft merged Merged after replacing internal Provider classes with the new craft-providers interface. Refactored by moving providers.py to the package root, removing 1253 lines across 17 files. Resolved CRAFT-1279.
78%
#110 providers: move lxd project name out of craft-providers interface rockcraft merged Merged refactoring that moves rockcraft's project name from lxd.py to providers.py in the craft-providers interface. Approved by one reviewer, passed CI, and successfully integrated.
74%
#198 requirements: update craft-providers to 1.7.2 rockcraft merged Merged an update to the craft-providers dependency, upgrading it to version 1.7.2. The change incorporates LXD performance improvements, id map validation, and base instance caching. Approved by two reviewers, passed CI checks, and modified three files.
74%
#9 providers: add build provider support (CRAFT-28) rockcraft merged Merged integration of rockcraft with craft-providers to run build providers on LXD instances. The change ports Charmcraft glue code, hardwires execution to LXD, and defers user messages and log retrieval to follow-up PRs. Approved and passed CI.
73%
#85 providers: translate rockcraft base to provider base rockcraft merged Merged. Centralized base translation from LXD and Multipass modules into craft-providers. Added a configurable supported bases list to decouple application definitions from provider image mapping. Approved by mr-cal.
73%