Package jetbrains.buildServer.agent
Interface AgentLifeCycleListener
-
- All Superinterfaces:
EventListener
- All Known Implementing Classes:
AgentBuildStepStatusFixer
,AgentLifeCycleAdapter
,AgentServiceMessagesRegisterImpl
,ArtifactPostBuildCleaner
,BuildCacheHolder
,BuildMessagesPasswordTranslator
,BuildStageStatisticsReporter
,CheckoutDirectoryStructurePublisher
,CurrentBuildTrackerImpl
,DirectoryMapWatcher
,HostnameParameterProvider
,SslAgentLifeCycleAdapter
,WatchDogServiceMessageHandler
@UserImplemented(adapterClass=AgentLifeCycleAdapter.class) public interface AgentLifeCycleListener extends EventListener
Agent events listener Calls sequence is the following on build agent start:pluginsLoaded()
beforeAgentConfigurationLoaded(BuildAgent)
afterAgentConfigurationLoaded(BuildAgent)
agentInitialized(BuildAgent)
agentStarted(BuildAgent)
agentShutdown()
buildStarted(AgentRunningBuild)
sourcesUpdated(AgentRunningBuild)
personalPatchApplied(AgentRunningBuild)
preparationFinished(AgentRunningBuild)
beforeRunnerStart(BuildRunnerContext)
runnerFinished(BuildRunnerContext, BuildFinishedStatus)
beforeBuildInterrupted(AgentRunningBuild, BuildInterruptReason)
may not be calledbeforeBuildFinish(AgentRunningBuild, BuildFinishedStatus)
personalPatchReverted(AgentRunningBuild)
afterAtrifactsPublished(AgentRunningBuild, BuildFinishedStatus)
buildFinished(AgentRunningBuild, BuildFinishedStatus)
messageLogged(AgentRunningBuild, jetbrains.buildServer.messages.BuildMessage1)
messageLogged(jetbrains.buildServer.messages.BuildMessage1)
AgentLifeCycleAdapter
instead
To subscribe to this event listener you should use Spring bean of typeEventDispatcher
ofAgentLifeCycleListener
and callEventDispatcher.addListener(java.util.EventListener)
} method.- See Also:
AgentLifeCycleAdapter
-
-
Method Summary
All Methods Instance Methods Abstract 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 beforeagentInitialized(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 beforeagentInitialized(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 afterbeforeRunnerStart(AgentRunningBuild)
orbeforeBuildInterrupted(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 afterbeforeBuildFinish(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(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 SeemessageLogged(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)
Called afterbeforeRunnerStart(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 beforeagentInitialized(BuildAgent)
This is a right place to detect environment and set agent-wide properties usingBuildAgentConfiguration
interface- Parameters:
agent
- agent
-
afterAgentConfigurationLoaded
void afterAgentConfigurationLoaded(@NotNull BuildAgent agent)
is called after build agent loaded it's properties and it is called beforeagentInitialized(BuildAgent)
This is a right place to update loaded environment and set agent-wide properties usingBuildAgentConfiguration
interface- Parameters:
agent
- agent
-
pluginsLoaded
void pluginsLoaded()
Called after plugin manager has loaded all plugins.
-
agentInitialized
void agentInitialized(@NotNull BuildAgent agent)
Called when methodBuildAgent.init(String[])
finished- Parameters:
agent
- build agent
-
agentStarted
void agentStarted(@NotNull BuildAgent agent)
Called after the agentBuildAgent.start()
method- Parameters:
agent
- build agent
-
agentShutdown
void agentShutdown()
Called before agent shutdown
-
checkoutModeResolved
void checkoutModeResolved(@NotNull AgentCheckoutMode agentCheckoutMode)
Called when effective checkout mode is resolved for the build. It's guaranteed that after this event,AgentRunningBuild.getEffectiveCheckoutMode()
will return non-null value.- Since:
- 10.0
-
buildStarted
void buildStarted(@NotNull AgentRunningBuild runningBuild)
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.- Parameters:
runningBuild
- information about running build
-
sourcesUpdated
void sourcesUpdated(@NotNull AgentRunningBuild runningBuild)
Called when non personal changes are applied to checkout directory. Called afterbuildStarted(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
-
preparationFinished
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.- Parameters:
runningBuild
- currently running build- Since:
- 10.0
-
beforeRunnerStart
@Deprecated void beforeRunnerStart(@NotNull AgentRunningBuild runningBuild)
Deprecated.Called when the build preparation phase is done (sources are gotten, patch is applied, etc.) the runner is about to be launched. Is called afterbuildStarted(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 afterbuildStarted(AgentRunningBuild)
,sourcesUpdated(AgentRunningBuild)
,personalPatchApplied(AgentRunningBuild)
- Parameters:
runner
- current runner context parameters- Since:
- 6.0
-
runnerFinished
void runnerFinished(@NotNull BuildRunnerContext runner, @NotNull BuildFinishedStatus status)
Called afterbeforeRunnerStart(BuildRunnerContext)
. This notification is sent when build runner has finished, crashed or was interrupted.- Parameters:
runner
- current runner context parametersstatus
- status of process run- Since:
- 6.0
-
beforeBuildInterrupted
void beforeBuildInterrupted(@NotNull AgentRunningBuild runningBuild, @NotNull BuildInterruptReason reason)
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
- Parameters:
runningBuild
- running buildreason
- reason of build interruption- Since:
- 4.5
-
beforeBuildFinish
@Deprecated void beforeBuildFinish(@NotNull BuildFinishedStatus buildStatus)
Deprecated.Called after finishing build but before buildFinished event is sent to the server Is called afterbeforeRunnerStart(AgentRunningBuild)
orbeforeBuildInterrupted(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 afterbeforeRunnerStart(AgentRunningBuild)
orbeforeBuildInterrupted(AgentRunningBuild, BuildInterruptReason)
- Parameters:
build
- buildbuildStatus
- 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 buildstatus
- build status- Since:
- 6.5
-
buildFinished
@Deprecated void buildFinished(@NotNull BuildFinishedStatus buildStatus)
Deprecated.Called after the buildFinished event is sent to the server Is called afterbeforeBuildFinish(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 afterbeforeBuildFinish(BuildFinishedStatus)
New build may be started while processing this event- Parameters:
build
- buildbuildStatus
- status of the build- Since:
- 6.0
-
messageLogged
void messageLogged(@NotNull BuildMessage1 buildMessage)
Called when a build message logged SeemessageLogged(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 messagebuildMessage
- build message- Since:
- 6.0
-
checkoutDirectoryRemoved
void checkoutDirectoryRemoved(@NotNull 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.
-
dependenciesDownloaded
void dependenciesDownloaded(@NotNull AgentRunningBuild runningBuild)
Called when dependencies for the build have been resolved and downloaded successfully- Parameters:
runningBuild
- current running build- Since:
- 10.0
-
-