Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
-
CloudBees CI (CloudBees Core) on traditional platforms - Client controller
-
CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
-
CloudBees Jenkins Enterprise
-
CloudBees Jenkins Enterprise - Managed controller
-
CloudBees Jenkins Enterprise - Operations center
Resolution
Add the step Execute Groovy Script on controller
in the cluster-operation, then use groovy as a wrapper to execute the bash script, for example:
def exec(cmd) { println cmd def process = new ProcessBuilder([ "sh", "-c", cmd]) .directory(new File("/tmp")) .redirectErrorStream(true) .start() process.outputStream.close() process.inputStream.eachLine {println it} process.waitFor(); return process.exitValue() } [ "echo hello world", "ls -al" ].each { exec(it) }
Workaround
Create a freestyle / pipeline job on the controllers. Use this job to run the bash script using the shell step. Create a regular job on CJOC and use Cluster-wide job trigger to trigger the newly created jobs on your controllers.