Skip to content

Post Receive URL not called on push #549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
derkaan opened this issue Dec 7, 2015 · 21 comments
Closed

Post Receive URL not called on push #549

derkaan opened this issue Dec 7, 2015 · 21 comments
Assignees
Labels

Comments

@derkaan
Copy link

derkaan commented Dec 7, 2015

Hi,

I'm struggling to get Post Receive URLs working and not sure if it is a misconfiguration or misinterpretation of the documentation.

We want to configure a repository with an post receive url, so that a chosen URL gets called on pushes.
Here are some details of what I did so far and my setup:

Project Setup:

  • We've setup a project in Redmine e.g. myProject
  • We created 4 repositories belonging to "myProject" (these are subprojects, therefore there are 4 repos)
  • All repositories can be pulled and pushed. Changes are also visible in Redmine
  • Post Receive URL added in the repository config for one repository:

Git Hosting Setup:

  • Installed based on the details of the details found on http://redmine-git-hosting.io/
  • relevant .gitolite.rc params: GIT_CONFIG_KEYS => '.*', LOCAL_CODE => "$ENV{HOME}/local"
  • Offered hooks in redmine config are installed and "Config Test"-Tab has green checkmarks on each config setting (incl. hooks)

Server/SW Setup:

Let me know if you need further details.

Thanks.

@derkaan
Copy link
Author

derkaan commented Dec 8, 2015

Hi, we do need this call/trigger to kick-off the continues integration as well as to do deployments.
Any hint or tip?

@n-rodriguez n-rodriguez self-assigned this Dec 10, 2015
@n-rodriguez
Copy link
Contributor

All repositories can be pulled and pushed. Changes are also visible in Redmine

Well it should work out of the box. You should have additional lines in git push output.

@derkaan
Copy link
Author

derkaan commented Dec 10, 2015

"git push" does his regular job but without any additional lines.
It just shows the usual processing messages but nothing in terms of executed hooks ( I assume these are the additional lines you meant, right?)

@n-rodriguez
Copy link
Contributor

This is what you should get :

nicolas@tchoum-desktop:~/test-nico$ echo 'ecoucouc' >> toto.php && git commit -a -m test && git push -u origin master 
[master bdc1df3] test
 1 file changed, 1 insertion(+)
Décompte des objets: 3, fait.
Delta compression using up to 4 threads.
Compression des objets: 100% (3/3), fait.
Écriture des objets: 100% (3/3), 293 bytes | 0 bytes/s, fait.
Total 3 (delta 2), reused 0 (delta 0)

Notifying Redmine about changes to this repository : 'test-nico/' ...
  - Fetching changesets for 'test-nico' repository ...  [success]

Notifying post receive urls about changes to this repository :
  - Notifying http://example.com ...  [success]

Calling additional post-receive hooks...
  - Executing extra hook 'hooks/post-receive.d/mail_notifications'
    multimailhook is disabled

To ssh://git@xxx/jbox-tests/test-nico.git
   7d2535b..bdc1df3  master -> master
La branche master est paramétrée pour suivre la branche distante master depuis origin.

@derkaan
Copy link
Author

derkaan commented Dec 11, 2015

when I push back to the server the hooks-section is comletely missing:

$echo `date +%Y%m%d-%H%M` >> TestFile && git commit TestFile -m "Testing notifications" && git push origin master 
[master 49b9818] Testing notifications
 1 file changed, 1 insertion(+)
Warning: Permanently added '12.34.56.78' (RSA) to the list of known hosts.
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 299 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To ssh://[email protected]/mainrepo/therepo.git
   1aaea34..49b9818  master -> master

The push command doesn't create any log file entry in my-redmine/logs/[production.log | git_hosting.log]

In case it helps: this is what I see in the gitolite-log:

2015-12-11.09:35:58 30977   ssh ARGV=redmine_user_3 SOC=git-receive-pack '/mainrepo/therepo.git'    FROM=98.76.54.32
2015-12-11.09:35:58 30977   pre_git mainrepo/therepo    redmine_user    W   any refs/.*
2015-12-11.09:35:58 30977       system,git,shell,-c,git-receive-pack '/opt/gitolite/repositories/mainrepo/therepo.git'
2015-12-11.09:35:58 30977   update  mainrepo/therepo    redmine_user_3  W   refs/heads/master   fa3b4e4747c8d0d23d24a6129e9a7566a180ca40    3b471bd8774fdb69e32f5858d583fc792436c2f9    refs/.*
2015-12-11.09:35:58 30977   END

@derkaan
Copy link
Author

derkaan commented Dec 15, 2015

Any idea what the issue might be?

@derkaan
Copy link
Author

derkaan commented Dec 17, 2015

Hi, after reviewing and comparing again the local setup with the setup instructions we still can't get the post receive urls working.
I assume that others are also using this functionality for e.g. continues integration or other tasks that needs to be kicked off.

@derkaan
Copy link
Author

derkaan commented Jan 1, 2016

Any update/suggestion?

@n-rodriguez
Copy link
Contributor

Hi! The hooks don't seem to be called. Check your Gitolite install, specially repositories hooks.
It should look like this :

