【发布时间】:2019-01-23 15:25:54
【问题描述】:
我正在尝试从以下脚本中隐藏堆栈跟踪:
def status = "false"
while (status.equals("false")) {
sleep 5
status = sh(
script: "curl -s -H 'Accept: application/json' http://my.ip | jq \'.completed\' ",
returnStdout: true
).trim()
echo "status: ${status}"
}
输出:
+ curl -s -H 'Accept: application/json' 'http://my.ip'
+ jq .completed
status: true
如果我只想看到输出消息,我必须在脚本正文中写“set +x”。但这会导致状态返回为 NULL。
status = sh(
script:'''
set +x
script: "curl -s -H 'Accept: application/json' http://my.ip | jq \'.completed\'
''',
returnStdout: true
).trim()
输出:
status: NULL
为什么输出会丢失,有没有其他方法可以删除堆栈跟踪?
【问题讨论】:
标签: bash jenkins sh jenkins-pipeline stack-trace