LoginSignup
0
0

JenkinsのPipelineからシェルスクリプトを呼び出して、戻り値を受け取る

Posted at

returnStdout: trueでechoされた文字列を受け取れる

result.sh
echo "hello"
pipeline
node{
    def RESULT
    stage('test'){
        RESULT = sh (
             script: "./result.sh",
             returnStdout: true
            )
    }

    stage('check'){
        echo "${RESULT}"
    }
}
実行結果
hello

おまけ

複数echoしてみる

result.sh
echo "hello"
echo "world"
実行結果
hello
world
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0