snapcraft doesn't allow setting the environment for hooks
Metadata
Current evaluation
Fixed by merged canonical/snapcraft#3565 (commit 79c5a5f0d), which added schema support for hook environment properties.
Resolution: closed resolved
Reason: PR #3565 was merged in commit 506001445. Its implementation commit 79c5a5f0d added environment support for hooks.
Evaluated by: mr-cal-bot
No scores available.
Issue body
With the following hook environment specification in snapcraft.yaml:
```
hooks:
install:
environment:
LC_ALL: C.UTF-8
LANG: C.UTF-8
```
snapcraft fails like this:
```
$ snapcraft
Issues while validating snapcraft.yaml: The 'hooks/install' property does not match the required schema: Additional properties are not allowed ('environment' was unexpected)
```
This is with version 3.8 on amd64:
```
$ snapcraft version
snapcraft, version 3.8
$ snap info snapcraft | grep installed
installed: 3.8 (3440) 60MB classic
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged canonical/snapcraft#3565 (commit 79c5a5f0d), which added schema support for hook environment properties. | |
| stealth/space-bunny-alpha | — | closed stale | Hook environment support was reported as invalid in Snapcraft 3.8, but the report was closed after years without a documented fix, discussion, or linked pull request. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. The schema validation error was fixed, enabling environment variables in hook definitions in later snapcraft versions. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
100
Complexity:
15
Confidence:
95
Support Request:
5
|
close stale | Reports a schema validation error when setting environment variables for hooks in snapcraft.yaml. Issue is completely inactive for over 6 years and references an obsolete software version. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
15
Confidence:
90
Support Request:
30
|
close stale | Reported schema validation error for setting hook environment in snapcraft 3.8. No activity for over 6 years. Issue is likely obsolete due to significant project evolution. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
98
Complexity:
35
Confidence:
90
Support Request:
10
|
close stale | Reports schema validation failure when setting environment variables for snapcraft hooks in version 3.8. No maintainer interaction or activity for over six years. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#3565
(confidence 99%)
The merged hook-env change added the hook environment property that Snapcraft 3.8 rejected.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3565 schema: add environment support for hooks (CRAFT-424) | snapcraft | merged | Merged PR snapcore/snapcraft#3565, adding CRAFT-424 hook environment support, shared schema definitions, snap metadata processing, and unit/spread tests. | |
| #1824255 snapcraft should use command-chain for hooks | snapcraft (launchpad) | closed | Fixed hook environment setup in merged #2897 (bfac28cea) by embedding the generated snap environment in hook wrappers; released in Snapcraft 3.10. |