0

I am new to Jenkins, specially with using python script in Jenkins. The problem I am facing is as follow:

I am trying to run a python script from a python file in the post-build step of the Jenkins. I have added all the plugins required for that purpose to my understanding. i.e I have included Post-BuildScript plugin, python jenkins plugin etc. Now when I build console output shows invalid script command caused the failure. I have attached the results below. can anybody help me with that please? In post build step I am providing the full or absolute path to the python script file i.e

ExecutepythonScriptpath

Results

It may be useful to mention here I have also tried using just the path without writing python preceding the path, also tried with forward as well as backward slash in the path. without any success.

A 786
  • 488
  • 1
  • 6
  • 16

1 Answers1

0

I have managed to resolve that issue. There are two parts of solution: First one is if you want to run simple python script in post-build -->Add a post build step for Execute python Script (That will require you install plugin for post build ) . In that window created after adding post build step you can simply put any python command to run.

Second part of the solution is for, when user would like to run a list of commands from a python script file from the same post build step window in that case user has to make sure to put all the required python files which you want to execute into the Jenkins workspace->project directory(project for which we are running the Jenkins ) . Moreover, for Python2.7 in order to execute that python script file user simply need to write script as

execfile(file.py)

One more thing to remember is insert python.exe path in the environment variables.

A 786
  • 488
  • 1
  • 6
  • 16