← Back to issue list

Add support for hooks.

View original Github issue

Metadata

Project
snapcraft
Number
#1026
Type
pull request
State
merged
Author
kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

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).

Resolution: closed resolved

Reason: The pull request was merged into the project and appears in history as commit 01880ee8d with the message 'core: add support for hooks (#1026)'. It implemented both conventions described in the description (hooks in snap/hooks/ and hooks installed from parts), later expanded and documented in follow-ups such as #1042.

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/ubuntu/+source/snapd/+bug/1586465) by supporting them in snapcraft as well. This is done by convention, and two methods are supported: 1. Place hook executables in the `snap/hooks/` directory, and they will be copied into the snap automatically. 2. Install hook executables from parts into the `snap/hooks/` directory.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved 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).
stealth/space-bunny-alpha — closed resolved Merged #1026 in commit 01880ee8d, adding hook support for executables in snap/hooks/, including hooks installed from parts. Follow-up #1042 added documentation.
stealth/space-bunny-alpha — closed resolved Merged PR #1026 as commit 01880ee8d, adding hook support by copying executables from snap/hooks/ and installing hooks from parts.
stealth/space-bunny-alpha — closed resolved Merged canonical/snapcraft#1026 via commit 01880ee8d, adding convention-based support for hooks in snap/hooks or installed from parts.
stealth/space-bunny-alpha — closed resolved Merged #1026 as commit 01880ee8d, adding Snapcraft hook support for executables in snap/hooks or installed from parts, completing Launchpad #1586465.
qwen/qwen3.6-35b-a3b — — 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.
qwen3.6-35b-a3b-mtp-q6 — — Merged into master, adding hook support to snapcraft. Hook executables in snap/hooks/ or installed via parts are automatically included. The merge maintained 96.34% code coverage and completes support aligned with snapd and click reviewer tools.

Update history

No update history recorded yet.

Related work

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

    Follow-up commit 10c58b652 'Add documentation for hooks. (#1042)' documents the hooks support introduced here.

Related issues

Issue Project State Summary Similarity
#921 Add support for hooks. snapcraft closed 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.
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.
86%
#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.
79%
#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.
74%
#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.
74%
#1812003 hooks should be made executable instead of erroring out snapcraft (launchpad) closed Fixed by merged PR snapcore/snapcraft#2440 (commit c2f5a0dc0), which packages recognized hooks as executable instead of rejecting non-executable source files.
72%
#1042 Add documentation for hooks. snapcraft merged Merged as commit 10c58b652, adding hook usage documentation and completing the Snapcraft portion of Launchpad bug #1586465.
72%
#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.
71%
#5463 docs: migrate 'hooks' snapcraft merged Merged the snap hooks documentation migration from snapcraft.io to Read the Docs in commit 6f4c66e59.
71%
#4570 Support component hooks snapcraft closed Component hooks were implemented by merged PRs #4703, #4717 and #4722, adding hook metadata and core24/core22 packaging support.
70%