如何在外部发布Jenkins工作图标?


9

我正在使用Promoted Builds Plugin在某些条件下将某些图标分配给Jenkins作业,我想发布这些促销图标。

如何为每个作业生成指向这些图标的外部链接,以便可以从外部访问它们?

—————

例如,我想README.md在GitHub上创建表,例如:

Job 1 | ![](link_to_icon_of_job_1)
Job 2 | ![](link_to_icon_of_job_2)
Job 3 | ![](link_to_icon_of_job_3)

Answers:



4

我试图做类似的事情(将构建状态图标嵌入到电子邮件通知中),但是由于我们的构建系统不可公开访问,我最终将状态图标发布到imgur并通过根据状态将URL存储在变量中来引用这些图像。

以下是我的电子邮件模板Groovyscript的一些片段:

定义URL:

def images = [:]
images["SUCCESS"] = "http://i.imgur.com/uXlqCxW.gif"
images["PASSED"] = "http://i.imgur.com/uXlqCxW.gif"
images["UNSTABLE"] = "http://i.imgur.com/QkQbxR3.gif"
images["SKIPPED"] = "http://i.imgur.com/QkQbxR3.gif"
images["FAILURE"] = "http://i.imgur.com/LUveOg7.gif"
images["FAILED"] = "http://i.imgur.com/LUveOg7.gif"
images["ABORTED"] = "http://i.imgur.com/jSdrWWP.gif"
images["NOT_RUN"] = "http://i.imgur.com/jSdrWWP.gif"

使用电子邮件中的URL:

<img src="${images[build.result.toString()]}" />
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.