← Back to issue list

Snappy needs to influence environment variables in applications

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1583259
Type
issue
State
closed
Author
~zyga
Labels
snap-desktop-issue verification-done
Created
Updated
Closed

Current evaluation

⚠️ This summary may be outdated — the issue content or evaluation prompts have changed since this evaluation was made.

Fixed via SRUs for snapcraft and click-reviewers-tools. Added an environment keyword to snapcraft.yaml that populates snap.yaml, enabling the launcher to apply variables directly and reducing wrapper scripts. Verified and closed.

Suggested action:

No scores available.

Issue body

= SRU for snapcraft = [Impact]  * Adding an environment keyword to snapcraft.yaml, which will make it to snap.yaml which the launcher will use to setup the environment.  * This reduces the amount of wrapper files. [Test Case]  1. Run `snapcraft` on the ros demo.  2. Install the snap.  3. snap should run. (if it doesn't it mostly likely means the environent was setup incorrectly).  4. snap.yaml's `assumes` gets a `snap-run` tag. [Regression Potential]  * Very low. Environment that was previously setup by wrapper scripts could be missing when the launcher launches using the environment keyword.  * The use of `assumes` will make sure this doesn't break people on older versions of snapd or snap-run = SRU for click-reviewers-tools = [Impact] This is already fixed in the store so the SRU is for users to not see this failure their local system [Test Case] Run snap-review on the attached snap: $ snap-review ./snap-example-env_0_all.snap ./snap-example-env_0_all.snap: pass [ Regression Potential] Regression potential is extremely low since this is already on production in the Ubuntu Store for many weeks. = Original description = We see a common pattern across many snaps, all apps are really using wrappers to set environment variables. I'd like to propose that this is exposed as first class feature in snapcraft (same like plugs and slots), snappy (where interfaces can affect variables and snappy can have sensible defaults) and ubuntu-core-launcher (to actually apply those variables to each started process). As a bit of context, this is a wrapper for a non trivial but still common app: the calculator: https://bazaar.launchpad.net/~ubuntu-desktop/+junk/gnome-calculator-snap/view/head:/calc#L3 The wrapper is 44 lines long, all of which set up environment variables. Support environment variable that would be available to snaps. The form should look like snapcraft.yaml name: ... version: ... ... environment: # these apply to all snaps    ENV1: value1    ENV2: value2 apps:    app1:      ...      environment:         ENV1: value1 # takes precedence over global ones These environment values would be transported to snap.yaml

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Fixed via SRUs for snapcraft and click-reviewers-tools. Added an environment keyword to snapcraft.yaml that populates snap.yaml, enabling the launcher to apply variables directly and reducing wrapper scripts. Verified and closed.
qwen/qwen3.6-35b-a3b Implemented and released via SRUs for snapcraft and click-reviewers-tools. The environment keyword was added to snapcraft.yaml to pass variables to snap.yaml and the launcher, reducing wrapper scripts. Closed as fixed.
qwen3.6-35b-a3b-mtp-q6 Implemented and released via SRU for snapcraft and click-reviewers-tools. Added environment keyword to snapcraft.yaml to pass variables to snap.yaml and the launcher, reducing wrapper script usage. Verification completed.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2897 meta: include environment in hook wrappers snapcraft merged Merged a fix restoring environment variable inclusion for Snapcraft hook wrappers, correcting a regression that limited it to apps. Approved, passed CI, and modified three files. Resolves LP #1824255.
72%