Snapcraft not detecting changes in hooks

When you edit your snapcraft.yaml and run snapcraft again it detects the changes and re-builds.

However when you make an edit to any hooks, such as my-snap/snap/hooks/configure, and try to run snapcraft again, you get:

Launching a VM.
Skipping pull my-snap-build (already ran)
Skipping build my-snap-build (already ran)
Skipping stage my-snap-build (already ran)
Skipping prime my-snap-build (already ran)
The requested action has already been taken. Consider
specifying parts, or clean the steps you want to run again.

And end up having to run snapcraft clean then snapcraft build again.

Am I missing something?

Thanks in advance.

nothing is built in the hooks dir usually, the content is just copied during the prime (or was it snap ?) step … so your change simply gets copied …

similar to what happens if you just add a plug to an app entry in snapcraft.yaml where just the meta data in the snap needs updating.

Just to confirm from my testing, if the hook script is in a part’s source, you’ll see

Updating pull step for configure-hook (source changed)

If it’s in snap/hooks as you have, you will not get an updated pull because it’s not directly attributed to a part’s source. As @ogra stated, it should just copy the [updated] hook when snapping. If you do not see the updated hook, that’s a bug. I did a quick test and saw the updated hook fine with the same output as you have. :slight_smile: