snap: add configure hook with support for provider (CRAFT-363)
Metadata
Current evaluation
Merged. Added a snap configure hook to validate the provider setting, restricting it to multipass or lxd. Updated requirements to include snap-helpers. Validation errors on invalid values but is reserved for future use. Approved by two reviewers.
Suggested action: —
No scores available.
Issue body
Enable (unused) configuration for 'provider', erroring if set to
anything other than multipass or lxd. Update requirements
to include snap-helpers.
Example error:
```
$ snap set charmcraft provider=invalid
error: cannot perform the following tasks:
- Run configure hook of "charmcraft" snap (run hook "configure":
Invalid snap configuration: provider 'invalid' is not supported.)
```
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Added a snap configure hook to validate the provider setting, restricting it to multipass or lxd. Updated requirements to include snap-helpers. Validation errors on invalid values but is reserved for future use. Approved by two reviewers. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Adds a snap configure hook to validate the provider configuration, accepting only multipass or lxd. Updates dependencies to include snap-helpers and defers actual provider usage to future work. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged commit adding a snap configure hook to validate the provider configuration, restricting it to multipass or lxd. Updated dependencies to include snap-helpers and refactored logic into a charmcraft module for future use. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #183 feat: add configure hook | imagecraft | merged | Merged to implement a configure snap hook for setting the default provider. Resolves #182 by utilizing the existing SnapConfig model, addressing reviewer suggestions to streamline configuration management. | |
| #3962 Setup snapd for snapcraft_legacy providers | snapcraft | merged | Merged a fix for failing spread tests caused by missing snapd sockets in LXD containers. The change adopts snapd initialization logic from craft-providers to properly start the service, resolving connection errors. Approved and passed CI. | |
| #2507 build providers: improve handling in snap logic | snapcraft | merged | Merged. Improved snap provider logic by cleaning up channel warnings, removing unnecessary sudo calls, and silencing noisy refresh hold commands. Approved, passed CI, and modified 5 files (+131/-73 lines). | |
| #2509 build providers: initial support for LXD | snapcraft | merged | Merged initial LXD build provider support for snapcraft, enabling the --use-lxd flag for lifecycle steps and cleaning. Passes CI. Reviewers noted minor dependency and container setup edge cases, which were clarified or deferred. | |
| #2647 build providers: catch LXD socket error | snapcraft | merged | Merged to catch LXD socket errors in build providers, resolving SNAPCRAFT-WA. Approved by reviewer, passed CI checks, and integrated with a 14-line addition and 6-line deletion across three files. Minor test coverage decrease noted but did not block merge. |