How to customise build status message on overview page using service messages

Hello,

My goal is to update the build status on the overview page using a service message from a build runner. I'm new to service messages and I cannot get this to work.

I've attached a file to show which status message I mean. Normally it says Success but I need to customise it.

So I have a build process that implements jetbrains.buildServer.agent.BuildProcess. I've implemented the call() method that return a BuildFinishedStatus. It works great, I can write to the log using BuildProgressLogger. However, I don't know how to set the build status message on the overview page.

I've found a documentation here: https://confluence.jetbrains.com/display/TCD7/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingBuildStatus
That sounds like exactly what I need. It says of service messages that "In order to be processed by TeamCity they should be printed into standard output stream of the build".

I tried a couple of approaches within the call() method, like:

String statusMessage = String.format("##teamcity[buildStatus status='%s' text='%s']", "SUCCESS", "This is some custom text");
System.out.print(statusMessage);

BuildProgressLogger.progressMessage(statusMessage);

...and various others but status message remains "Success" at the end of the build.

So what do I need to do to proceed? Anything on the server side as well? Anything GUI related?

I appreciate your assistance,
Andras



Attachment(s):
BuildStatusMessageToBeCustomised.PNG
2 comments

Hello,

The service messages are meant to be a transport between the build process and TeamCity, so you can just print the line from within the build script.

To change the build status from within a TeamCity plugin you will need another approach.
For agent-side plugin you can use BuildProgressLogger.logMessage(DefaultMessagesInfo.createTextMessage("<service message here>"))
For server-side plugin you can use ((RunningBuildEx)runingBuild).setBuildStatusDescription

What are you trying to implement? If you are looking into reporting build failures, you might add problem instead of directly modifying the build status text.

0

Hi Yegor,

Thanks for your reply, I'll test that approach.

The build runner is a web load tester and we'd like to show a summary message instead of just "Success", e.g. "Success: response time: 20ms, failure rate: 5%."

//Andras

0

Please sign in to leave a comment.