Class DefaultBuildAgent
java.lang.Object
com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent
- All Implemented Interfaces:
ExecutableBuildAgent
- Direct Known Subclasses:
RemoteBuildAgent
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultBuildAgent
(long agentId, String agentName, @Nullable String agentDescription) -
Method Summary
Modifier and TypeMethodDescriptionvoid
build
(@NotNull ReadOnlyCapabilitySet agentCapabilities, @NotNull DockerContainerController dockerContainerController) Executes the passedCommonContext
boolean
cancelBuild
(@NotNull String buildResultKey) Cancels the passed buildResultKey if it matchesint
void
disable()
void
enable()
boolean
<V> V
executeWithCurrentContext
(Callable<V> callable) Execute with guarantee that context will not be switched during execution.@Nullable CommonContext
Gets theBuildContext
related to the build that is building on the agent.@NotNull String
Agent descriptionlong
getId()
Agent idgetName()
Agent nameint
hashCode()
int
Tells the agent that an unhandled error has occurred.boolean
isActive()
boolean
boolean
boolean
protected void
protected void
void
This method is called when the build process is completed and the result processing has finished.void
onContextReceived
(@NotNull CommonContext commonContext) This method is called when the agent has just retrieved a context from queueprotected void
void
Resetes the error countvoid
setContextToBuild
(@NotNull CommonContext newContext) protected void
shutdown()
void
start()
Starts the build agentvoid
stop()
Stops the build agent immediately.void
Attempt to stop the agent and wait for the current build (if any) to stop buildingvoid
stopNicely
(int statusCode) Attempt to stop the agent and wait for the current build (if any) to stop building.void
waitForStop
(int secondsToWait) Waits a certain number of seconds for a build to stop.
-
Field Details
-
buildContext
-
-
Constructor Details
-
DefaultBuildAgent
-
-
Method Details
-
getId
public long getId()Description copied from interface:ExecutableBuildAgent
Agent id- Specified by:
getId
in interfaceExecutableBuildAgent
- Returns:
-
getName
Description copied from interface:ExecutableBuildAgent
Agent name- Specified by:
getName
in interfaceExecutableBuildAgent
- Returns:
-
getDescription
Description copied from interface:ExecutableBuildAgent
Agent description- Specified by:
getDescription
in interfaceExecutableBuildAgent
-
start
public void start()Description copied from interface:ExecutableBuildAgent
Starts the build agent- Specified by:
start
in interfaceExecutableBuildAgent
-
onAgentReadyToBuild
protected void onAgentReadyToBuild() -
onBetweenBuilds
protected void onBetweenBuilds() -
onMainThreadEnd
protected void onMainThreadEnd() -
build
public void build(@NotNull @NotNull ReadOnlyCapabilitySet agentCapabilities, @NotNull @NotNull DockerContainerController dockerContainerController) throws Exception Description copied from interface:ExecutableBuildAgent
Executes the passedCommonContext
- Specified by:
build
in interfaceExecutableBuildAgent
- Throws:
Exception
-
onBuildProcessingFinished
public void onBuildProcessingFinished()Description copied from interface:ExecutableBuildAgent
This method is called when the build process is completed and the result processing has finished.- Specified by:
onBuildProcessingFinished
in interfaceExecutableBuildAgent
-
onContextReceived
Description copied from interface:ExecutableBuildAgent
This method is called when the agent has just retrieved a context from queue- Specified by:
onContextReceived
in interfaceExecutableBuildAgent
-
cancelBuild
Description copied from interface:ExecutableBuildAgent
Cancels the passed buildResultKey if it matches- Specified by:
cancelBuild
in interfaceExecutableBuildAgent
-
executeWithCurrentContext
Description copied from interface:ExecutableBuildAgent
Execute with guarantee that context will not be switched during execution. (i.e. no new build will be picked up by the agent)- Specified by:
executeWithCurrentContext
in interfaceExecutableBuildAgent
- Throws:
Exception
-
waitForStop
Description copied from interface:ExecutableBuildAgent
Waits a certain number of seconds for a build to stop.- Specified by:
waitForStop
in interfaceExecutableBuildAgent
- Parameters:
secondsToWait
- -- Throws:
TimeoutException
-
incrementError
public int incrementError()Description copied from interface:ExecutableBuildAgent
Tells the agent that an unhandled error has occurred. The agent may then choose to stop the error if a thredhold has been reached. Provides an overload of exceptions being thrown.- Specified by:
incrementError
in interfaceExecutableBuildAgent
- Returns:
-
resetErrors
public void resetErrors()Description copied from interface:ExecutableBuildAgent
Resetes the error count- Specified by:
resetErrors
in interfaceExecutableBuildAgent
-
isCancelling
public boolean isCancelling() -
stop
public void stop()Description copied from interface:ExecutableBuildAgent
Stops the build agent immediately. Cancelling all currently running builds- Specified by:
stop
in interfaceExecutableBuildAgent
-
shutdown
protected void shutdown() -
stopNicely
public void stopNicely()Description copied from interface:ExecutableBuildAgent
Attempt to stop the agent and wait for the current build (if any) to stop building- Specified by:
stopNicely
in interfaceExecutableBuildAgent
-
stopNicely
public void stopNicely(int statusCode) Description copied from interface:ExecutableBuildAgent
Attempt to stop the agent and wait for the current build (if any) to stop building. If it's a non-local agent, then it will terminate with the given status code.- Specified by:
stopNicely
in interfaceExecutableBuildAgent
-
getBuilding
Description copied from interface:ExecutableBuildAgent
Gets theBuildContext
related to the build that is building on the agent. Null if not building or cancelling anything.- Specified by:
getBuilding
in interfaceExecutableBuildAgent
- Returns:
-
setContextToBuild
- Specified by:
setContextToBuild
in interfaceExecutableBuildAgent
-
enable
public void enable() -
disable
public void disable() -
isEnabled
public boolean isEnabled() -
getAgentStatus
- Specified by:
getAgentStatus
in interfaceExecutableBuildAgent
-
isStopping
public boolean isStopping() -
isActive
public boolean isActive()- Specified by:
isActive
in interfaceExecutableBuildAgent
-
hashCode
public int hashCode() -
equals
-
compareTo
-