gpt4 book ai didi

jenkins - 如何检查特定字符串的控制台输出并在构建时引发错误?

转载 作者:行者123 更新时间:2023-12-02 10:44:05 26 4
gpt4 key购买 nike

我为构建项目配置了 Hudson

构建后的控制台输出如下:

Compiling ./main.py ...
Sorry: IndentationError: ('expected an indented block', ('./main.py', 8, 6, 'thread.start_new_thread( foo.FooThread, () )\n'))
Compiling ./udpReceiver.py ...
<<<<< build finished!
POST BUILD TASK : SUCCESS
END OF POST BUILD TASK : 0

Deleting project workspace...
done

Finished: SUCCESS

如您所见,我有一个缩进错误....Hudson 说构建工作已成功完成。

我想要的是这样的:

检查字符串“IndentationError”是否出现在控制台输出文本中……如果是,构建应该是:已完成:失败!!!!!!!!!

我怎样才能做到这一点?

最佳答案

我确认 Log Parser plugin可以完成将构建状态更改为失败的工作。

安装插件并为您的 Python 构建创建规则集,例如:

enter image description here

在创建/var/lib/jenkins/logParserRules/python-error 文件中:

error /IndentationError/

接下来,使用这些设置更新 Python 构建:

enter image description here

构建状态将更改为失败:

Compiling ./udpReceiver.py ...'
Sorry: IndentationError: ('expected an indented block', ('./main.py', 8, 6, 'thread.start_new_thread( foo.FooThread, () )\n'))
Compiling ./udpReceiver.py ...
Build step 'Console output (build log) parsing' changed build result to FAILURE

关于jenkins - 如何检查特定字符串的控制台输出并在构建时引发错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34748289/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com