jetbrains.buildServer.agent
Interface AgentLifeCycleListener

All Superinterfaces:
java.util.EventListener
All Known Implementing Classes:
AgentLifeCycleAdapter

@UserImplemented(adapterClass=AgentLifeCycleAdapter.class)
public interface AgentLifeCycleListener
extends java.util.EventListener

Agent events listener Calls sequence is the following on build agent start:

Notifications for a build: Notifications that could be fired at every moment: You should not implement this interface directly in your code. Use AgentLifeCycleAdapter instead
To subscribe to this event listener you should use Spring bean of type EventDispatcher of AgentLifeCycleListener and call EventDispatcher.addListener(java.util.EventListener)} method.

See Also:
AgentLifeCycleAdapter

Method Summary
 void afterAgentConfigurationLoaded(BuildAgent agent)
          is called after build agent loaded it's properties and it is called before agentInitialized(BuildAgent) This is a right place to update loaded environment and set agent-wide properties using BuildAgentConfiguration interface
 void afterAtrifactsPublished(AgentRunningBuild runningBuild, BuildFinishedStatus status)
          Called when all artifacts were published to the server
 void agentInitialized(BuildAgent agent)
          Called when method BuildAgent.init(String[]) finished
 void agentShutdown()
          Called before agent shutdown
 void agentStarted(BuildAgent agent)
          Called after the agent BuildAgent.start() method Agent XML-RPC server is started.
 void beforeAgentConfigurationLoaded(BuildAgent agent)
          is called before build agent loaded it's properties and it is called before agentInitialized(BuildAgent) This is a right place to detect environment and set agent-wide properties using BuildAgentConfiguration interface
 void beforeBuildFinish(AgentRunningBuild build, BuildFinishedStatus buildStatus)
          Called after finishing build but before buildFinished event is sent to the server Is called after beforeRunnerStart(AgentRunningBuild) or beforeBuildInterrupted(AgentRunningBuild, BuildInterruptReason)
 void beforeBuildFinish(BuildFinishedStatus buildStatus)
          Deprecated. use #beforeBuildFinish(AgentRunningBuild, ProcessFinishStatus)
 void beforeBuildInterrupted(AgentRunningBuild runningBuild, BuildInterruptReason reason)
          Is called after beforeRunnerStart(AgentRunningBuild) Called before build is forcibly terminated, can be called several times if more than one attempt to terminate build is performed.
 void beforeRunnerStart(AgentRunningBuild runningBuild)
          Deprecated. use beforeRunnerStart(BuildRunnerContext)
 void beforeRunnerStart(BuildRunnerContext runner)
          Called when the build preparation phase is done (sources are gotten, patch is applied, etc.) a runner is about to be launched.
 void buildFinished(AgentRunningBuild build, BuildFinishedStatus buildStatus)
          Called after the buildFinished event is sent to the server Is called after beforeBuildFinish(BuildFinishedStatus) New build may be started while processing this event
 void buildFinished(BuildFinishedStatus buildStatus)
          Deprecated. use #buildFinished(AgentRunningBuild, ProcessFinishStatus)
 void buildStarted(AgentRunningBuild runningBuild)
          Called after agent receives start build command from the server.
 void checkoutDirectoryRemoved(java.io.File checkoutDir)
          Called when a build checkout directory was removed from build agent 'work' directory.
 void messageLogged(AgentRunningBuild build, BuildMessage1 buildMessage)
          Called when a build message logged
 void messageLogged(BuildMessage1 buildMessage)
          Called when a build message logged See messageLogged(AgentRunningBuild, jetbrains.buildServer.messages.BuildMessage1)
 void personalPatchApplied(AgentRunningBuild runningBuild)
          Called when personal patch is applied to checkout directory.
 void personalPatchReverted(AgentRunningBuild runningBuild)
          Called when personal patch is reverted Will not be called if build is not personal
 void pluginsLoaded()
          Called after plugin manager has loaded all plugins.
 void runnerFinished(BuildRunnerContext runner, BuildFinishedStatus status)
          Called after beforeRunnerStart(BuildRunnerContext).
 void sourcesUpdated(AgentRunningBuild runningBuild)
          Called when non personal changes are applied to checkout directory.
 

Method Detail

beforeAgentConfigurationLoaded

void beforeAgentConfigurationLoaded(@NotNull
                                    BuildAgent agent)
is called before build agent loaded it's properties and it is called before agentInitialized(BuildAgent) This is a right place to detect environment and set agent-wide properties using BuildAgentConfiguration interface

Parameters:
agent - agent

afterAgentConfigurationLoaded

void afterAgentConfigurationLoaded(@NotNull
                                   BuildAgent agent)
is called after build agent loaded it's properties and it is called before agentInitialized(BuildAgent) This is a right place to update loaded environment and set agent-wide properties using BuildAgentConfiguration interface

Parameters:
agent - agent

pluginsLoaded

void pluginsLoaded()
Called after plugin manager has loaded all plugins.


agentInitialized

void agentInitialized(@NotNull
                      BuildAgent agent)
Called when method BuildAgent.init(String[]) finished

Parameters:
agent - build agent

agentStarted

void agentStarted(@NotNull
                  BuildAgent agent)
Called after the agent BuildAgent.start() method Agent XML-RPC server is started. You can register your custom XML-RPC handlers here by calling BuildAgent.getXmlRpcHandlerManager() Build agent is ready to accept connections from Server

Parameters:
agent - build agent

agentShutdown

void agentShutdown()
Called before agent shutdown


