I am using Jenkins v:1.647 and the Pipeline plugin v: 1.14. My pipeline job pulls a groovy script which runs my orchestration. My issue is I have a executable jar that will perf
You can execute a shell command from the pipeline script using sh
step. The trick is to redirect the executed command's output to a file and then read it with readFile
in the next step.
This should do what you want on linux slave:
sh "java -jar scalr-api.jar testing654 n1-standard-8 > scalr.out"
def out = readFile 'scalr.out'
On windows slave:
bat "java -jar scalr-api.jar testing654 n1-standard-8 > scalr.out"
def out = readFile 'scalr.out'
As of version 2.4 of Pipeline: Nodes and Processes it suffices to use:
def out = sh script: 'java -jar scalr-api.jar testing654 n1-standard-8', returnStdout: true