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.
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 : https://www.jenkins.io/doc/pipeline/tour/hello-world/
Lookout for "Python" block.