Jenkins is on my machine, SVN server on another machine. So I'm using Putty to access to all the hooks on that machine.
In the global security section I have "Jenkins users database" checked, in autorisations I use matrix based security and I already gave anonymous users Read permission for jobs; As for my job config I already checked the SCM polling option and have a valid CRON (which works perfectly), also I checked "trigger builds remotely" and provided my own token (works fine too).
Do you think it might have something to do with the credentials that I set for Jenkins job to link with my repo on SVN? I haven't quite understood how this affects the commit: should I add something like --username and --userpassword into my post-commit hook accordingly to my credentials settings? Or is this because SVN is not on my machine and I'm using a SSH client to access hooks there yet I haven't set SSH server option in Jenkins?
What might be the problem in your opinion? Does someone know how to use post-commit hook? Thank you so much if someone can provide some advice and insights :)
Re: Post commit hook failed with exit code 127: --post-data not found
On Tue, 15 May 2018, jack wrote:
> Hi everyone,
> I'm recently working on this automation solution for my dev team using SVN
> as version control, to run builds and tests automatically when a commit
> But each time when I commit my post-commit hook script fails me :/
> post-commit hook failed (exit code 127) with output:
> /url/to/our/svnServer/hooks/post-commit: 67: --post-data: not found (which
> is odd : the --post-data line is not at line 67 which is the last line of
> the file)
> I'm not able to find the exact same problem on the web so no solution
> found... My script looks like this (the same script from the official doc):
> #path to svnlook
> UUID=`svnlook uuid $REPOS`
> #notifying jenkins for repository change
> /usr/bin/wget \
> --header `wget -q --output-document - \
> --post-data "`svnlook changed --revision $REV $REPOS`" \
> --timeout=2 \
While this isn't a Jenkins issue at all, I'll give ya a hand :)
There's a trailing \ character which is missing after the crumbIssuer line in
the script, causing the script interpreter to try to parse the next line as if
it were a new command (`--post-data`)
I copied this directly from jenkins official doc, so very curious why they forgot to put that final \ at the end of the line;
Human mistake. Can you please tell us the link where you saw that so that we can fix it? Or even better fixing it yourself through a PR :). There's a link at the bottom of the page to reach the page corresponding page on the git repo.
But still... I called a colleague and he added the \ at the end but we got immediately another error... which I don't remember anymore.
Finally I disabled the XSRF option in jenkins and used the script without crumb, and it fianlly worked lol