buildStarted

void buildStarted(@NotNull
                  AgentRunningBuild runningBuild)
Called after agent receives start build command from the server. To register custom build parameters provide AgentPropertiesExtension agent extension. Note, methods from that interface are called before that method.

Parameters:
runningBuild - information about running build

sourcesUpdated

void sourcesUpdated(@NotNull
                    AgentRunningBuild runningBuild)
Called when non personal changes are applied to checkout directory. Called after buildStarted(AgentRunningBuild) called. Will not be called if checkout mode is set to manual.

Parameters:
runningBuild - current running build
Since:
5.1

personalPatchApplied

void personalPatchApplied(@NotNull
                          AgentRunningBuild runningBuild)
Called when personal patch is applied to checkout directory. Will not be called if build is not personal

Parameters:
runningBuild - current running build
Since:
5.1

beforeRunnerStart

@Deprecated
void beforeRunnerStart(@NotNull
                                  AgentRunningBuild runningBuild)
Deprecated. use beforeRunnerStart(BuildRunnerContext)

Called when the build preparation phase is done (sources are gotten, patch is applied, etc.) the runner is about to be launched. Is called after buildStarted(AgentRunningBuild)

Parameters:
runningBuild - running build

beforeRunnerStart

void beforeRunnerStart(@NotNull
                       BuildRunnerContext runner)
Called when the build preparation phase is done (sources are gotten, patch is applied, etc.) a runner is about to be launched. Is called at least after buildStarted(AgentRunningBuild), sourcesUpdated(AgentRunningBuild), personalPatchApplied(AgentRunningBuild)

Parameters:
runner - current runner context parameters
Since:
6.0

runnerFinished

void runnerFinished(@NotNull
                    BuildRunnerContext runner,
                    @NotNull
                    BuildFinishedStatus status)
Called after beforeRunnerStart(BuildRunnerContext). This notification is sent when build runner has finished, crashed or was interrupted.

Parameters:
runner - current runner context parameters
status - status of process run
Since:
6.0

beforeBuildInterrupted

void beforeBuildInterrupted(@NotNull
                            AgentRunningBuild runningBuild,
                            @NotNull
                            BuildInterruptReason reason)
Is called after beforeRunnerStart(AgentRunningBuild) Called before build is forcibly terminated, can be called several times if more than one attempt to terminate build is performed. For example:

Parameters:
runningBuild - running build
reason - reason of build interruption
Since:
4.5

beforeBuildFinish

@Deprecated
void beforeBuildFinish(@NotNull
                                  BuildFinishedStatus buildStatus)
Deprecated. use #beforeBuildFinish(AgentRunningBuild, ProcessFinishStatus)

Called after finishing build but before buildFinished event is sent to the server Is called after beforeRunnerStart(AgentRunningBuild) or beforeBuildInterrupted(AgentRunningBuild, BuildInterruptReason)

Parameters:
buildStatus - status of the build

beforeBuildFinish

void beforeBuildFinish(@NotNull
                       AgentRunningBuild build,
                       @NotNull
                       BuildFinishedStatus buildStatus)
Called after finishing build but before buildFinished event is sent to the server Is called after beforeRunnerStart(AgentRunningBuild) or beforeBuildInterrupted(AgentRunningBuild, BuildInterruptReason)

Parameters:
build - build
buildStatus - status of the build
Since:
6.0

personalPatchReverted

void personalPatchReverted(@NotNull
                           AgentRunningBuild runningBuild)
Called when personal patch is reverted Will not be called if build is not personal

Parameters:
runningBuild - current running build
Since:
5.1

afterAtrifactsPublished

void afterAtrifactsPublished(@NotNull
                             AgentRunningBuild runningBuild,
                             @NotNull
                             BuildFinishedStatus status)
Called when all artifacts were published to the server

Parameters:
runningBuild - current running build
status - build status
Since:
6.5

buildFinished

@Deprecated
void buildFinished(@NotNull
                              BuildFinishedStatus buildStatus)
Deprecated. use #buildFinished(AgentRunningBuild, ProcessFinishStatus)

Called after the buildFinished event is sent to the server Is called after beforeBuildFinish(BuildFinishedStatus) New build may be started while processing this event

Parameters:
buildStatus - status of the build

buildFinished

void buildFinished(@NotNull
                   AgentRunningBuild build,
                   @NotNull
                   BuildFinishedStatus buildStatus)
Called after the buildFinished event is sent to the server Is called after beforeBuildFinish(BuildFinishedStatus) New build may be started while processing this event

Parameters:
build - build
buildStatus - status of the build
Since:
6.0

messageLogged

void messageLogged(@NotNull
                   BuildMessage1 buildMessage)
Called when a build message logged See messageLogged(AgentRunningBuild, jetbrains.buildServer.messages.BuildMessage1)

Parameters:
buildMessage - build message

messageLogged

void messageLogged(@NotNull
                   AgentRunningBuild build,
                   @NotNull
                   BuildMessage1 buildMessage)
Called when a build message logged

Parameters:
build - build that received this message
buildMessage - build message
Since:
6.0

checkoutDirectoryRemoved

void checkoutDirectoryRemoved(@NotNull
                              java.io.File checkoutDir)
Called when a build checkout directory was removed from build agent 'work' directory. This can be called when build agent has cleaned up a build checkout directory because it was not used for a long period of time. Checkout directory may not be fully cleaned because of IO errors.

Parameters:
checkoutDir - path of the directory. This directory may not exist at the moment of the call.