jenkins - 从 BUILD_LOG_REGEX 提取的行中删除 "[string]"

标签 jenkins

这是我的示例字符串。

[echo] SampleProject 解决方案当前的代码覆盖率为 85%。

我想要的输出应该是。

SampleProject 解决方案目前的代码覆盖率为 85%。

顺便说一句,我之所以这么做是因为我正在使用 Jenkins 来查看 CI 中的日志。

有什么帮助吗?谢谢..

最佳答案

您可以尝试使用 BUILD_LOG_REGEX token 中的 substText 参数来替换与您的 regex 匹配的文本

New optional arg: ${BUILD_LOG_REGEX, regex, linesBefore, linesAfter, maxMatches, showTruncatedLines, substText} which allows substituting text for the matched regex. This is particularly useful when the text contains references to capture groups (i.e. $1, $2, etc.)

关于jenkins - 从 BUILD_LOG_REGEX 提取的行中删除 "[string]",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12417832/

相关文章:

jenkins - Jenkinsfile when-branch 设置的模式评估是什么?

Mysqldump 在 jenkins 执行 shell 中不起作用

ios - pod install 在 Jenkins 上给出错误

jenkins - 如何欺骗 Jenkins 认为所有分支都已经在多分支管道中运行?

testing - 在不同的 MultiJob 阶段运行相同的作业

bash - 从 Jenkins 中的 curl 获取 shell 错误代码,同时仍在控制台中显示输出

Jenkins Docker 容器无法访问 docker.sock

java - 如何配置自定义maven项目结构

docker - 运行 docker-in-docker 时 Jenkins 声明性管道问题

android - 应用没有新的内容分级 - 无法上传 APK