I am working on creating jenkins job from groovy script using DSL plugin apis. I want to add 'Execute python script' as a step in jenkins job. Here is what I am doing following this post:
job('example') {
description('My first job')
displayName('Job DSL Example Project')
properties {
sidebarLinks {
// use uploaded image
link('https://wiki.acme.org/', 'Wiki', '/userContent/wiki.png')
}
}
steps {
python{
command(''' print("Hello")''')
nature('python')
}
}
}
In the generated job, the step added is "Python Builder" step as shown in image below. Instead I wanted to have "Execute Python script" step as shown below.
Note:I have installed the shining panda plugin.
Job DSL only has built-in support for the Shining Panda plugin and will generate the "Python Builder" build step. The "Execute Python script" build step is provided by the Python plugin.
You can use a Configure Block to add that (or any other) build step:
job('example') {
configure {
it / 'builders' / 'hudson.plugins.python.Python' {
command('print("Hello")')
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.