System Hooks not firing
Closed
System Hooks not firing
Created by: mrenigma
Hi All,
I have been testing out system hooks as a possible way of linking Gitlab's events to another database on the server but the system hook is not firing.
The system hook works when testing using the "test" button, as well as when I fire the PHP script on its own but does not work when for instance a project is created.
I have used http://requestb.in as well to see if it was my script but the exact same thing occurs, were it only works when clicking the test button.
I read within this forum that you need to use $HTTP_RAW_POST_DATA to receive the JSON string of data and this works well when testing but no results otherwise, the data is received using the following:
$phpInput = file_get_contents("php://input");
$postData = (!empty($phpInput)) ? $phpInput : $HTTP_RAW_POST_DATA;
Is anyone else having this issue with Gitlab 2.7 and is there a possible solution to this?
Many Thanks, MrEnigma
Created by: mrenigma
Really? According to the hooks reference it says:
"Your Gitlab instance can perform HTTP POST request on next event: create_project, delete_project, create_user, delete_user, change_team_member."
That should be firing every time one of these events occurs shouldn't it?
By Administrator on 2012-08-08T16:03:16 (imported from GitLab project)
Created by: dzaporozhets
Hi. I've just tried System Hooks on my dev server. And it works for me.
My gitlab version is GITLAB 2.7.0 master 83975759
http://requestb.in/14v5zzb1?inspect
By Administrator on 2012-08-08T16:17:07 (imported from GitLab project)
Created by: mrenigma
hmm can I just confirm this is the correct syntax for the hook url?
I just tried again after updating Gitlab to the most recent master and still no go using the above syntax. Does it require me to include the Project ID etc within the URL?
By Administrator on 2012-08-08T16:32:23 (imported from GitLab project)
Created by: mrenigma
I've copied your requestb.in url: http://requestb.in/14v5zzb1
I have then added it to my System Hooks and created a project and then added a new team member... no response.
I also clicked the "Test" button and as you can see in your requestb.in that fired correctly.
By Administrator on 2012-08-08T16:44:23 (imported from GitLab project)
Created by: mrenigma
No failures in Resque, the system_hook log looks like this:
SystemHookWorker [9, {"event_name"=>"project_create", "name"=>"Test Project", "path"=>"test_project", "project_id"=>51, "owner_name"=>"Robert Hunt", "owner_email"=>"rob.hunt@plugandplaydesign.co.uk", "created_at"=>"2012-08-08T16:43:22Z"}]
SystemHookWorker [9, {"event_name"=>"user_add_to_team", "project_name"=>"Test Project", "project_path"=>"test_project", "project_id"=>51, "user_name"=>"Robert Hunt", "user_email"=>"rob.hunt@plugandplaydesign.co.uk", "project_access"=>"Master", "created_at"=>"2012-08-08T16:43:46Z"}]
Although I do have 77 jobs pending, so I am presuming that Resque and Redis are not working properly...damn
By Administrator on 2012-08-08T17:10:39 (imported from GitLab project)
Created by: mrenigma
Thanks for your guidance! :)
I had to resque not running on startup by using the following fix:
http://forkbomb-blog.de/2012/autostart-resque-for-gitlab-on-centos-6-2-with-rvm-installed
By Administrator on 2012-08-08T18:20:13 (imported from GitLab project)
Created by: riyad
Added this to the Trouble Shooting Guide. @mrenigma thx for your patience ;)
By Administrator on 2012-08-09T16:59:18 (imported from GitLab project)