[英]Jenkins Groovy and Active Choices Reactive Parameter
I have a perl script that return list of names taken from DB:我有一个 perl 脚本,它返回取自 DB 的名称列表:
perl -w /tmp/testdb.pl perl -w /tmp/testdb.pl
"Dana Ron Emily Ethan James Brandon Josef"
I want that Jenkins will show them in the Active Choices Reactive Parameter depends by the value chosen in the previous parameter我希望 Jenkins 将它们显示在Active Choices Reactive Parameter取决于在前一个参数中选择的值
This is the groovy script I have:这是我拥有的常规脚本:
def command = "perl -w /tmp/testdb.pl"
def proc = command.execute()
proc.waitFor()
def output = proc.in.text
List modifiedList = output.split(' ')
return modifiedList
When trying to run the build, it shows an empty list When I run this groovy script from command line (on the same jenkins machine) it works:尝试运行构建时,它显示一个空列表当我从命令行(在同一台 jenkins 机器上)运行这个 groovy 脚本时,它可以工作:
[Dana, Ron, Emily, Ethan, James, Brandon, Josef]
What am I doing wrong?我究竟做错了什么?
Try using:尝试使用:
List modifiedList = output.tokenize(' ')
Instead of:代替:
List modifiedList = output.split(' ')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.