2

I'm trying to embed clickable links in my TeamCity logs. My custom log message displayed with logging message with the ##teamacity template (documentation):

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

Now, i want part of the message to be a clickable link, for example, for a screenshot i have taken during the test.

How can it be done? I'm trying the approach described here, which suggesting installing StaticUIExtensions plugin to TeamCity and adding a rule that will transform log message the looks like url(http://www.autoscout24.de) into a clickable link in the log. It didn't worked for me.

My TeamCity version isEnterprise 8.1.4

M4N
  • 94,805
  • 45
  • 217
  • 260
Johnny
  • 14,397
  • 15
  • 77
  • 118

2 Answers2

1

I have modified show-link.html script. It works with TC 2017.2.4. And now script looks for "http://" strings instead of "(url)"

show-link.html

<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>

static-ui-extensions.xml

  <rule place-id="BUILD_RESULTS_FRAGMENT" html-file="show-link.html" >
    <url starts="viewLog.html" />
  </rule>
  <rule place-id="TEST_DETAILS_BLOCK" html-file="show-link.html" >
    <url starts="viewLog.html" />
  </rule>
0

I also had this problem. The showlinks.html needs an adjustment. Replace BEFORE_CONTENT with BUILD_RESULTS_FRAGMENT and it will work. The file showlinks.html needs to be placed in the same directory where "beforeContent.html" is located (TeamCity/config/_static_ui_extensions).

D.G.
  • 1
  • that was a good catch. Can you share your entire static-ui-extensions.xml ? I'm trying this same approach but it is not working after making place-id=BUILD_RESULTS_FRAGMENT. – Freddy Vega Jun 11 '15 at 15:51