Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var path = WScript.Arguments(0);
var rev = WScript.Arguments(1);
var WshShell = new ActiveXObject("WScript.Shell");
var expectedDir = WshShell.ExpandEnvironmentStrings("%EXPECTED_DIR%");
var svnlook = WshShell.ExpandEnvironmentStrings("%SVNLOOK%");
var jenkinsUrlPrefix = WshShell.ExpandEnvironmentStrings("%JENKINS_URL_PREFIX%");
var dirsChanged = WshShell.Exec(svnlook + " dirs-changed " + path + " -r " + rev).StdOut;
while (!dirsChanged.AtEndOfStream) {
var dir = dirsChanged.ReadLine();
if (dir.match(expectedDir)) {
var author = WshShell.Exec("\"" + svnlook + "\" author " + path + " -r " + rev).StdOut.ReadLine();
var url = jenkinsUrlPrefix + "AUTHOR=" + author + "&REV=" + rev;
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.onreadystatechange = function() {
if (http.readyState == 4) {
WScript.Echo(http.status + " " + http.statusText);
WScript.Echo(http.responseText);
}
}
http.open("GET", url, false);
http.send();
break;
}
}
SET SVNLOOK="C:\Program Files (x86)\VisualSVN Server\bin\svnlook.exe"
SET TOKEN=xxxxxxxxxxxxxxxxxxx
SET JENKINS_URL_PREFIX=http://192.168.1.113:8080/job/paraiso-all/buildWithParameters?token=%TOKEN%^&
SET EXPECTED_DIR=^^All/trunk(/^|$)
cscript.exe //E:jscript "%~dp0"jenkins-post-commit.js %*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.