【发布时间】:2018-07-27 15:04:45
【问题描述】:
我正在尝试将执行 cURL 命令的 groovy 脚本导入到我的 Jenkins 管道中。在管道外部(例如从 shell)执行 groovy 脚本时,cURL 命令可以正确执行,但是在管道内部时,我的管道执行时没有错误,但 cURL 命令似乎没有执行。
test.groovy:
class GroovyClass{
def executeCurl() {
//define curl command and execute
def proc = "curl fakecommand".execute()
// cURL uses error output stream for progress output.
Thread.start { System.err << proc.err }
// Wait until cURL process finished
proc.waitFor()
}
}
return new GroovyClass();
Jenkins 文件:
if (run) {
def groovyClass= load 'test.groovy'
groovyClass.executeCurl()
}
【问题讨论】:
标签: curl groovy jenkins-pipeline jenkins-groovy