← Back to issue list

Add support for hooks.

View original Github issue

Metadata

Project
snapcraft
Number
#921
Type
pull request
State
closed
Author
kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

PR #921 (declarative `hooks:` with generated hook scripts) was closed unmerged after redesign discussion with snapd's niemeyer; hook support instead landed in #1026 (commit 01880ee8d) with docs in #1042.

Resolution: closed superseded

Reason: kyrofa closed it on 2016-12-07 stating it was redesigned and placed behind a prerequisite feature, and is no longer valid. The redesigned approach was merged later in canonical/snapcraft#1026 (commit 01880ee8d), with docs added in #1042 (10c58b652).

Evaluated by: mr-cal-bot

No scores available.

Issue body

Hooks are now supported in snapd and the click reviewer tools. Time to finish off LP: [#1586465](https://bugs.launchpad.net/snapcraft/+bug/1586465) by supporting them in snapcraft as well. This is done declaratively via a `hooks` option in the snapcraft.yaml, for example: hooks: configure: command: run-my-hook plugs: [network] This works exactly like apps, where `run-my-hook` should be a binary available within the snap. Then during the prime step, snapcraft will generate the hook (the configure hook in this example), which calls the command supplied.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed superseded PR #921 (declarative `hooks:` with generated hook scripts) was closed unmerged after redesign discussion with snapd's niemeyer; hook support instead landed in #1026 (commit 01880ee8d) with docs in #1042.
stealth/space-bunny-alpha — closed superseded Hook support was closed unmerged after redesign; a later implementation landed in canonical/snapcraft#1026 via commit 01880ee8d, with documentation in #1042.
stealth/space-bunny-alpha — closed superseded Closed unmerged as superseded after redesign. PR #1026 later merged executable hooks support, replacing this declarative hooks-option approach.
qwen/qwen3.6-35b-a3b — — Proposed declarative hook support was closed and superseded. Design discussions led to a complete redesign, placing the feature behind a prerequisite and invalidating the original submission.
qwen3.6-35b-a3b-mtp-q6 — — Closed without merging. The author noted the feature was redesigned and placed behind a prerequisite feature, making the pull request invalid.

Update history

No update history recorded yet.

Related work

  • Superseded By: snapcraft#1026 (confidence 93%)

    Merged commit 01880ee8d 'core: add support for hooks' implemented the redesigned hook support

  • Related To: snapcraft#1042 (confidence 80%)

    Follow-up docs commit 10c58b652 documenting hooks for the shipped implementation

  • Related To: snapcraft#3659 (confidence 60%)

    Much later merge adding hooks handling in the new craft-parts/CRAFT meta code

Related issues

Issue Project State Summary Similarity
#1026 Add support for hooks. snapcraft merged PR #1026 merged as commit 01880ee8d ('core: add support for hooks'), adding hook support: executables in snap/hooks/ are copied into the snap, and parts can install hooks into snap/hooks/. Docs followed in #1042 (10c58b652).
86%
#1586465 Add support for hooks snapcraft (launchpad) closed Hook support was added in snapcore/snapcraft#1026 via commit 01880ee8d, packaging hook files and snapcraft.yaml hook definitions.
80%
#3659 meta: add support for hooks snapcraft merged Merged snapcraft#3659 via commit 00eed7dc9 (merge 795294fd5) into snapcraft/7.0, adding hooks support in snapcraft.yaml for CRAFT-808.
75%
#3837 fix: hooks: process generated hooks snapcraft merged Merged as commit c77e3a07a (CRAFT-1159): core22 now includes lifecycle-generated hooks in the snap via meta/hooks wrappers, with snap/hooks taking priority; adds spread tests for core18/20/22.
71%
#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.
71%
#1797468 Add support for hook command-chains snapcraft (launchpad) closed Hook command-chain support shipped in canonical/snapcraft#2850 (41c9fb464); LP #1797468 was later closed as stale after nearly eight years.
70%
#5463 docs: migrate 'hooks' snapcraft merged Merged the snap hooks documentation migration from snapcraft.io to Read the Docs in commit 6f4c66e59.
70%