pre-receive hook fails with RTC - Git integration during push
Pushing commit to server - error of Repository ssh://git@mint-rtc/opt/git_repos/groovyTest.git
pre-receive hook declined
The chunk of code this comes from is
while read old_sha1 new_sha1 ref_name; do
qs+="new_sha1=$new_sha1&"
ref_name_escaped=`echo $ref_name | sed -r -e 's/\//%2F/g' -e 's/\./%2E/g' -e 's/-/%2D/g' -e 's/_/%5F/g' -e 's/\!/%21/g' -e 's/#/%23/g' -e 's/\&/%26/g' -e 's/\(/%28/g' -e 's/\)/%29/g' -e 's/\*/%2A/g' -e 's/\+/%2B/g' -e 's/,/%2C/g' -e 's/:/%3A/g' -e 's/\;/%3B/g' -e 's/\=/%3D/g' -e 's/\?/%3F/g' -e 's/\@/%40/g' -e 's/\[/%5B/g' -e 's/\]/%5D/g' -e 's/ /%20/g'`
This is running on mint Linux so I changed "qs+=" to "qs=$qs+" and tried again. No longer get the above error message. Instead I get Repository ssh://git@mint-rtc/opt/git_repos/groovyTest.git
pre-receive hook declined
I echo'd the value of qs and that looks good - +old_sha1=affa26a084ee600825d7bfa1910b5d6c74776fd0&+new_sha1=bc9ef3284f7f5a93587cad3c9a17ff3921c63a17&+ref_name=refs%2Fheads%2Fmaster& the script then calls ValidatePush.js which is where the oldSha1s variable is used. And is where it now fails. So after debugging I noticed that the javescript looks for "old_sha1" but the object has it stored as " old_sha1". So I changed the script and now get to the next problem which is
pre-receive hook declined
Ignoring my console.log to show the variables, I can't find anything that outputs "Invalid input". Has anyone got the fixes to make this work? Is it fixed in RTC 6.0.2 as I am using 6.0.1? I looked at the script in 6.0.2 and it is indentical to the 6.0.1. Regards, John
|
2 answers
There seem to be quite a few problems with the node.js code with the git integration. I still have not got it to work but the I noticed that the user.name value in git config must be a single word, no spaces. So if you have "Fred Flintstone" then the object generated in the javascript code has user = "Fred" and email = "Flintstone". When I amended the commit to change author to single word then that got me to the next problem. This is that a "gitUser" value is set using the REMOTE_USER env var. But this is undefined. And that gives "Invalid input" error. So not sure how that is set. Comments
Winston Enos
commented Dec 03 '17, 1:09 p.m.
Yeah, same here.
john norris
commented Dec 04 '17, 4:01 a.m.
The disturbing thing is that I raised this 18 months ago and by the sounds of it still has not been fixed.
The rational solution for RTC/Git integration really does need rethinking.
|
Hi,
You can try it:
The issue exists only for Ubuntu OS, as "sh" shell does not find nodegit because from Ubuntu 6.10, the default system shell, /bin/sh, was changed to dash To make the integration working, we need to change the hooks scripts shell from bin/sh to /bin/bash. Edit the pre-receive and post-receive hooks file and change the below entries: #!/bin/sh to #!/bin/bash
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.