mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 12:02:20 +00:00
removed the local posting support.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@4681 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
2132acffd4
commit
d4b1cc9d6f
1 file changed
+1
-35
@@ -1,14 +1,8 @@
|
||||
package hudson;
|
||||
|
||||
import hudson.model.ExternalJob;
|
||||
import hudson.model.ExternalRun;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.model.Result;
|
||||
import hudson.model.TopLevelItem;
|
||||
import hudson.util.DualOutputStream;
|
||||
import hudson.util.EncodingStream;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
@@ -43,41 +37,13 @@ public class Main {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(home.startsWith("http")) {
|
||||
return remotePost(args);
|
||||
} else {
|
||||
return localPost(args);
|
||||
}
|
||||
return remotePost(args);
|
||||
}
|
||||
|
||||
private static String getHudsonHome() {
|
||||
return EnvVars.masterEnvVars.get("HUDSON_HOME");
|
||||
}
|
||||
|
||||
/**
|
||||
* Run command and place the result directly into the local installation of Hudson.
|
||||
*/
|
||||
public static int localPost(String[] args) throws Exception {
|
||||
Hudson app = new Hudson(new File(getHudsonHome()),null);
|
||||
|
||||
TopLevelItem item = app.getItem(args[0]);
|
||||
if(!(item instanceof ExternalJob)) {
|
||||
System.err.println(args[0]+" is not a valid external job name in Hudson");
|
||||
return -1;
|
||||
}
|
||||
ExternalJob ejob = (ExternalJob) item;
|
||||
|
||||
ExternalRun run = ejob.newBuild();
|
||||
|
||||
// run the command
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
for( int i=1; i<args.length; i++ )
|
||||
cmd.add(args[i]);
|
||||
run.run(cmd.toArray(new String[cmd.size()]));
|
||||
|
||||
return run.getResult()==Result.SUCCESS?0:1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run command and place the result to a remote Hudson installation
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user