Skip to content Skip to sidebar Skip to footer

Excute Python Script Throgh Groovy Script Using Job Dsl

Referring to the document: https://jenkinsci.github.io/job-dsl-plugin/#path/freeStyleJob-steps-python I am trying to configure my job automatically through groovy. The job will exe

Solution 1:

Jenkins DSL 'python' refers to the Shining Panda plugin not the python script plugin. This is worth bearing in mind if like me you use the python script plugin.

Sadly the python script plugin doesn't have an API but you can use a configure closure to add this direct.

configure { node ->
  node / builders / 'hudson.plugins.python.Python' / command << readFileFromWorkspace('<script location>')
}

This has worked for me as I like to read from script for simplicity or you could add direct with 'command( 'import os' )'

Post a Comment for "Excute Python Script Throgh Groovy Script Using Job Dsl"