Reputation: 17
The main purpose is that I want to commit some files to SVN repository and trigger the jenkins to build some test automatically.The method I want to use is post-commit hook.
I use TortoiseSVN , and I create a repository to test. I change the post-commit.tmpl to post-commit.bat which is in D:\Repository\hooks folder.
below is what in the post-commit.bat : (Windows 10)
SET REPOS=%1
SET REV=%2
FOR /f "tokens=*" %%a IN (
'svnlook uuid %REPOS%'
) DO (
SET UUID=%%a
)
FOR /f "tokens=*" %%b IN (
'svnlook changed --revision %REV% %REPOS%'
) DO (
SET POST=%%b
)
D:/Wget/wget ^
--header="Content-Type:text/plain;charset=UTF-8" ^
--post-data="%POST%" ^
--output-document="-" ^
--timeout=2 ^
http://localhost:8080/jenkins/subversion/%UUID%/notifyCommit?rev=%REV%
the error messages is:
post-commit hook failed (exit code 8)with output:
--2019-09-23 13:50:53--
http://localhost:8080/"realUUID"/notifyCommit?rev=7
Resolving localhost(localhost)... ::1, 127.0.0.1
Connecting to localhost(localhost)|::1|:8080... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-09-23 13:50:53 ERROR 404: Not Found
what I have done is: 1.change jenkins settings to "Allow anonymous read access" 2.cancel CSRF protection
I have no idea what is the main step that SVN communicate with Jenkins.
Please help , and thanks for your answer!
Upvotes: 1
Views: 1347
Reputation: 30662
The error that you receive is HTTP 404 NOT FOUND
and you need to examine your hook script for errors:
HTTP request sent, awaiting response... 404 Not Found
2019-09-23 13:50:53 ERROR 404: Not Found
Therefore, the URL that wget
contacts is invalid: http://localhost:8080/jenkins/subversion/%UUID%/notifyCommit?rev=%REV%
. You need to double-check the URL for typos and that the %UUID% is correct. Note that I do not see any SET for %UUID% in your hook - maybe it is the problem?
Upvotes: 1