I have a small issue regarding the Jenkins build after SVN commit. i have configured a jenkins.vb script to call after the post-commit hook, but the build is not triggering after the commit.
When i pass the Repository path and revision # through command line , the build gets triggered.
Can any one help me out of this issue. please find below the post-commit hook and jenkins.vbs file Jenkins Url to trigger build : http:\server-name\job\branchname\build?delay=2sec
post commit hook :
@echo on
rem POST-COMMIT HOOK
set REPOS=%1
set REV=%2
SET CSCRIPT=C:\WINNT\system32\cscript.exe
SET VBSCRIPT=D:\SVN\hooks\post-commit-hook-jenkins.vbs
SET SVNLOOK=C:\Subversion\bin\svnlook.exe %VBSCRIPT% %REPOS% %REV%
Jenkins.vbs
repos = WScript.Arguments.Item(0)
rev = WScript.Arguments.Item(1)
svnlook = "C:\Subversion\bin\svnlook.exe"
jenkinsBaseUrl = **JenkinsURL** (unable to paste the URL would be in this format "URL:8080")
Set shell = WScript.CreateObject("WScript.Shell")
Set uuidExec = shell.Exec(svnlook & " uuid " & repos)
Do Until uuidExec.StdOut.AtEndOfStream
uuid = uuidExec.StdOut.ReadLine()
Loop
' Create a list of all branches that have been modified.
Dim branches()
ReDim Preserve branches(-1)
Set changedExec = shell.Exec(svnlook & " changed --revision " & rev & " " & repos)
Do Until changedExec.StdOut.AtEndOfStream
fileChanged = changedExec.StdOut.ReadLine()
' Get the branch names if any
If InStr(fileChanged, "source/branches/") Then
branchStartIndex = InStr(fileChanged, "source/branches/") + 38
branch = Mid(fileChanged, branchStartIndex)
branchEndIndex = InStr(branch, "/") - 1
branch = Left(branch, branchEndIndex)
branchFound = False
For count = 0 to UBound(branches)
If (CStr(branches(count)) = CStr(branch)) Then
branchFound = True
End If
Next
' Add the branch if it was not previously added
If branchFound = False Then
ReDim Preserve branches(UBound(branches) + 1)
branches(UBound(branches)) = branch
End If
End If
Loop
' the above code gives the branch name in which the check-in has been done (THE ABOVE CODE WORKS FINE)
' Fire out a build for every branch that has changed
For count = LBound(branches) to UBound(branches)
url = jenkinsBaseUrl + "/job/" & branches(count) & "/build?delay=0sec"
Set http = CreateObject("Microsoft.XMLHTTP")
http.open "POST", url, False
http.setRequestHeader "Content-Type", "text/plain;charset=UTF-8"
http.send changed
Next