Add support for hooks
Metadata
Current evaluation
⚠️ This summary may be outdated — the issue content or evaluation prompts have changed since this evaluation was made.
Closed without implementation. The feature request to add snap.yaml hooks support was abandoned or superseded by subsequent snapd developments.
Suggested action: —
No scores available.
Issue body
There are a number of situations where snapd needs to notify a snap that something has happened. For example, when a snap is upgraded, the snap may need to run some sort of migration on the previous version’s data in order to make it consumable by the new version. This is possible today, but it requires that the snap be smart enough to realize that it’s running on old data, and there’s no way for the snap to inform snapd that the upgrade failed.
A new global section should be added to the `snap.yaml` (alongside `apps`), called "hooks." To continue with the example of an upgrade, such a section would look something like this:
hooks:
upgrade: # Actual name TBD
plugs: [network]
The name of the hook ("upgrade" in this example) directly corresponds to its purpose, and must be one of the yet-to-be-determined hooks supported by snapd. It also directly corresponds to the file name of the hook executable, which by convention is to be placed into the `meta/hooks/` directory within the snap. Similar to apps, the hooks may utilize plugs in order to extend their capabilities. Note that if the hook doesn't require any plugs, it doesn't need to be present in the YAML at all (i.e. its presence in `meta/hooks/` is enough for snapd to know it should be run).
Hooks may be written in any language that is available to the snap. They will be called with no parameters-- if hooks need information from snapd it can be obtained via a yet-to-be-determined API call.
If the hook returns a non-zero exit code the hook is considered to have failed, and snapd will take remedial action accordingly. The action taken depends on system choices made for the hook being run. Potential actions are retrying, or failure which would cause the whole change to be undone per existing semantics.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed without implementation. The feature request to add snap.yaml hooks support was abandoned or superseded by subsequent snapd developments. | |
| qwen/qwen3.6-35b-a3b | — | — | Proposed adding a hooks section to snap.yaml for snapd event notifications and upgrade migrations. Closed after over nine years with zero comments and no resolution, indicating the feature request was abandoned or superseded. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without implementation. The snapd hooks proposal was abandoned due to lack of discussion and no subsequent merge or resolution. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1797468 Add support for hook command-chains | snapcraft (launchpad) | closed | Closed without implementation. The feature request for hook command-chain support and hook adapters was abandoned or superseded by newer snapcraft capabilities. No code changes or merges occurred. | |
| #1707782 Hook documentation unclear | snapcraft (launchpad) | closed | Documentation request for snap config hooks was abandoned and closed without resolution. No comments or follow-up updates were recorded. | |
| #1026 Add support for hooks. | snapcraft | merged | Merged into master to add hook support to snapcraft. Hooks are now supported via convention by placing executables in the snap/hooks directory or installing them from parts. Approved and passed CI checks. | |
| #4592 Support project hooks for core24 snaps | snapcraft | closed | Closed without a fix or linked pull request. No resolution or merge details are documented, indicating the feature request was likely abandoned or superseded. | |
| #182 Add a `configure` snap hook | imagecraft | closed | Closed without implementation. The enhancement to add a configure snap hook was logged as an internal Jira ticket and abandoned, with no code changes or documentation updates applied. | |
| #3659 meta: add support for hooks | snapcraft | merged | Merged into snapcraft/7.0 branch after reviewer approval and passing CI checks. Adds support for hooks in snapcraft.yaml, modifying four files with 116 additions and 24 deletions while maintaining 100% diff coverage. |