How to solve Jenkins run py script and pass parameters

aims

Jenkins run py script requires the incoming parameters

Question 1

Tip a variety of browsers run driver, class not found?

solve

Py using bat batch file to run the program, set the environment variable before running;

set path = (.....), note the contents of the value in parentheses path inside your computer environment variable.

Question 2

Jenkins needs to pass arguments to the bat file, bat file pass arguments to the py file?

solve

1, Jenkins set the parameters;

2, run the batch file to run before mass participation;

set starttime1=%starttime%
set endttime1=%endttime%
set environment1=%environment%

3, bat file to run py file transfer value;

C: \ Python27 \ python.exe zonghe.py starttime1%%%%% endttime1 environment1%

4, note that calls python.exe need to use absolute paths when running python script;

5, py program references a file bat incoming values.

the sys.argv [1], noted that beginning with the number 1, because the number 0 is acquired zonghe.py

 

So far all the problems have been solved

 

Guess you like

Origin www.cnblogs.com/ttssly13/p/11235925.html