为什么jenkins管道内部具有“ readfile”的功能返回错误的类型?
为什么readfile
jenkins管道中的功能返回错误的类型?
@NonCPS
def getChanged(changeTrackingOutput, ruleName, ciTags) {
echo """CI Tags: ${ciTags}"""
if (ciTags.contains('build-all')) {
return true
}
// Check output of the change detection.
def ys = new Yaml()
def fileData = readFile(changeTrackingOutput)
echo """File: ${fileData.getClass()}, ${fileData}"""
def res = ys.load(fileData)
echo """RRes: ${res.getClass()}, ${res}"""
def changed = res['changed'].contains(ruleName)
echo """Type: ${changed.getClass()}, ${changed}"""
ys = null // Null everything: https://blog.thesparktree.com/you-dont-know-jenkins-part-3
res = null
fileData = null
return
当我在脚本
步骤中使用此功能时。 我看不到readfile之后的任何输出(
。有些东西真的很酸甜,在我看来,函数get feathanged
以某种方式返回readfile
。类型I是String
而不是布尔
它应该
很难在这里看到什么
。 ://i.sstatic.net/dolhx.png“ rel =” nofollow noreferrer“>
之后什么都没有。
Why does a function with readFile
inside Jenkins Pipeline returns wrong type?
@NonCPS
def getChanged(changeTrackingOutput, ruleName, ciTags) {
echo """CI Tags: ${ciTags}"""
if (ciTags.contains('build-all')) {
return true
}
// Check output of the change detection.
def ys = new Yaml()
def fileData = readFile(changeTrackingOutput)
echo """File: ${fileData.getClass()}, ${fileData}"""
def res = ys.load(fileData)
echo """RRes: ${res.getClass()}, ${res}"""
def changed = res['changed'].contains(ruleName)
echo """Type: ${changed.getClass()}, ${changed}"""
ys = null // Null everything: https://blog.thesparktree.com/you-dont-know-jenkins-part-3
res = null
fileData = null
return
When I use this function inside a script
step.
I cannot see any output after readFile(
. Something is really fishy, it appears to me that the function getChanged
returns somehow after readFile
. Also outside the type I get is String
and not boolean
which it should be.
Its really hard to see whats going on here. Also in OpenBlueOcean I see:
with nothing after that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论