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
- 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
- Create a project without
Webhooks
in theIntegration
page. - Push to this project.
- Notice the
/tmp/gitlab_plugin.log
file. It only contains the event forrepository_update
- Delete the file and configure a webhook for this project.
- Push to this project.
- Notice that there are now two events in
/tmp/gitlab_plugin.log
. One forpush
and one forrepository_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