Class DefaultBuildAgent
java.lang.Object
com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent
- All Implemented Interfaces:
ExecutableBuildAgent
- Direct Known Subclasses:
RemoteBuildAgent
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultBuildAgent(long agentId, String agentName, @Nullable String agentDescription) -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild(@NotNull ReadOnlyCapabilitySet agentCapabilities, @NotNull DockerContainerController dockerContainerController) Executes the passedCommonContextbooleancancelBuild(@NotNull String buildResultKey) Cancels the passed buildResultKey if it matchesintvoiddisable()voidenable()boolean<V> VexecuteWithCurrentContext(Callable<V> callable) Execute with guarantee that context will not be switched during execution.@Nullable CommonContextGets theBuildContextrelated to the build that is building on the agent.@NotNull StringAgent descriptionlonggetId()Agent idgetName()Agent nameinthashCode()intTells the agent that an unhandled error has occurred.booleanisActive()booleanbooleanbooleanprotected voidprotected voidvoidThis method is called when the build process is completed and the result processing has finished.voidonContextReceived(@NotNull CommonContext commonContext) This method is called when the agent has just retrieved a context from queueprotected voidvoidResetes the error countvoidsetContextToBuild(@NotNull CommonContext newContext) protected voidshutdown()voidstart()Starts the build agentvoidstop()Stops the build agent immediately.voidAttempt to stop the agent and wait for the current build (if any) to stop buildingvoidstopNicely(int statusCode) Attempt to stop the agent and wait for the current build (if any) to stop building.voidwaitForStop(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:ExecutableBuildAgentAgent id- Specified by:
getIdin interfaceExecutableBuildAgent- Returns:
-
getName
Description copied from interface:ExecutableBuildAgentAgent name- Specified by:
getNamein interfaceExecutableBuildAgent- Returns:
-
getDescription
Description copied from interface:ExecutableBuildAgentAgent description- Specified by:
getDescriptionin interfaceExecutableBuildAgent
-
start
public void start()Description copied from interface:ExecutableBuildAgentStarts the build agent- Specified by:
startin 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:ExecutableBuildAgentExecutes the passedCommonContext- Specified by:
buildin interfaceExecutableBuildAgent- Throws:
Exception
-
onBuildProcessingFinished
public void onBuildProcessingFinished()Description copied from interface:ExecutableBuildAgentThis method is called when the build process is completed and the result processing has finished.- Specified by:
onBuildProcessingFinishedin interfaceExecutableBuildAgent
-
onContextReceived
Description copied from interface:ExecutableBuildAgentThis method is called when the agent has just retrieved a context from queue- Specified by:
onContextReceivedin interfaceExecutableBuildAgent
-
cancelBuild
Description copied from interface:ExecutableBuildAgentCancels the passed buildResultKey if it matches- Specified by:
cancelBuildin interfaceExecutableBuildAgent
-
executeWithCurrentContext
Description copied from interface:ExecutableBuildAgentExecute with guarantee that context will not be switched during execution. (i.e. no new build will be picked up by the agent)- Specified by:
executeWithCurrentContextin interfaceExecutableBuildAgent- Throws:
Exception
-
waitForStop
Description copied from interface:ExecutableBuildAgentWaits a certain number of seconds for a build to stop.- Specified by:
waitForStopin interfaceExecutableBuildAgent- Parameters:
secondsToWait- -- Throws:
TimeoutException
-
incrementError
public int incrementError()Description copied from interface:ExecutableBuildAgentTells 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:
incrementErrorin interfaceExecutableBuildAgent- Returns:
-
resetErrors
public void resetErrors()Description copied from interface:ExecutableBuildAgentResetes the error count- Specified by:
resetErrorsin interfaceExecutableBuildAgent
-
isCancelling
public boolean isCancelling() -
stop
public void stop()Description copied from interface:ExecutableBuildAgentStops the build agent immediately. Cancelling all currently running builds- Specified by:
stopin interfaceExecutableBuildAgent
-
shutdown
protected void shutdown() -
stopNicely
public void stopNicely()Description copied from interface:ExecutableBuildAgentAttempt to stop the agent and wait for the current build (if any) to stop building- Specified by:
stopNicelyin interfaceExecutableBuildAgent
-
stopNicely
public void stopNicely(int statusCode) Description copied from interface:ExecutableBuildAgentAttempt 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:
stopNicelyin interfaceExecutableBuildAgent
-
getBuilding
Description copied from interface:ExecutableBuildAgentGets theBuildContextrelated to the build that is building on the agent. Null if not building or cancelling anything.- Specified by:
getBuildingin interfaceExecutableBuildAgent- Returns:
-
setContextToBuild
- Specified by:
setContextToBuildin interfaceExecutableBuildAgent
-
enable
public void enable() -
disable
public void disable() -
isEnabled
public boolean isEnabled() -
getAgentStatus
- Specified by:
getAgentStatusin interfaceExecutableBuildAgent
-
isStopping
public boolean isStopping() -
isActive
public boolean isActive()- Specified by:
isActivein interfaceExecutableBuildAgent
-
hashCode
public int hashCode() -
equals
-
compareTo
-