Push events only triggering for projects with webhooks configured.

Summary

A customer reported that push events are only triggering for them in certain projects. Upon testing, it seems that push events will only trigger when there are Webhooks setup in Integrations page of the project.

Note: This was tested using the plugin system.

Steps to reproduce

  1. Create a new plugin.
#!/opt/gitlab/embedded/bin/ruby

require 'net/http'
require 'uri'
require 'json'

LOGFILE = '/tmp/gitlab_plugin.log'

# parse our input
ARGS = JSON.parse(STDIN.read)

# we only want to do something if this is a pipeline object
return unless ['push', 'repository_update'].include?(ARGS['event_name'])

#log event trigger
logmsg = JSON.pretty_generate(ARGS)

# log the event
open(LOGFILE, 'a+') do |f|
      f.puts logmsg
end
  1. Create a project without Webhooks in the Integration page.
  2. Push to this project.
  3. Notice the /tmp/gitlab_plugin.log file. It only contains the event for repository_update
  4. Delete the file and configure a webhook for this project.
  5. Push to this project.
  6. Notice that there are now two events in /tmp/gitlab_plugin.log. One for push and one for repository_update

Example Project

Create a project without a webhook configured

What is the current bug behavior?

When you push to the project, only repository_update event is generated and no push event.

What is the expected correct behavior?

Based on the description of push events here: https://docs.gitlab.com/ee/system_hooks/system_hooks.html#push-events push event should also be generated when pushing to a repository.

Customer info

ZD Ticket (Internal Only): https://gitlab.zendesk.com/agent/tickets/142524