I want to run a python script from Jenkins using Jenkinsfile. Is there any way to run it directly from Jenkinsfile.

I found python plugin(Click Here) in Jenkins to run a script, but there is no proper documentation for this plugin. It would be very helpful if anyone explains how to integrate this plugin with Jenkinsfile.

1 Answer

Adds the ability to execute python scripts as build steps. Other than that, this plugin works pretty much like the standard shell script support

Per the docs of the plugin. Though I have not used this plugin through pipeline, from job perspective, you have to just provide .py script (filename and path), in a same way you provide for shell/powershell script.

Similarly, even for python, you'll be executing the script on a node, which will be either Linux or Windows.

So, it would work as below :

stage('build') { steps { sh 'python abc.py' } } 

References :

Lookout for "Python" block.

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.