在TeamCity构建日志中嵌入URL可点击链接

时间:2014-12-23 08:28:23

标签: teamcity teamcity-8.0

我正在尝试在我的TeamCity日志中嵌入可点击链接。 我的自定义日志消息显示带有## teamacity模板(documentation)的日志消息:

log("##teamcity[buildProblem description='message to log to TC']");

现在,我希望部分消息是可点击的链接,例如,我在测试期间拍摄的屏幕截图。

怎么做? 我正在尝试使用here描述的方法,该方法建议将StaticUIExtensions plugin安装到TeamCity并添加一条规则,将日志消息看起来像url(http://www.autoscout24.de),转换为日志中的可点击链接。它对我没用。

我的TeamCity版本是Enterprise 8.1.4

2 个答案:

答案 0 :(得分:1)

我修改了show-link.html脚本。它适用于TC 2017.2.4。现在脚本会查找“http://”字符串而不是“(url)”

显示-link.html

<div class="one"><img src="https://upload.wikimedia.org/wikipedia/commons/5/57/Distribution_H._leucocephalus.png"></div>
<div class="two"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Back_to_the_Six_Mile_Lake_eagles_%28Haliaeetus_leucocephalus%29.%22feed_me_mom%22._%2819159890706%29.jpg/800px-Back_to_the_Six_Mile_Lake_eagles_%28Haliaeetus_leucocephalus%29.%22feed_me_mom%22._%2819159890706%29.jpg"></div>

<强>静态-UI-extensions.xml

<script>
  (function ($) {
    function createLinksFromUrls() {
      $("div .fullStacktrace").each(function () {
        var oldHtml = $(this).html();
		if(oldHtml.indexOf("<a href=") < 0)
		{
			var newHtml=oldHtml.replace(/http(.*)/, "<a href='http$1' target='_blank'>htpp$1</a>");
			$(this).html(newHtml);
		}
      });
    }
 
    $(document).ready(createLinksFromUrls);
    $(document).click(function () {
        window.setTimeout(createLinksFromUrls, 50);
        window.setTimeout(createLinksFromUrls, 100);
        window.setTimeout(createLinksFromUrls, 500);
    });
})(window.jQuery); 
</script>

答案 1 :(得分:0)

我也有这个问题。 showlinks.html需要调整。用BUILD_RESULTS_FRAGMENT替换BEFORE_CONTENT,它将起作用。文件showlinks.html需要放在&#34; beforeContent.html&#34;的同一目录中。位于(TeamCity / config / _static_ui_extensions)。