← 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 PR #2174 (commit 283ab0bb8) to inject host Snapcraft and base snaps when running from the snapcraft snap, while non-snap runs install them from the store.

Resolution: closed resolved

Reason: PR #2174 was approved and merged into snapcraft as commit 283ab0bb8, resolving LP #1779137 by ensuring snap-based builds use host-injected snaps.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved Merged PR #2174 (commit 283ab0bb8) to inject host Snapcraft and base snaps when running from the snapcraft snap, while non-snap runs install them from the store.
stealth/space-bunny-alpha — closed resolved Merged #2174 as 283ab0bb8, injecting host Snapcraft and base snaps into build providers when running from a snap; otherwise it installs Snapcraft from the store.
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.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1779137 build provider support to inject snaps on the host snapcraft (launchpad) closed Build providers gained host-snap injection when Snapcraft runs from a snap; fixed by merged snapcore/snapcraft#2174 (commit 283ab0bb8).
86%
#444 feat(snaps): inject base snap from host craft-providers merged Merged PR #444 in commit 03704c1, injecting each host snap's base snap and reusing an existing base; released in craft-providers 1.20.0.
79%
#4084 providers: inject current snapcraft snap into instances snapcraft merged Merged PR #4084 as commit b852f9ac8, injecting the current Snapcraft snap into provider instances so parallel-installed instances can build core22 snaps.
78%
#1779138 build provider runner detection snapcraft (launchpad) closed Build-provider injection was made conditional on Snapcraft running from a snap, avoiding injection from non-snap runners; fixed by merged PR snapcore/snapcraft#2174 (283ab0bb8).
77%
#997 feat(Provider): inject the base snap craft-application merged Merged as commit 41cee32d, injecting the application's base snap into the provider so managed instances need not download it; fixes #952 (CRAFT-4889).
76%
#143 build(deps): bump craft-providers to 1.20.0 craft-application merged Merged PR #143 as commit f0349036, updating craft-providers to 1.20.0 so host-injected snaps also receive their base snap.
75%
#2773 build providers: inject snapd snap for latest feature availability snapcraft merged Merged PR #2773 in commit 3740c61bc, replacing injected core snaps with the smaller snapd snap for current build features without requiring core18.
75%
#2265 build providers: allow snapcraft channel selection snapcraft merged Merged build-provider Snapcraft channel selection for non-host-injected early testing, with a user warning, in commit 6a3d2d3cd (#2265).
73%
#1037 feat(ProviderService): don't inject snaps if the host and guest architectures differ craft-application merged Merged PR #1037 as commit 16bd7ac3, preventing host application-snap injection for cross-architecture guests and using Snap Store installation instead.
73%
#1782777 Improve installation/injection logic for snapcraft (and core) snapcraft (launchpad) closed Fixed by merged snapcore/snapcraft PR #2196 in commit d9a477ea5, improving build-provider installation and snap injection logic.
72%