1
シェルコマンドを実行中のJenkinsfileがあり、slackSend
メソッドのmessage:
としてそのsh
メソッドの出力を送信したいとします。Jenkinsfileの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
}
可能な重複[ジェンキンスパイプラインプラグイン:シェルを実行し、出力を解析します](http://stackoverflow.com/questions/36304131/jenkins-pipeline-plugin-execute-shell-パース出力) – Pom12