Publish clickable links from build script to Build Log. How to make?

We need a functionality to publish in Build Log links to external resources (testcase description, issues, external tools log and etc.).
Existing recipe, how to implement this functionality, in public teamcity documentation we dont find.

Our java developer create a teamcity extension which add a new "service message" (http://confluence.jetbrains.com/display/TCD8/Build+Script+Interaction+with+TeamCity) that looks like
##teamcity[url text='<link text>' uri='<link uri>'].

Very easy method of implementation:
public class UriExtractor implements ServiceMessageTranslator {
 
 ... code ..


    @NotNull
    public List<BuildMessage1> translate(SRunningBuild build, BuildMessage1 originalMessage, ServiceMessage serviceMessage) {             
     List<BuildMessage1> buildMessages = new ArrayList<BuildMessage1>();
     ...
     // Get service message, extract message attributes, convert to string <a href="link uri">link text</a>
     ...
     buildMessages.add(new BuildMessage1(originalMessage.getSourceId(), originalMessage.getTypeId(), Status.NORMAL, new Date(), new_message))
     // return List<BuildMessage1> with translated message string in BuildMessage1 object
        return buildMessages;
    }
}

Extention worked perfectly and the service message was transformed into a new form correctly, but all the characters <,>," converted to HTML entities, and when viewed build log on teamcity server, we see html code instead of links.
We checked all available sources (manuals, forums, etc) but did not find any information how to implement this feature.

Maybe we used the wrong approach or message needs to be further processed?

4 comments
Comment actions Permalink

Somebody tried to implement a similar feature and can help me?

0
Comment actions Permalink

Maksim,

I am affraid that changing the build log messages presentation cannot be done with TeamCity API at this time. BTW, there is a related feature request: http://youtrack.jetbrains.com/issue/TW-24656 you might be interested in.

The only current approach I can think of until TW-18936 is implemented, is to add custom JavaScript code to the page (e.g. via PlaceId.ALL_PAGES_HEADER extension) which will activate on the build log page loading and will post-process browser's DOM to turn some matching text into HTML elements.

0
Comment actions Permalink

Yegor,

Thanks for your answer.
We applied this plugin as you suggest, but wanted to receive a much better solution.

0
Comment actions Permalink

Maksim,

Then you are welcome to vote for http://youtrack.jetbrains.com/issue/TW-18936 and wait for it to be implemented.

0

Please sign in to leave a comment.