Search code examples
jenkinsjenkins-pluginsjenkins-clijenkins-job-dsljenkins-scriptler

How to configure multiple shell steps within Job DSL


How can i configure multiple shell steps within Job DSL?
I am configuring a single shell step as below:

project / builders / 'hudson.tasks.Shell' {
command 'cd $WORKSPACE/dir1'
}

Solution

  • I found that I should be able to use the shell() method, which can be called multiple times to create multiple shell steps.

    https://jenkinsci.github.io/job-dsl-plugin/#path/freeStyleJob-steps-shell