1
我有一個運行shell命令的Jenkinsfile,我想將sh
方法的輸出作爲slackSend
方法的message:
發送。在Jenkins文件中捕獲併發送sh方法的輸出
到目前爲止,我有以下信息,但消息到閒置通道是空的。我不能確定如何捕獲輸出的方式,我可以在消息部分引用它:
node {
checkout scm
stage 'run shell command'
def shell_command = sh "ls -l"
def shell_output = apply_cluster
stage 'notify slack-notification'
slackSend channel: '#slack-notifications', color: 'good', message: shell_output, teamDomain: 'company', token: env.SLACK_TOKEN
}
的可能的複製[詹金斯流水線插件:執行shell和解析輸出(http://stackoverflow.com/questions/36304131/jenkins-pipeline-plugin-execute-shell-和解析輸出) – Pom12