需要时髦脚本的帮助。
我们在 github 中有一个 perl 脚本。我们需要在 groovy 脚本 (jenkins( 中下载并运行 perl-script,并将参数传递给脚本并获取输出。
例如,github中的Perl脚本接受参数"item1"item2",使用curl我们得到脚本的原始格式。
def command = "curl -s https://github.com/raw/script.pl?token=%3D"
def proc = command.execute() | "perl /dev/stdin $item1 $item2".execute()
proc.waitFor()
def roles = []
roles = "${proc.in.text}" .eachLine { line ->
roles << line
}
return roles
上面的脚本不返回预期的结果。请帮忙。
提前谢谢..
谢谢大家。找到了。实际上跟随确实有效..
def command = "curl -s https://github.com/raw/script.pl?token=%3D"
def proc = command.execute() | "perl /dev/stdin $item1 $item2".execute()
proc.waitFor()
def roles = []
roles = "${proc.in.text}" .eachLine { line ->
roles << line
}
return roles