CandyShop / gerrit

Automatically exported from code.google.com/p/gerrit
Apache License 2.0
1 stars 0 forks source link

Gerrit 2.3 | hook names are incorrect #1326

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Affected Version: 2.3

What steps will reproduce the problem?
1. Set up hooks for Gerrit with default settings
2. Undertake any event that should trigger a hook
3. Check hook has fired

What is the expected output?

The hook appropriate for the event should fire

What do you see instead?

Rather that the correct hook getting fired it fires 'gerrit-hook' instead. 
Setting the names explicitly using the "hooks" config section makes no 
difference.

This was working just fine for us until I upgraded to 2.3. The error_log output 
shows that up until that point the correct file names were being used and after 
that it always calls 'gerrit-hooks'.

Please provide any additional information below.

Original issue reported on code.google.com by evil...@gmail.com on 11 Apr 2012 at 6:33

GoogleCodeExporter commented 9 years ago
Ok, I've managed to resolve this. I basically stopped, moved the hooks folder, 
restarted Gerrit and moved the hooks folder back and it now works.

Truly odd. Unfortunately, I don't know enough (any thing) about Java to dig 
into this myself. If those who can want to close the ticket I opened please 
feel free but if you want to investigate and I can provide any further 
information please do let me know.

Original comment by evil...@gmail.com on 12 Apr 2012 at 1:26

GoogleCodeExporter commented 9 years ago

Original comment by mf...@codeaurora.org on 13 Apr 2012 at 12:39

GoogleCodeExporter commented 9 years ago
Seen similar issues after updating to 2.3. 

When using symbolic links to point to a common hook-script the first argument 
to the script will be changed after updating the common hook-script. 

As stated above, recreating the folder will make it operational again, but will 
fail again after updating the hook. 

Commenting an issue with comment-added symlinked to python-script gives:
sys.argv= ['/home/gerrit2/gerrit/hooks/comment-added', ... ]

After updating the python-script, commenting an issue gives:
sys.argv= ['/home/gerrit2/gerrit/hooks/hook', ... ]

Original comment by claus.ro...@lumigon.com on 16 May 2012 at 7:50

GoogleCodeExporter commented 9 years ago
Heh. Glad it wasn't just me going insane :)

Original comment by evil...@gmail.com on 16 May 2012 at 9:51

GoogleCodeExporter commented 9 years ago
I think the change here might be the server doing a "resolve" call on the file 
path. Which is possibly chasing symbolic links back to the original. And it 
does it a few times, once for "hooks" and again for the individual hook 
commands. And there may be some differences between startup and later during 
server execution. Ick.

I'm not sure when these changes were made, or why, but I was looking at the 
hook setup code over the weekend as I was looking at ejecting it to a plugin, 
and it was reading funny to me with all of the resolve calls here.

Original comment by sop@google.com on 16 May 2012 at 3:56

GoogleCodeExporter commented 9 years ago
You know, it would be nice if there was an option to just use one script and 
have the "hook" name passed in rather then having to have multiple scripts (or, 
as in my case, one script with symlinks). Both are valid solutions but I 
suspect having one script that can handle hooks is generally going to be 
simpler.

Original comment by evil...@gmail.com on 16 May 2012 at 6:06