I'm using groovy to get some parameters to run jobs in jenkins.
My question is why script A work's and B and C don't
A
def sout = new StringBuilder(), serr = new StringBuilder()
def proc = 'ls -D --format=single-column /path/folder'.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println "out> $sout err> $serr"
return sout.tokenize()
B The \\ is to escape \
def proc = 'find /path/folder/ -type f \\( -iname \\*.ear -o -iname \\*.war \\)'.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println "out> $sout err> $serr"
return sout.tokenize()
C script.sh return a list of files
def sout = new StringBuilder(), serr = new StringBuilder()
def proc = '/scripts/script.sh'.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println "out> $sout err> $serr"
return sout.tokenize()
There is some jenkins restriction to run scripts from groovy or certainly shell commands?