简体   繁体   English

Jenkins Groovy 和 Active Choices 反应参数

[英]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.

相关问题 在活动选择反应参数中使用groovy脚本 - Using groovy script in active choices reactive parameter Jenkins Active Choices Reactive Parameter中的OutputStreamWriter替代方法 - OutputStreamWriter alternative in Jenkins Active Choices Reactive Parameter jenkins 管道中的主动选择反应参考参数 - Active Choices Reactive Reference Parameter in jenkins pipeline Jenkins 声明式管道:如何从“主动选择反应引用参数的 Groovy 脚本”调用函数? - Jenkins Declarative Pipeline: How to call functions from "Active choices reactive reference parameter's Groovy script"? 如何从 Jenkins 的活动选择反应参数中引用节点参数 - How to reference the node paramater from the active choices reactive parameter in Jenkins 查询 AWS CLI 以填充 Jenkins “Active Choices Reactive Parameter” (Linux) - Query AWS CLI to populate Jenkins “Active Choices Reactive Parameter” (Linux) 如何在 Jenkins 中为 Active Choices Reactive Parameter 插件设置默认值? - How to set default value for Active Choices Reactive Parameter plugin in Jenkins? Jenkins:从Active Choices参数groovy脚本访问其他插件 - Jenkins: Accessing other plugins from Active Choices Parameter groovy script 詹金斯:Active Choices参数+ Groovy基于REST响应对象构建列表 - Jenkins: Active Choices Parameter + Groovy to build a list based on REST responde Jenkins Groovy 主动选择反应参数引用的参数创建错误 - Jenkins Groovy Active Choice Reactive Parameter referenced parameter creates error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM