Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #1205

Closed
Open
Created 12 years ago by Administrator@rootOwner
  • New issue

  • Report abuse

  • New issue

  • Report abuse

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

Linked issues
...

    Related merge requests

    • Administrator
      Administrator @root · 12 years ago
      Owner

      Created by: koenpunt

      As far as I know the hooks are only fired on push actions..

      By Administrator on 2012-08-08T15:17:44 (imported from GitLab project)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      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)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      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)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      Created by: mrenigma

      hmm can I just confirm this is the correct syntax for the hook url?

      http://domain.com/update.php

      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)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      Created by: dzaporozhets

      Can you confirm that requestb.in working for you?

      By Administrator on 2012-08-08T16:37:57 (imported from GitLab project)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      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)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      Created by: dzaporozhets

      Can you look at resque? All system hooks send via resque jobs. Maybe you have some failed?

      By Administrator on 2012-08-08T16:57:10 (imported from GitLab project)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      Created by: dzaporozhets

      Resque can be found in admin section

      By Administrator on 2012-08-08T16:57:28 (imported from GitLab project)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      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)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      Created by: dzaporozhets

      yeap. this why hooks not fired. Handle resque problem and all will be ok. Please close an issue after you verified its ok

      By Administrator on 2012-08-08T17:12:13 (imported from GitLab project)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      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)

    • Administrator
      Administrator @root · 12 years ago
      Owner

      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)

    • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
    Please register or sign in to reply
    0 Assignees
    Assign to
    Milestone
    No milestone
    None
    None
    Time tracking
    Due date
    None
    None
    0
    Labels
    None
    Assign labels
    • No matching results
    • Manage project labels
    Confidentiality
    Not confidential

    You are going to turn on confidentiality. Only team members with at least Reporter access will be able to see and leave comments on the issue.

    Lock issue
    Unlocked
    participants
    Reference: