Icon

You are viewing the documentation of TeamCity 2018.x, which is not the most recently released version of TeamCity.
View this page in the latest documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

 

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this section:

Table of Contents

Anchor
servMsgs
servMsgs

Service Messages

Service messages are specially constructed pieces of text that are used to pass commands/information about the build from the build script to the TeamCity server.

...

Character

Escape as

' (apostrophe)

|'

\n (line feed)

|n

\r (carriage return)

|r

\uNNNN (unicode symbol with code 0xNNNN)

|0xNNNN

| (vertical bar)

||

[ (opening bracket)

|[

Wiki Markup
{hidden-data}because of [http://youtrack.jetbrains.net/issue/TW-14069]{hidden-data}

] (closing bracket)

|]

Anchor
commonProperties
commonProperties

Common Properties

Any "message and multiple attribute" message supports the following list of optional attributes: timestamp, flowId.
In the following examples <messageName> is the name of the specific service message.

...

Code Block
##teamcity[<messageName> flowId='flowId' ...]

Anchor
reportingMessagesForBuildLog
reportingMessagesForBuildLog

Reporting Messages For Build Log

You can report messages for a build log in the following way:

...

Code Block
##teamcity[message text='Exception text' errorDetails='stack trace' status='ERROR']

Anchor
blocks
blocks

Blocks of Service Messages

Blocks are used to group several messages in the build log.  

...

Note

Please note that when you close the block, all inner blocks are closed automatically.

Anchor
testReporting
testReporting
Anchor
reportingCompilationBlocks
reportingCompilationBlocks

Reporting Compilation Messages

Code Block
##teamcity[compilationStarted compiler='<compiler name>']
...
##teamcity[message text='compiler output']
##teamcity[message text='compiler output']
##teamcity[message text='compiler error' status='ERROR']
...
##teamcity[compilationFinished compiler='<compiler name>']

...

You can configure .NET coverage processing by means of service messages. To learn more, refer to Manually Configuring Reporting Coverage page.

Anchor
inspections
inspections

Reporting Inspections

You can report inspections from a custom tool to TeamCity using the service messages described below.

...

Code Block
##teamcity[inspectionType id='UnnecessaryLocalVariable' name='Redundant local variable' description='<html><body>Reports unnecessary local variables...</body>
</html>' category='Data flow issues']
##teamcity[inspection typeId='UnnecessaryLocalVariable' message='Local variable <code>i</code> is redundant' file='src/Test.java' line='19' SEVERITY='WARNING']

 

Anchor
artPublishing
artPublishing

Publishing Artifacts while the Build is Still in Progress

You can publish the build artifacts while the build is still running, immediately after the artifacts are built.

...

Artifacts that are specified in the build configuration setting will be published as usual.

Anchor
progressReporting
progressReporting

Reporting Build Progress

You can use special progress messages to mark long-running parts in a build script. These messages will be shown on the projects dashboard for the corresponding build and on the Build Results page.

...

The status set will be presented while the build is running and will also affect the final build results.

Anchor
ReportingBuildNumber
ReportingBuildNumber

Reporting Build Number

To set a custom build number directly, specify a buildNumber message using the following format:

...

Code Block
##teamcity[buildNumber '1.2.3_{build.number}-ent']

Anchor
changingBuildParameter
changingBuildParameter
Anchor
Adding or Changing a Build Parameter from a Build Step
Adding or Changing a Build Parameter from a Build Step

Adding or Changing a Build Parameter

By using a dedicated service message in your build script, you can dynamically update build parameters of the build right from a build step (the parameters need to be defined in the Parameters section of the build configuration). 
The changed build parameters will be available in the build steps following the modifying one. They will also be available as build parameters and can be used in the dependent builds via %dep.*% parameter references, e.g.

...


Read more about build parameters and their prefixes.

Anchor
ReportingBuildStatistics
ReportingBuildStatistics

Reporting Build Statistics

In TeamCity, it is possible to configure a build script to report statistical data and then display the charts based on the data. Please refer to the Customizing Statistics Charts page for a guide to displaying the charts on the web UI. This section describes how to report the statistical data from the build script via service messages. You can publish the build statics values in two ways:

...

Note

It is up to you to figure out how to retrieve test results that are not supported by TeamCity and accurately add them to the teamcity-info.xml file.

Anchor
stats
stats

Reporting Custom Statistics

It is possible to provide custom charts in TeamCity. Your build can provide data for such graphs using teamcity-info.xml file.

Anchor
provideStatsUsingFile
provideStatsUsingFile

Providing data using the teamcity-info.xml file

This file should be created by the build in the root directory of the build. You can publish multiple statistics (see the details on the data format below) and create separate charts for each set of values.

...

The key here relates to the key of the valueType tag used when describing the chart.

Anchor
DescribeGraphsUsingFile
DescribeGraphsUsingFile

Describing custom charts

See Customizing Statistics Charts page for detailed description.