Web UI create/delete tag actions do not trigger custom hooks pre-receive/post-receive

Summary

When creating or deleting a tag from GitLab web UI, the custom hooks in repository custom_hooks directory are not called.

Otherwise the custom hooks work as expected.

Detailed description

(Copied from GitLab issue #1156)

(Related to !1882 !1918)

This doesn’t have anything to do with the custom hooks itself, but with the trigger that invokes them when using GitLab web UI.

Let me describe the scenario. I have a repo in GitLab and a custom hook.

The following is working seamlessly when working from a local clone of the repo and pushing to GitLab:

Create a new tag and push it → custom hooks are called.
Delete a remote tag(e.g. git push --delete origin vX.Y.Z) → custom hooks are called.

However, if I do the same operations through GitLab web UI, the custom hooks are not called:

Create a new tag→ tagis created in GitLab, but the custom hooks are not called.
Delete the tag→ tag is deleted in GitLab, but the custom hooks are not called.

It seems that the code that needs to trigger the hooks events is not
being called. Part of that code does seem to exist because the custom
hooks are called when I do edit and merge operations through the web UI
or on creating or deleting a branch.

Steps to reproduce

Create a repository with a pre-receive hook on server-side.

Clone this repository locally
Create a tag : git tag 2.0.0-alpha
Push the tag : git push origin 2.0.0-alpha

Custom hook is called

! [remote rejected] 2.0.0-alpha -> 2.0.0-alpha (pre-receive hook declined)

Create a tag with web UI
Custom hook is not called.

Expected behavior

Custom hooks are called when creating a tag with web UI.