我是詹金斯的新手。我开始使用这个名为“描述设定者”的插件
https://plugins.jenkins.io/description-setter
基本上,我想在构建完成后在说明中设置构建ID。
我安装了插件->构建后操作->我添加了如下插件:
当我解析构建console.logs时,正则表达式可以正常工作:
const str = `angularjs@1_4_7-ie8 found in path(s):
public/components/angularjs-ie8-build/dist/angular.min.js
[INFO] Registered manifest into CMPaaS:
https://deploy-apixyz.com/swdeploy/v2/manifests/demonodeserver/versions/1.0.0_20180628165604811
Your build metrics have been recorded with id
demonodeserver-06-29T00:07:42.845Z and manifest_id
demonodeserver-1.0.0_20180628165604811`;
const regex = /demonodeserver-(\d\.?){3}_\w+/gm;
const match = str.match(regex);
console.log(match);
问题: 当我以为一切正常时,构建完成后,我看到以下错误:
成功完成了CI构建
[description-setter]无法确定描述。
完成:成功
我不确定为什么无法确定描述。我想我缺少了什么,有人可以启发我吗?
答案 0 :(得分:2)
Regexp字段不希望使用真正的Regexp,插件中已使用“ /”将其屏蔽。所以我希望正确的输入应该是这样的:
demonodeserver-(\d\.?){3}_\w+
接下来的内容是“描述”字段,只有第一组填充为空。
所以我最好在说明中加入第一组:
Build ID: \1
但是,第一组将是带点的第一个数字。因此,regexp应该在id周围使用另一个组:
demonodeserver-((\d\.?){3})_\w+
由于无法使用,因此无法重新测试,但是当我回到办公桌前时会执行此操作。