需要包含来自 jenkins 管道控制台输出的特定行(一些 ID)并使用 email-ext 插件发送。我如何为此编写正则表达式。例如:
Console ouput
published xyz
[servername] out: Built 123abcwxyabjd
few lines of o/p
[servername2] out: Built ewrewfdsfabcwxyabjd
again some o/p
[servername3] out: Built 1458543abcwxyabjd
published abc
some o/p
[servername2] out: Built dfds123abcwxyabjd
some o/p
[servername] out: Built dsfdsabcwxyabjd
我在 o/p 中需要什么
published xyz
[servername] out: Built 123abcwxyabjd
[servername2] out: Built ewrewfdsfabcwxyabjd
[servername3] out: Built 1458543abcwxyabjd
published abc
[servername2] out: Built dfds123abcwxyabjd
[servername] out: Built dsfdsabcwxyabjd
另一个问题是阶段是并行的,即发布的 xyz 和发布的 abc 是并行的,并且将输出不按顺序的 ID
对我来说,我能够得到所有的线条,比如
[servername] out: Built 123abcwxyabjd
[servername] out: Built 123abcwxyabjd
$(BUILD_LOG_REGEX, regex=".*(?=.*?Built).*?$
对我来说,我能够得到所有的线条,比如
[servername] out: Built 123abcwxyabjd
[servername] out: Built 123abcwxyabjd
但无法区分哪个来自哪个已发布阶段。即使我可以选择前三个 id,然后发布文本,然后是三个 id,然后是一些文本。可能会有所帮助。