git:~/repositories/tests.git/hooks$ ll
total 44
-rw-r----- 1 git git  452 Apr 14  2013 applypatch-msg.sample
-rw-r----- 1 git git  896 Apr 14  2013 commit-msg.sample
lrwxrwxrwx 1 git git   32 Nov 18 10:33 lib -> /data/git/local/hooks/common/lib
-rw-r----- 1 git git  160 Apr 14  2013 post-commit.sample
lrwxrwxrwx 1 git git   41 Nov 18 10:33 post-receive -> /data/git/local/hooks/common/post-receive
lrwxrwxrwx 1 git git   43 Nov 18 10:33 post-receive.d -> /data/git/local/hooks/common/post-receive.d
-rw-r----- 1 git git  552 Apr 14  2013 post-receive.sample
-rw-r----- 1 git git  189 Apr 14  2013 post-update.sample
-rw-r----- 1 git git  398 Apr 14  2013 pre-applypatch.sample
-rw-r----- 1 git git 1578 Apr 14  2013 pre-commit.sample
-rw-r----- 1 git git 1239 Apr 14  2013 prepare-commit-msg.sample
-rw-r----- 1 git git 4951 Apr 14  2013 pre-rebase.sample
lrwxrwxrwx 1 git git   39 Nov 18 10:33 update -> /data/git/.gitolite/hooks/common/update
-rw-r----- 1 git git 3611 Apr 14  2013 update.sample

@derkaan
Copy link
Author

derkaan commented Jan 11, 2016

Hi, still no luck. Our hooks directory looks similar to yours:

$ls -la /opt/gitolite/repositories/mainrepo/therepo.git/hooks/
total 48K
drwx------ 2 git git 4.0K Dec  4 16:05 .
drwx------ 7 git git 4.0K Jan  6 07:21 ..
-rwx------ 1 git git  452 Dec  4 07:19 applypatch-msg.sample
-rwx------ 1 git git  896 Dec  4 07:19 commit-msg.sample
lrwxrwxrwx 1 git git   40 Dec  4 16:05 lib -> /opt/gitolite/.gitolite/hooks/common/lib
lrwxrwxrwx 1 git git   49 Dec  4 16:05 post-receive -> /opt/gitolite/.gitolite/hooks/common/post-receive
lrwxrwxrwx 1 git git   51 Dec  4 16:05 post-receive.d -> /opt/gitolite/.gitolite/hooks/common/post-receive.d
-rwx------ 1 git git  189 Dec  4 07:19 post-update.sample
-rwx------ 1 git git  398 Dec  4 07:19 pre-applypatch.sample
-rwx------ 1 git git 1.7K Dec  4 07:19 pre-commit.sample
-rwx------ 1 git git 1.3K Dec  4 07:19 prepare-commit-msg.sample
-rwx------ 1 git git 1.4K Dec  4 07:19 pre-push.sample
-rwx------ 1 git git 4.8K Dec  4 07:19 pre-rebase.sample
lrwxrwxrwx 1 git git   43 Dec  4 16:05 update -> /opt/gitolite/.gitolite/hooks/common/update
-rwx------ 1 git git 3.6K Dec  4 07:19 update.sample

@bes1002t
Copy link

is ruby installed for your git user? if not the ruby post-receive hook could not be called. For my requirements I have a non ruby hook, but if you install ruby for your git user, it should work anyway.

@derkaan
Copy link
Author

derkaan commented Feb 1, 2016

Thanks for the tip.
(the same) ruby is installed and available for the git and redmine user.
Is there any way to debug or log very verbose to see what the issue might be?

@bes1002t
Copy link

bes1002t commented Feb 1, 2016

mh maybe you can write some output to the hook and if you push something to your repo this should be printed to the terminal where you push.

@madc
Copy link

madc commented Feb 2, 2016

I'm facing the same issue. Everything working as expected, except the hooks on push seem not to be called.

Push output:

Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 277 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://git@<ip>/redmine/my-test2.git
   602c090..3e3aece  master -> master

Redmine 3.2.0.stable
redmine_git_hosting 1.2.0
git version 2.1.4
gitolite3 3.6.1-2

@madc
Copy link

madc commented Feb 2, 2016

Also, should the Hooks Url (in the blue badge, like http://<ip>/redmine/githooks/post-receive/redmine)
be callable in the browser? Says "Page not found" for me (with GET and POST).

But in the hooks dir inside the repository itself, it seems to miss the symlinks:

-rwx------ 1 git git  452 Feb  2 20:20 applypatch-msg.sample
-rwx------ 1 git git  896 Feb  2 20:20 commit-msg.sample
-rwx------ 1 git git  189 Feb  2 20:20 post-update.sample
-rwx------ 1 git git  398 Feb  2 20:20 pre-applypatch.sample
-rwx------ 1 git git 1642 Feb  2 20:20 pre-commit.sample
-rwx------ 1 git git 1239 Feb  2 20:20 prepare-commit-msg.sample
-rwx------ 1 git git 1352 Feb  2 20:20 pre-push.sample
-rwx------ 1 git git 4898 Feb  2 20:20 pre-rebase.sample
lrwxrwxrwx 1 git git   39 Feb  2 22:28 update -> /home/git/.gitolite/hooks/common/update
-rwx------ 1 git git 3611 Feb  2 20:20 update.sample

@bes1002t
Copy link

bes1002t commented Feb 2, 2016

you did something wrong at the installation. normally there is a "post-receive -> /home/git/.gitolite ...." symlink for every project in your gitolite repository directory

@madc
Copy link

madc commented Feb 3, 2016

Oh, OK. I don't want to hijack this issue than, i'll figure it out. Thanks.

@jblobb
Copy link

jblobb commented Feb 8, 2016

Hi @madc it sounds like you're having the same issue I had.

This is what I did to correct the issue #567 (comment)

@madc
Copy link

madc commented Feb 8, 2016

Thanks for the hint, but it was a much simpler issue. I set $ENV{HOME}/local in the gitolite config, but did not set the same value (local/) in Redmine (Administration > Redmine Git Hosting > Storage > Gitolite non-core hooks directory).

Works like a charm now.

@n-rodriguez
Copy link
Contributor

n-rodriguez pushed a commit that referenced this issue Jul 23, 2016
@n-rodriguez
Copy link
Contributor

n-rodriguez commented Jul 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants