Package jetbrains.buildServer.agent
Class AgentLifeCycleAdapter
- java.lang.Object
-
- jetbrains.buildServer.agent.AgentLifeCycleAdapter
-
- All Implemented Interfaces:
java.util.EventListener
,AgentLifeCycleListener
public class AgentLifeCycleAdapter extends java.lang.Object implements AgentLifeCycleListener
Base class for agent listeners
-
-
Constructor Summary
Constructors Constructor Description AgentLifeCycleAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
afterAgentConfigurationLoaded(BuildAgent agent)
is called after build agent loaded it's properties and it is called beforeAgentLifeCycleListener.agentInitialized(BuildAgent)
This is a right place to update loaded environment and set agent-wide properties usingBuildAgentConfiguration
interfacevoid
afterAtrifactsPublished(AgentRunningBuild runningBuild, BuildFinishedStatus status)
Called when all artifacts were published to the servervoid
agentInitialized(BuildAgent agent)
Called when methodBuildAgent.init(String[])
finishedvoid
agentShutdown()
Called before agent shutdownvoid
agentStarted(BuildAgent agent)
Called after the agentBuildAgent.start()
methodvoid
beforeAgentConfigurationLoaded(BuildAgent agent)
is called before build agent loaded it's properties and it is called beforeAgentLifeCycleListener.agentInitialized(BuildAgent)
This is a right place to detect environment and set agent-wide properties usingBuildAgentConfiguration
interfacevoid
beforeBuildFinish(AgentRunningBuild build, BuildFinishedStatus buildStatus)
Called after finishing build but before buildFinished event is sent to the server Is called afterAgentLifeCycleListener.beforeRunnerStart(AgentRunningBuild)
orAgentLifeCycleListener.beforeBuildInterrupted(AgentRunningBuild, BuildInterruptReason)
void
beforeBuildFinish(BuildFinishedStatus buildStatus)
Deprecated.void
beforeBuildInterrupted(AgentRunningBuild runningBuild, BuildInterruptReason reason)
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.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 afterAgentLifeCycleListener.beforeBuildFinish(BuildFinishedStatus)
New build may be started while processing this eventvoid
buildFinished(BuildFinishedStatus buildStatus)
Deprecated.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
checkoutModeResolved(AgentCheckoutMode agentCheckoutMode)
Called when effective checkout mode is resolved for the build.void
dependenciesDownloaded(AgentRunningBuild runningBuild)
Called when dependencies for the build have been resolved and downloaded successfullyvoid
messageLogged(AgentRunningBuild build, BuildMessage1 buildMessage)
Called when a build message loggedvoid
messageLogged(BuildMessage1 buildMessage)
Called when a build message logged SeeAgentLifeCycleListener.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 personalvoid
pluginsLoaded()
Called after plugin manager has loaded all plugins.void
preparationFinished(AgentRunningBuild runningBuild)
Called when all preparations for the build are finished (sources checkout, personal patch, artifact dependencies, free disk space requirement, etc), and build is ready to execute it's steps, if there are any.void
runnerFinished(BuildRunnerContext runner, BuildFinishedStatus status)
void
sourcesUpdated(AgentRunningBuild runningBuild)
Called when non personal changes are applied to checkout directory.
-
-
-
Method Detail
-
beforeAgentConfigurationLoaded
public void beforeAgentConfigurationLoaded(@NotNull BuildAgent agent)
Description copied from interface:AgentLifeCycleListener
is called before build agent loaded it's properties and it is called beforeAgentLifeCycleListener.agentInitialized(BuildAgent)
This is a right place to detect environment and set agent-wide properties usingBuildAgentConfiguration
interface- Specified by:
beforeAgentConfigurationLoaded
in interfaceAgentLifeCycleListener
- Parameters:
agent
- agent
-
afterAgentConfigurationLoaded
public void afterAgentConfigurationLoaded(@NotNull BuildAgent agent)
Description copied from interface:AgentLifeCycleListener
is called after build agent loaded it's properties and it is called beforeAgentLifeCycleListener.agentInitialized(BuildAgent)
This is a right place to update loaded environment and set agent-wide properties usingBuildAgentConfiguration
interface- Specified by:
afterAgentConfigurationLoaded
in interfaceAgentLifeCycleListener
- Parameters:
agent
- agent
-
pluginsLoaded
public void pluginsLoaded()
Description copied from interface:AgentLifeCycleListener
Called after plugin manager has loaded all plugins.- Specified by:
pluginsLoaded
in interfaceAgentLifeCycleListener
-
agentInitialized
public void agentInitialized(@NotNull BuildAgent agent)
Description copied from interface:AgentLifeCycleListener
Called when methodBuildAgent.init(String[])
finished- Specified by:
agentInitialized
in interfaceAgentLifeCycleListener
- Parameters:
agent
- build agent
-
agentStarted
public void agentStarted(@NotNull BuildAgent agent)
Description copied from interface:AgentLifeCycleListener
Called after the agentBuildAgent.start()
method- Specified by:
agentStarted
in interfaceAgentLifeCycleListener
- Parameters:
agent
- build agent
-
agentShutdown
public void agentShutdown()
Description copied from interface:AgentLifeCycleListener
Called before agent shutdown- Specified by:
agentShutdown
in interfaceAgentLifeCycleListener
-
buildStarted
public void buildStarted(@NotNull AgentRunningBuild runningBuild)
Description copied from interface:AgentLifeCycleListener
Called after agent receives start build command from the server. To register custom build parameters provideAgentPropertiesExtension
agent extension. Note, methods from that interface are called before that method.- Specified by:
buildStarted
in interfaceAgentLifeCycleListener
- Parameters:
runningBuild
- information about running build
-
checkoutModeResolved
public void checkoutModeResolved(@NotNull AgentCheckoutMode agentCheckoutMode)
Description copied from interface:AgentLifeCycleListener
Called when effective checkout mode is resolved for the build. It's guaranteed that after this event,AgentRunningBuild.getEffectiveCheckoutMode()
will return non-null value.- Specified by:
checkoutModeResolved
in interfaceAgentLifeCycleListener
-
sourcesUpdated
public void sourcesUpdated(@NotNull AgentRunningBuild runningBuild)
Description copied from interface:AgentLifeCycleListener
Called when non personal changes are applied to checkout directory. Called afterAgentLifeCycleListener.buildStarted(AgentRunningBuild)
called. Will not be called if checkout mode is set to manual.- Specified by:
sourcesUpdated
in interfaceAgentLifeCycleListener
- Parameters:
runningBuild
- current running build
-
personalPatchApplied
public void personalPatchApplied(@NotNull AgentRunningBuild runningBuild)
Description copied from interface:AgentLifeCycleListener
Called when personal patch is applied to checkout directory. Will not be called if build is not personal- Specified by:
personalPatchApplied
in interfaceAgentLifeCycleListener
- Parameters:
runningBuild
- current running build
-
preparationFinished
public void preparationFinished(@NotNull AgentRunningBuild runningBuild)
Called when all preparations for the build are finished (sources checkout, personal patch, artifact dependencies, free disk space requirement, etc), and build is ready to execute it's steps, if there are any.- Specified by:
preparationFinished
in interfaceAgentLifeCycleListener
- Parameters:
runningBuild
- currently running build- Since:
- 10.0
- See Also:
AgentLifeCycleListener.preparationFinished(AgentRunningBuild)
-
beforeRunnerStart
@Deprecated public void beforeRunnerStart(@NotNull AgentRunningBuild runningBuild)
Deprecated.Description copied from interface:AgentLifeCycleListener
Called when the build preparation phase is done (sources are gotten, patch is applied, etc.) the runner is about to be launched. Is called afterAgentLifeCycleListener.buildStarted(AgentRunningBuild)
- Specified by:
beforeRunnerStart
in interfaceAgentLifeCycleListener
- Parameters:
runningBuild
- running build
-
beforeRunnerStart
public void beforeRunnerStart(@NotNull BuildRunnerContext runner)
Description copied from interface:AgentLifeCycleListener
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 afterAgentLifeCycleListener.buildStarted(AgentRunningBuild)
,AgentLifeCycleListener.sourcesUpdated(AgentRunningBuild)
,AgentLifeCycleListener.personalPatchApplied(AgentRunningBuild)
- Specified by:
beforeRunnerStart
in interfaceAgentLifeCycleListener
- Parameters:
runner
- current runner context parameters
-
runnerFinished
public void runnerFinished(@NotNull BuildRunnerContext runner, @NotNull BuildFinishedStatus status)
Description copied from interface:AgentLifeCycleListener
Called afterAgentLifeCycleListener.beforeRunnerStart(BuildRunnerContext)
. This notification is sent when build runner has finished, crashed or was interrupted.- Specified by:
runnerFinished
in interfaceAgentLifeCycleListener
- Parameters:
runner
- current runner context parametersstatus
- status of process run
-
beforeBuildInterrupted
public void beforeBuildInterrupted(@NotNull AgentRunningBuild runningBuild, @NotNull BuildInterruptReason reason)
Description copied from interface:AgentLifeCycleListener
Called before build is forcibly terminated, can be called several times if more than one attempt to terminate build is performed. For example:- build execution time limit is exceeded
- build was stopped from server web UI
- Specified by:
beforeBuildInterrupted
in interfaceAgentLifeCycleListener
- Parameters:
runningBuild
- running buildreason
- reason of build interruption
-
beforeBuildFinish
@Deprecated public void beforeBuildFinish(@NotNull BuildFinishedStatus buildStatus)
Deprecated.Description copied from interface:AgentLifeCycleListener
Called after finishing build but before buildFinished event is sent to the server Is called afterAgentLifeCycleListener.beforeRunnerStart(AgentRunningBuild)
orAgentLifeCycleListener.beforeBuildInterrupted(AgentRunningBuild, BuildInterruptReason)
- Specified by:
beforeBuildFinish
in interfaceAgentLifeCycleListener
- Parameters:
buildStatus
- status of the build
-
beforeBuildFinish
public void beforeBuildFinish(@NotNull AgentRunningBuild build, @NotNull BuildFinishedStatus buildStatus)
Description copied from interface:AgentLifeCycleListener
Called after finishing build but before buildFinished event is sent to the server Is called afterAgentLifeCycleListener.beforeRunnerStart(AgentRunningBuild)
orAgentLifeCycleListener.beforeBuildInterrupted(AgentRunningBuild, BuildInterruptReason)
- Specified by:
beforeBuildFinish
in interfaceAgentLifeCycleListener
- Parameters:
build
- buildbuildStatus
- status of the build
-
personalPatchReverted
public void personalPatchReverted(@NotNull AgentRunningBuild runningBuild)
Description copied from interface:AgentLifeCycleListener
Called when personal patch is reverted Will not be called if build is not personal- Specified by:
personalPatchReverted
in interfaceAgentLifeCycleListener
- Parameters:
runningBuild
- current running build
-
afterAtrifactsPublished
public void afterAtrifactsPublished(@NotNull AgentRunningBuild runningBuild, @NotNull BuildFinishedStatus status)
Description copied from interface:AgentLifeCycleListener
Called when all artifacts were published to the server- Specified by:
afterAtrifactsPublished
in interfaceAgentLifeCycleListener
- Parameters:
runningBuild
- current running buildstatus
- build status
-
buildFinished
@Deprecated public void buildFinished(@NotNull BuildFinishedStatus buildStatus)
Deprecated.Description copied from interface:AgentLifeCycleListener
Called after the buildFinished event is sent to the server Is called afterAgentLifeCycleListener.beforeBuildFinish(BuildFinishedStatus)
New build may be started while processing this event- Specified by:
buildFinished
in interfaceAgentLifeCycleListener
- Parameters:
buildStatus
- status of the build
-
buildFinished
public void buildFinished(@NotNull AgentRunningBuild build, @NotNull BuildFinishedStatus buildStatus)
Description copied from interface:AgentLifeCycleListener
Called after the buildFinished event is sent to the server Is called afterAgentLifeCycleListener.beforeBuildFinish(BuildFinishedStatus)
New build may be started while processing this event- Specified by:
buildFinished
in interfaceAgentLifeCycleListener
- Parameters:
build
- buildbuildStatus
- status of the build
-
messageLogged
public void messageLogged(@NotNull BuildMessage1 buildMessage)
Description copied from interface:AgentLifeCycleListener
Called when a build message logged SeeAgentLifeCycleListener.messageLogged(AgentRunningBuild, jetbrains.buildServer.messages.BuildMessage1)
- Specified by:
messageLogged
in interfaceAgentLifeCycleListener
- Parameters:
buildMessage
- build message
-
messageLogged
public void messageLogged(@NotNull AgentRunningBuild build, @NotNull BuildMessage1 buildMessage)
Description copied from interface:AgentLifeCycleListener
Called when a build message logged- Specified by:
messageLogged
in interfaceAgentLifeCycleListener
- Parameters:
build
- build that received this messagebuildMessage
- build message
-
checkoutDirectoryRemoved
public void checkoutDirectoryRemoved(@NotNull java.io.File checkoutDir)
Description copied from interface:AgentLifeCycleListener
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.- Specified by:
checkoutDirectoryRemoved
in interfaceAgentLifeCycleListener
- Parameters:
checkoutDir
- path of the directory. This directory may not exist at the moment of the call.
-
dependenciesDownloaded
public void dependenciesDownloaded(@NotNull AgentRunningBuild runningBuild)
Called when dependencies for the build have been resolved and downloaded successfully- Specified by:
dependenciesDownloaded
in interfaceAgentLifeCycleListener
- Parameters:
runningBuild
- current running build- Since:
- 10.0
- See Also:
AgentLifeCycleListener.dependenciesDownloaded(AgentRunningBuild)
-
-