TeamCity 2017.1 Help

Agent-side Object Model

On the agent side agent is represented by interface. BuildAgent is available as a Spring bean and can be obtained by autowiring.

Build agent configuration can be read from the , it can be obtained from the BuildAgent#getConfiguration() method.

Agent side events

There is interface and corresponding adapter class which can be used to receive notifications about agent side events, like starting of the build, build finishing and so on. Your listener must be registered in the . This service is also defined in the Spring context.

Build

Each build on the agent is represented by interface. You can obtain instance of AgentRunningBuild by listening for buildStarted(AgentRunningBuild) event in AgentLifeCycleListener.

Logging to build log

Messages to build log can be sent only when a build is running. Internally agent sends messages to server by packing them into the structures. However instead of creating BuildMessage1 structures it is better and easier to use corresponding methods in which can be obtained from the AgentRunningBuild.

If you want to construct your own messages you can use static methods of class for that.

Last modified: 20 April 2023