Jenkens上安装插件:Jenkins JIRA plugin
插件配置
Go to Jenkins global configuration (${Jenkins URL}/configure)
Job 配置
插件安装之后在Jenkins Job 配置中的Post-build Actions中可以看到如下选项
Job 配置
以Create issue 为例:
>Creates a JIRA issue in the project with the given key.
- If current build failed, checks if issue was already created. If yes,
adds a comment, if not, creates a new JIRA issue.
如果构建失败,检查issue是否已创建,如果已创建,则添加注释,如果没有,则创建一个新的issue。
- If current build passed, checks if issue from p.1 is Closed or Done.
If not, adds a comment.
如果构建成功,检查issue状态是否是Closed或Done,如果不是添加注释,如果issue状态已是Closed或Done则不对issue做任何操作。
Demo 配置如下:
填写如下配置:Project Key,assignee,优先级,类型
在执行命令步骤故意使pipeline失败,会自动创建DEV-3的issue。
JIRA中可以看到新建的issue
再次Build,失败,因为已经有了这个issue所以会添加一个comment,jenkins console见下图
对应的JIRA 截图
现在让我们解决这个build错误,再次构建:
jenkins console输出
JIRA 截图