我试图在 Jenkinsfile 中使用 shell 脚本的返回值作为分支逻辑的一种方式。但是我不明白返回的是什么或为什么它不相等。
要重现该问题,您可以在 Jenkinsfile 中编写:
response = sh(script: "echo hello", returnStdout: true)
print response // hello is printed as expected
print response == 'hello' // false
提前致谢。
我试图在 Jenkinsfile 中使用 shell 脚本的返回值作为分支逻辑的一种方式。但是我不明白返回的是什么或为什么它不相等。
要重现该问题,您可以在 Jenkinsfile 中编写:
response = sh(script: "echo hello", returnStdout: true)
print response // hello is printed as expected
print response == 'hello' // false
提前致谢。