0

I am completely new at jenkins. I installed the windows package and tried it out but I am a little lost. Here is my issue. I basically need jenkins to run a python script located on my computer. It's a scipt that has 1 line

print("hello World")

I created a new build setup with the following under the Build Environment "Execute windows batch command"

cd "C:\perforce\projects\DEV\E9318_SuperNova\P22_module_split_up\Ref\Tools\"
"C:\perforce\projects\DEV\E9318_SuperNova\P22_module_split_up\Ref\Tools\test.py"

The console output from the build

Building in workspace C:\Program Files (x86)\Jenkins\workspace\E9318_SuperNova-P22_Compensator_FPGA_PSA
[E9318_SuperNova-P22_Compensator_FPGA_PSA] $ cmd /c call C:\windows\TEMP\jenkins7605841087640242580.bat

C:\Program Files (x86)\Jenkins\workspace\E9318_SuperNova-P22_Compensator_FPGA_PSA>cd "C:\perforce\projects\DEV\E9318_SuperNova\P22_module_split_up\Ref\Tools\" 

C:\perforce\projects\DEV\E9318_SuperNova\P22_module_split_up\Ref\Tools>"C:\perforce\projects\DEV\E9318_SuperNova\P22_module_split_up\Ref\Tools\test.py"

C:\perforce\projects\DEV\E9318_SuperNova\P22_module_split_up\Ref\Tools>exit 103 
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

I am not sure what I am doing wrong. Any help would be highly appreciated, Thanks, Amish

axr 0284
  • 113
  • 1
  • 9

2 Answers2

0

*.py files don't seem to be executable directly (as invoked from a shell) Change the second line of your script with :

"C:\path\to\python.exe" "C:\perforce\projects\DEV\E9318_SuperNova\P22_module_split_up\Ref\Tools\test.py"

Anyway, this form field is expecting the path to a script that makes the build and runs the tests.

glenfant
  • 1,298
  • 8
  • 9
  • but python.exe is in the windows path, is the jenkins path different – axr 0284 Aug 15 '17 at 15:25
  • Being in the Windows PATH does not imply that Jenkins "knows" this "test.py" is supposed to be executed by some python.exe. Did you test the suggested solution ? – glenfant Aug 15 '17 at 15:33
0

I will also refer to How to set the PATH environment variable in Jenkins configuration on Windows? as a possible solution. After I added the python executable path to the node's path, I could call my script using python.exe "C:\perforce\projects\DEV\E9318_SuperNova\P22_module_split_up\Ref\Tools\test.py"

axr 0284
  • 113
  • 1
  • 9