Groovy脚本以在控制台输出中找到字符串并使构建失败
我在Jenkins控制台中有以下条目“输出:×35中的45个失败(78%)06:13 247 3 38 66 140”,我需要grep数字78,如果数字是> = =,则使构建失败使构建失败。 30带时脚本的脚本。 有人可以帮我吗?
def result= manager.logContains('%)')
println result*.toString() // Read a line which has the failed test cases count
String test = result
def failedtest = test.substring(test.indexOf("%") - 2)
def failednumber = failedtest.split("%")[0].toInteger() as int
println failednumber
I have the following entry in the Jenkins console "Output: × 35 of 45 failed (78%) 06:13 247 3 38 66 140", I need to grep the number 78 and make the build failure if the number is >=30 with Groovy script.
Can someone please help me with this?
def result= manager.logContains('%)')
println result*.toString() // Read a line which has the failed test cases count
String test = result
def failedtest = test.substring(test.indexOf("%") - 2)
def failednumber = failedtest.split("%")[0].toInteger() as int
println failednumber
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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