← Back to issue list

build_providers: inject snaps when running from a snap

View original Github issue

Metadata

Project
snapcraft
Number
#2174
Type
pull request
State
merged
Author
sergiusens
Labels
Created
Updated
Closed

Current evaluation

Merged. Updates build providers to inject snapcraft and its base from the host when running inside the snapcraft snap, ensuring parity with non-snap environments. Approved by reviewer and passed CI checks.

Suggested action:

No scores available.

Issue body

If running from the snapcraft snap, inject the snapcraft and its "base" from the host to ensure parity. If not running from the snap, install from the store. LP: #1779137 Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com> - [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [ ] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [ ] Have you successfully run `./runtests.sh static`? - [ ] Have you successfully run `./runtests.sh unit`? ----- An easy way to test this is to install the snap, `snap run --shell snapcraft` and then run something like the following: ```python import os from snapcraft.cli import echo from snapcraft.project import Project from snapcraft.internal.build_providers import get_provider_for os.chdir('/home/sergiusens/source/test-project') Provider = get_provider_for('multipass') project = Project(snapcraft_yaml_file_path='snap/snapcraft.yaml') p = Provider(project=project, echoer=echo) p.create() ``` Which would result in, ``` sergiusens@tupa:~/source/snapcraft$ snap run --shell snapcraft sergiusens@tupa:~/source/snapcraft$ /snap/snapcraft/current/usr/bin/python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> >>> from snapcraft.cli import echo >>> from snapcraft.project import Project >>> from snapcraft.internal.build_providers import get_provider_for >>> >>> os.chdir('/home/sergiusens/source/test-project') >>> Provider = get_provider_for('multipass') >>> project = Project(snapcraft_yaml_file_path='snap/snapcraft.yaml') >>> >>> p = Provider(project=project, echoer=echo) >>> p.create() Creating a build environment named 'oversubtle-jeremiah' Launched: oversubtle-jeremiah Setting up snapcraft in 'oversubtle-jeremiah' Waiting for pending snap auto refreshes. error: no changes of type "auto-refresh" found Setting up core 2018-06-29T15:35:27Z INFO Waiting for restart... core 16-2.33 from 'canonical' installed Setting up snapcraft snapcraft 2.42.1+git26.055e84a installed ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged. Updates build providers to inject snapcraft and its base from the host when running inside the snapcraft snap, ensuring parity with non-snap environments. Approved by reviewer and passed CI checks.
qwen3.6-35b-a3b-mtp-q6 Merged implementation that injects snapcraft and base snaps from the host when running inside the snapcraft snap, ensuring parity, with store fallback otherwise. Resolves LP: #1779137. Achieved 89.01% diff coverage.
qwen3.6-35b-a3b-mtp-q6 Merged. Updates build providers to inject snapcraft and its base from the host when running inside the snapcraft snap, ensuring parity. Falls back to store installation otherwise. Resolves LP: #1779137.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2773 build providers: inject snapd snap for latest feature availability snapcraft merged Merged changes that inject the snapd snap into build providers instead of core, improving feature availability and reducing size. Approved by reviewer, passed CI, and modified 4 files (+59/-12 lines).
80%
#3146 build providers: snap sw to channels if injecting snapcraft merged Merged fix that prevents automatic channel switching to latest/stable when injecting snaps with revision assertions during build provider setup. Approved by reviewer, passed CI, and integrated.
79%
#997 feat(Provider): inject the base snap craft-application merged Merged. Injects the base snap into the provider alongside the application, eliminating separate downloads. Resolves #952 and CRAFT-4889. Approved by two reviewers with all CI checks passing.
79%
#143 build(deps): bump craft-providers to 1.20.0 craft-application merged Merged dependency update bumping craft-providers to 1.20.0. Approved by two reviewers, passed CI checks, and maintained 99.02% coverage. The change ensures host-injected snaps include their base snap in the instance.
78%
#2265 build providers: allow snapcraft channel selection snapcraft merged Merged: Enables snapcraft channel selection for build providers when snapcraft is not injected from the host. Adds a user warning, passes CI, and received approval. Resolves LP #1792185.
77%
#2100 build_providers: new build provider using multipass snapcraft merged Merged pull request introducing the build_providers package and MVP multipass integration for snapcraft. Approved by two reviewers despite reported naming inconsistencies and a launch crash, accepted as initial implementation.
76%
#1779137 build provider support to inject snaps on the host snapcraft (launchpad) closed Abandoned. The request to inject snaps into build providers when running snapcraft from a snap was closed without implementation due to prolonged inactivity and no further development.
76%
#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).
75%
#2309 snap: improve early base detection logic snapcraft merged Merged. Resolved early base detection failure in build providers by updating logic to account for snapcraft's non-project directory execution. Approved by reviewer, passed CI, and merged with minimal changes.
75%
#4084 providers: inject current snapcraft snap into instances snapcraft merged Merged. Injects the current snapcraft snap into build instances, enabling core22 builds with a parallel-installed snapcraft instance. Approved, passed CI, and achieved 100% diff coverage. Core18 and core20 support will follow in a subsequent PR.
75%