* Using Jenkins Script Console to Download Files
Scenario::
ServerA has a file test.t want to copy to ServerB, But don't have login user on ServerB.
And ServerB running a Jenkins server, we can access.
Solutions::
On ServerA:
1. goto folder of test.t
2. execute python -m SimpleHTTPServer
19:41 ~
Serving HTTP on 0.0.0.0 port 8000 ...
On Jenkins::
1. execute following code in Jenkins's Script Console.
String cmd ="curl <ip_of_server_A>:8000/test.t -o test.t";
Runtime run = Runtime.getRuntime();
Process pr = run.exec(cmd);
pr.waitFor();
BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = "";
while ((line=buf.readLine())!=null) {
println line;
}Then, test.t will located in Home folder of user who running the Jenkins.
2. Surely, any Groovy Script can execute here.
2012-09-03
Using Jenkins' Script Console to Download Files
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment