Teamcity service messages

(Sam Shiles) #1

I’m having trouble getting service message from ocotpus back to teamcity to work. The service message appears in the build log but teamcity is ignoring it. If I output the exact same service message directly from teamcity, it works perfectly. I don’t get any warnings or errors, it just seems that teamcity ignores the message.

Example messages are:

##teamcity[importData type=‘nunit’ path=’\blah\c$\Octopus\Applications\CI\project\2.0.130-dev19e3b30_1\TestResult_Tests.EndToEnd.xml’]
##teamcity[setParameter name=‘octo.testresultsfile’ value=‘mypath’]

What I’ve tried:

  • Checked for odd control characters including line endings
  • Tried setting a parameter ##teamcity[setParameter name=‘octo.testresultsfile’ value=‘mypath’] in one step and referencing in the next
  • Looked at the teamcity plugin code, it looks like the service message are just being written to stdout
  • Tried output the service message from both the octopus step script (deploy) and a checked in deploy.ps1


Teamcity: 8.1 (build 29879)


(Paul Stovell) #2

Hi Sam,

I just tried this myself and got the same result. I think the issue is that TeamCity only reads service messages if they are on a line by themselves. However when Octo.exe outputs text from the build log, it writes:

[Success: Tentacle script execution] ##teamcity[setParameter name='ddd' value='fff']

Which means TeamCity doesn’t read the message.

I don’t think there’s an easy fix for this – perhaps you could output the test results to a more deterministic path, and have a PowerShell script in TeamCity which runs after the deployment and which reads the file from that path and uses the service message to have it imported.



(Sam Shiles) #3

Hi Paul,

Thanks for the response, I came to the same conclusion as you in the end. The thing that threw me the most though is the option --enableServiceMessages, which would indicate that this should work. What does this option do?



(Paul Stovell) #4

Hi Sam,

Octo.exe raises various service messages to indicate a release number, as well as logs (to get the nice indented output). We do this if we detect we’re running under TeamCity (TC passes an environment variable), or --enableServiceMessages can be used to test it when not running under TeamCity.



(system) closed #5