I have two Jobs in Jenkins, one which has a working copy of "subversion/repos/mainframe" and another that has a working copy of "subversion/repos/mainframe/subdir".
I then created a hook on the mainframe repository to call Jenkins on any commit. This hook has been triggering my first Job without a Problem. But the second Job doesn't get triggered at all. The only difference is that the second Job is set to a subdirectory inside the repository and i'd like to keep it that way. Even when i commit a file inside "subversion/repos/mainframe/subdir" the second Job doesn't get polled, only the first.
How can i trigger the second Job with a post-commit hook?
post-commit.cmd in hooks:
\...\post-commit.exe %1 %2
post-commit.exe (cleaned up):
' read Parameters
sArchive = Environment.GetCommandLineArgs(1)
sRevision = Environment.GetCommandLineArgs(2)
' get UUID
Dim process As New Process()
process.StartInfo.FileName = "svnlook.exe"
process.StartInfo.Arguments = "uuid " + sArchive
process.StartInfo.UseShellExecute = False
process.StartInfo.RedirectStandardOutput = True
process.Start()
Dim reader As StreamReader = process.StandardOutput
UUID = reader.ReadLine()
wrGETURL = System.Net.WebRequest.Create(jenkinsTESTURL + UUID.Trim() + "/notifyCommit?rev=" + sRevision)
wrGETURL.Method = "POST"
Dim postData As String = "`svnlook changed --revision " + sRevision + " " + sArchive + "`"
Dim byteArray As Byte() = Text.Encoding.UTF8.GetBytes(postData)
wrGETURL.ContentType = "text/plain;charset=UTF-8"
wrGETURL.ContentLength = byteArray.Length
Dim dataStream As Stream = wrGETURL.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Jenkins Log (only the first Job gets triggered):
Mai 10, 2016 11:37:11 AM INFO jenkins.scm.impl.subversion.SubversionSCMSource$ListenerImpl onNotify
Received post-commit hook from 0e020a5b-918e-1147-8b68-31c6afce54ec for revision 152.138 on paths [look changed --revision 152138 D:\svn\testrepos\mainframe`]
Mai 10, 2016 11:37:11 AM INFO jenkins.scm.impl.subversion.SubversionSCMSource$ListenerImpl onNotify
No subversion consumers for UUID 0e020a5b-918e-1147-8b68-31c6afce54ec
Mai 10, 2016 11:37:11 AM INFO hudson.triggers.SCMTrigger$Runner run
SCM changes detected in PostcommitHook-Test. Triggering #52
Mai 10, 2016 11:37:20 AM INFO hudson.model.Run execute
PostcommitHook-Test #52 main build action completed: SUCCESS
Edit:
Simply changing the second Job to point to "subversion/repos/mainframe/" works. Then the trigger calls both Jobs. It's just not a workable solution because then it gets called way too many times for commits that shouldn't affect the Job.