gpt4 book ai didi

Jenkins 管道 sshPublisher : How to get exit code and output of execCommand?

转载 作者:行者123 更新时间:2023-12-04 21:30:05 25 4
gpt4 key购买 nike

使用 Jenkins Pipeline's sshPublisher plugin (“通过 ssh 发布”),是否可以获得 命令的退出代码和输出与 execCommand 一起运行 (在文物转移过来之后)?

我使用插件如下:

script {
echo "Sending artifacts to machine at " + remoteDirectory

// Use of the ssh publisher plugin over SSH
sshPublisher(
failOnError: false,
publishers: [
sshPublisherDesc(
configName: "my-drive",
transfers: [
sshTransfer(
sourceFiles: mySourceFilesList,
remoteDirectory: remoteDirectory,
flatten: true,
execCommand: commandToExec,
execTimeout: 1800000
)
],
sshRetry: [
retries: 0
]
)
]
)
// How can I get the output of execCommand?
// If the exit code was 1, I want to perform some special steps
// I'd also like to include the output of the command in these steps
}

维基页面 here说(虽然这是旧的,但从 2011 年开始):

STDOUT and STDERR from the command execution are recorded in the Jenkins console.

最佳答案

这是一个“不”(不能确定,但​​我会尽我所能)。
现在我对这个脚本很满意 ssh user@nas01 su -c "/path/to/command1 arg1 arg2"

关于 Jenkins 管道 sshPublisher : How to get exit code and output of execCommand?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54951445/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com