Class AgentManagerImpl
- java.lang.Object
-
- com.atlassian.bamboo.buildqueue.manager.AgentManagerImpl
-
- All Implemented Interfaces:
AgentManager
,LocalAgentManager
public class AgentManagerImpl extends Object implements AgentManager, LocalAgentManager
-
-
Field Summary
-
Fields inherited from interface com.atlassian.bamboo.buildqueue.manager.AgentManager
DEFAULT_AGENT_NAME
-
-
Constructor Summary
Constructors Constructor Description AgentManagerImpl(AgentDao agentDao, CapabilitySetManager capabilitySetManager, CapabilityManager capabilityManager, com.atlassian.event.api.EventPublisher eventPublisher, BambooLicenseManager bambooLicenseManager, ElasticInstanceManager elasticInstanceManager, ErrorUpdateHandler errorUpdateHandler, BuildLoggerManager buildLoggerManager, FeatureManager featureManager, DeploymentsInProgressService deploymentsInProgressService, ElasticTunnelDefinitionDao elasticTunnelDefinitionDao, EphemeralAgentsService ephemeralAgentsService, EphemeralAgentExecutionService ephemeralAgentExecutionService, EphemeralAgentManagementLogger ephemeralAgentManagementLogger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abandonBuild(@NotNull BuildAgent remoteAgent, boolean agentStartingUp)
boolean
allowNewElasticAgent()
Allow an elastic agent to register and come online? Based on licensing restrictions.boolean
allowNewElasticAgents(int numOfAgentsToCreate)
Allow a specified number of elastic agents to register and come online? Based on licensing restrictions.boolean
allowNewElasticAgentWithId(long id)
Allow an elastic agent with specific id to register and come online? Based on licensing restrictions.boolean
allowNewEphemeralAgent()
Allow an ephemeral agent to register and come online? Based on licensing restrictions.boolean
allowNewEphemeralAgentWithId(long id)
Allow an ephemeral agent with specific id to register and come online? Based on licensing restrictions.boolean
allowNewLocalAgent()
Allow a local agent to come online? Based on licensing restrictions.boolean
allowNewRemoteAgent()
Allow a remote agent to register and come online? Based on licensing restrictions.boolean
allowNewRemoteAgents(int numOfAgentsToCreate)
Allow a specified number of remote agents to register and come online? Based on licensing restrictions.boolean
allowNewRemoteAgentWithId(long id)
Allow a remote agent with specific id to register and come online? Based on licensing restrictions.boolean
checkPipelinesAreDisabled()
void
createDefaultAgent()
sets up a default local agent if no local agent existsvoid
createLocalAgent(LocalAgentDefinition definition)
Create a new local agent.void
disableAllAgents()
Disable all pipelinesvoid
enableAllAgents()
Enable all pipelines<T> T
executeIfIdle(Callable<T> callable)
Executes a givenCallable
only if no builds are in progress.Map<Long,PipelineDefinition>
findAllAgentsForAgentIds(@NotNull Collection<Long> agentIds)
Returns a Map ofPipelineDefinition
s keyed by their id@NotNull Collection<BuildAgent>
getActiveAndEnabledAgents()
Returns agents that are enabled and online@Nullable BuildAgent
getAgent(long agentId)
long
getAgentCount(Class<? extends PipelineDefinition> agentDefinitionClass)
Retrieves the amount of agents of given type stored in the database@Nullable PipelineDefinition
getAgentDefinition(@NotNull Long agentId)
@Nullable PipelineDefinition
getAgentDefinitionByName(@NotNull String name)
Retrieve a pipelineDefinition by name.@NotNull List<PipelineDefinition>
getAgentDefinitionsWithNameLike(@NotNull String likeName)
Return a list of agents whose name is like the provided string.@NotNull List<BuildAgent>
getAllAgents()
@NotNull List<ElasticAgentDefinition>
getAllElasticAgentDefinitions(int firstResult, int maxResults)
Retrieve most recently terminated elastic agent definitions from db, ordered by termination time, descending.@NotNull List<ElasticAgentDefinition>
getAllElasticAgentDefinitions(@NotNull Collection<String> instanceIds)
Retrieve elastic agent definitions from db.@NotNull List<LocalBuildAgent>
getAllLocalAgents()
Returns allLocalBuildAgent
objects@NotNull List<BuildAgent>
getAllNonElasticAgents()
List<PipelineDefinition>
getAllPersistedAgentDefinitions()
Retrieves a list of all agent definitions stored in the database.@NotNull List<BuildAgent>
getAllRemoteAgents()
Gets all remote agents in the system.@NotNull List<BuildAgent>
getAllRemoteAgents(boolean onlineOnly)
Get remote agents.@NotNull List<BuildAgent>
getAllStandardAgents()
@NotNull Collection<BuildAgent>
getBusyBuildAgents()
Gets a collection agents that are currently building or cancelling a build@NotNull Collection<BuildAgent>
getElasticActiveAndEnabledAgents()
Returns elastic agents that are enabled and online@NotNull Optional<BuildAgent>
getEphemeralAgentByPodName(@NotNull String podName)
Returns aBuildAgent
by given pod name (if exists).@NotNull List<EphemeralAgentPod>
getEphemeralAgentPods()
Returns a list of ephemeral agents related pods in any phase present in the connected cluster at the moment of request.@NotNull List<EphemeralAgentPod>
getEventuallyConsistentEphemeralAgentPods()
Returns a list of ephemeral agents related pods in any phase present in the connected cluster.@NotNull Collection<LocalBuildAgent>
getLocalActiveAndEnabledAgents()
Returns local agents that are enabled and onlineLocalBuildAgent
getLocalAgent(long pipelineId)
Returns the pipeline that matches the passed id@NotNull List<BuildAgent>
getOnlineElasticAgents()
Retrieve all online elastic build agents.int
getPendingEphemeralAgentsEstimatedCount()
Get estimated number of pending ephemeral agents.@NotNull Collection<BuildAgent>
getRemoteActiveAndEnabledAgents()
Returns remote agents that are enabled and onlinevoid
initAgents()
Inits the local agents Must be ran before any other methods.void
onAgentReturning(@NotNull BuildAgent agent)
Performs any other operations required when an agent goes offline, such as updating the status and shutdown time.void
removeAgent(long agentId)
Removes the passed agentvoid
removeEphemeralAgent(long agentId)
Removes the agent if the ephemeral one with requested ID is found.void
saveAnyPipeline(@NotNull PipelineDefinition pipelineDefinition)
Stores a pipelinePipelineDefinition
of any type (elastic, local, remote) AgentConfigurationUpdateEvent is fired after the pipeline is savedvoid
saveAnyPipeline(@NotNull PipelineDefinition pipelineDefinition, @Nullable AgentConfigurationUpdatedEventFactory eventFactory)
Stores a pipelinePipelineDefinition
of any type (elastic, local, remote)void
saveElasticPipeline(@NotNull ElasticAgentDefinition elasticDefinition)
Stores the elasticPipelineDefinition
void
saveEphemeralPipeline(@NotNull EphemeralAgentDefinition pipelineDefinition)
Stores the ephemeralPipelineDefinition
void
savePipeline(@NotNull PipelineDefinition pipelineDefinition)
Stores thePipelineDefinition
.void
savePipeline(@NotNull PipelineDefinition pipelineDefinition, @Nullable AgentConfigurationUpdatedEventFactory eventFactory)
Stores thePipelineDefinition
.void
saveReturningElasticPipeline(@NotNull ElasticAgentDefinition elasticDefinition)
Stores the elasticPipelineDefinition
of a returning elastic agent.Optional<BuildAgent>
setAgentEnabled(long agentId, boolean enable)
void
startLocalAgents()
Starts all currentLocalBuildAgent
objectsvoid
stopAgent(@NotNull BuildAgent agent)
Performs any other operations required when an agent goes offline, such as updating the status and shutdown time.void
stopEphemeralAgentByPodName(@NotNull String podName)
Stops the ephemeral agent with requested pod name.void
stopLocalAgents()
Stops allLocalBuildAgent
boolean
updateAgentStatusIfResultReturnPossibleAfterServerRestart(long agentId, ResultKey resultKey, String displayName, long deploymentResultId)
Checks if agent is capable of 'surviving' a server restart, i.e.
-
-
-
Constructor Detail
-
AgentManagerImpl
public AgentManagerImpl(AgentDao agentDao, CapabilitySetManager capabilitySetManager, CapabilityManager capabilityManager, com.atlassian.event.api.EventPublisher eventPublisher, BambooLicenseManager bambooLicenseManager, ElasticInstanceManager elasticInstanceManager, ErrorUpdateHandler errorUpdateHandler, BuildLoggerManager buildLoggerManager, FeatureManager featureManager, DeploymentsInProgressService deploymentsInProgressService, ElasticTunnelDefinitionDao elasticTunnelDefinitionDao, EphemeralAgentsService ephemeralAgentsService, EphemeralAgentExecutionService ephemeralAgentExecutionService, EphemeralAgentManagementLogger ephemeralAgentManagementLogger)
-
-
Method Detail
-
createDefaultAgent
public void createDefaultAgent()
Description copied from interface:AgentManager
sets up a default local agent if no local agent exists- Specified by:
createDefaultAgent
in interfaceAgentManager
-
initAgents
public void initAgents()
Description copied from interface:AgentManager
Inits the local agents Must be ran before any other methods.- Specified by:
initAgents
in interfaceAgentManager
-
startLocalAgents
public void startLocalAgents()
Description copied from interface:AgentManager
Starts all currentLocalBuildAgent
objects- Specified by:
startLocalAgents
in interfaceAgentManager
-
stopLocalAgents
public void stopLocalAgents()
Description copied from interface:AgentManager
Stops allLocalBuildAgent
- Specified by:
stopLocalAgents
in interfaceAgentManager
-
getAllLocalAgents
@NotNull public @NotNull List<LocalBuildAgent> getAllLocalAgents()
Description copied from interface:AgentManager
Returns allLocalBuildAgent
objects- Specified by:
getAllLocalAgents
in interfaceAgentManager
- Returns:
- A copied collection of
LocalBuildAgent
objects, or an empty collection if none exists.
-
getOnlineElasticAgents
@NotNull public @NotNull List<BuildAgent> getOnlineElasticAgents()
Description copied from interface:AgentManager
Retrieve all online elastic build agents.- Specified by:
getOnlineElasticAgents
in interfaceAgentManager
- Returns:
-
getAllElasticAgentDefinitions
@NotNull public @NotNull List<ElasticAgentDefinition> getAllElasticAgentDefinitions(int firstResult, int maxResults)
Description copied from interface:AgentManager
Retrieve most recently terminated elastic agent definitions from db, ordered by termination time, descending.- Specified by:
getAllElasticAgentDefinitions
in interfaceAgentManager
- Returns:
- list of ElasticAgents
-
getAgentCount
public long getAgentCount(Class<? extends PipelineDefinition> agentDefinitionClass)
Description copied from interface:AgentManager
Retrieves the amount of agents of given type stored in the database- Specified by:
getAgentCount
in interfaceAgentManager
- Parameters:
agentDefinitionClass
- agent type- Returns:
- amount of agents
-
getAllElasticAgentDefinitions
@NotNull public @NotNull List<ElasticAgentDefinition> getAllElasticAgentDefinitions(@NotNull @NotNull Collection<String> instanceIds)
Description copied from interface:AgentManager
Retrieve elastic agent definitions from db.- Specified by:
getAllElasticAgentDefinitions
in interfaceAgentManager
- Parameters:
instanceIds
- the instances ids on which the agents were running- Returns:
- list of ElasticAgents
-
getAllRemoteAgents
@NotNull public @NotNull List<BuildAgent> getAllRemoteAgents(boolean onlineOnly)
Description copied from interface:AgentManager
Get remote agents.- Specified by:
getAllRemoteAgents
in interfaceAgentManager
- Parameters:
onlineOnly
- - only return those agents which are online currently.- Returns:
-
getAllRemoteAgents
@NotNull public @NotNull List<BuildAgent> getAllRemoteAgents()
Description copied from interface:AgentManager
Gets all remote agents in the system. They can be offline.- Specified by:
getAllRemoteAgents
in interfaceAgentManager
- Returns:
- all remote agents.
-
getAllAgents
@NotNull public @NotNull List<BuildAgent> getAllAgents()
- Specified by:
getAllAgents
in interfaceAgentManager
-
getAllNonElasticAgents
@NotNull public @NotNull List<BuildAgent> getAllNonElasticAgents()
- Specified by:
getAllNonElasticAgents
in interfaceAgentManager
-
getAllStandardAgents
@NotNull public @NotNull List<BuildAgent> getAllStandardAgents()
- Specified by:
getAllStandardAgents
in interfaceAgentManager
- Returns:
- all standard agents, i.e. not ephemeral and not elastic
-
getBusyBuildAgents
@NotNull public @NotNull Collection<BuildAgent> getBusyBuildAgents()
Description copied from interface:AgentManager
Gets a collection agents that are currently building or cancelling a build- Specified by:
getBusyBuildAgents
in interfaceAgentManager
- Returns:
- Collection of
BuildAgent
-
getActiveAndEnabledAgents
@NotNull public @NotNull Collection<BuildAgent> getActiveAndEnabledAgents()
Description copied from interface:AgentManager
Returns agents that are enabled and online- Specified by:
getActiveAndEnabledAgents
in interfaceAgentManager
- Returns:
- Collection of
BuildAgent
-
getRemoteActiveAndEnabledAgents
@NotNull public @NotNull Collection<BuildAgent> getRemoteActiveAndEnabledAgents()
Description copied from interface:AgentManager
Returns remote agents that are enabled and online- Specified by:
getRemoteActiveAndEnabledAgents
in interfaceAgentManager
- Returns:
- Collection of
BuildAgent
-
getElasticActiveAndEnabledAgents
@NotNull public @NotNull Collection<BuildAgent> getElasticActiveAndEnabledAgents()
Description copied from interface:AgentManager
Returns elastic agents that are enabled and online- Specified by:
getElasticActiveAndEnabledAgents
in interfaceAgentManager
- Returns:
- Collection of
BuildAgent
-
getLocalActiveAndEnabledAgents
@NotNull public @NotNull Collection<LocalBuildAgent> getLocalActiveAndEnabledAgents()
Description copied from interface:AgentManager
Returns local agents that are enabled and online- Specified by:
getLocalActiveAndEnabledAgents
in interfaceAgentManager
- Returns:
- Collection of
LocalBuildAgent
-
createLocalAgent
public void createLocalAgent(LocalAgentDefinition definition) throws BambooLicenseException
Description copied from interface:AgentManager
Create a new local agent.- Specified by:
createLocalAgent
in interfaceAgentManager
- Throws:
BambooLicenseException
-
savePipeline
public void savePipeline(@NotNull @NotNull PipelineDefinition pipelineDefinition)
Description copied from interface:AgentManager
Stores thePipelineDefinition
. Updates any caches so calls toAgentManager.getLocalAgent(long)
will return theLocalBuildAgent
returns with the new definition- Specified by:
savePipeline
in interfaceAgentManager
- Parameters:
pipelineDefinition
- - Must not be null
-
savePipeline
public void savePipeline(@NotNull @NotNull PipelineDefinition pipelineDefinition, @Nullable @Nullable AgentConfigurationUpdatedEventFactory eventFactory)
Description copied from interface:AgentManager
Stores thePipelineDefinition
. Updates any caches so calls toAgentManager.getLocalAgent(long)
will return theLocalBuildAgent
returns with the new definition- Specified by:
savePipeline
in interfaceAgentManager
- Parameters:
pipelineDefinition
- - Must not be nulleventFactory
- event factory used to create event sent after the pipeline is saved
-
saveElasticPipeline
public void saveElasticPipeline(@NotNull @NotNull ElasticAgentDefinition elasticDefinition)
Description copied from interface:AgentManager
Stores the elasticPipelineDefinition
- Specified by:
saveElasticPipeline
in interfaceAgentManager
- Parameters:
elasticDefinition
- - Must not be null
-
saveEphemeralPipeline
public void saveEphemeralPipeline(@NotNull @NotNull EphemeralAgentDefinition pipelineDefinition)
Description copied from interface:AgentManager
Stores the ephemeralPipelineDefinition
- Specified by:
saveEphemeralPipeline
in interfaceAgentManager
- Parameters:
pipelineDefinition
- - Must not be null
-
saveReturningElasticPipeline
public void saveReturningElasticPipeline(@NotNull @NotNull ElasticAgentDefinition elasticDefinition)
Description copied from interface:AgentManager
Stores the elasticPipelineDefinition
of a returning elastic agent.- Specified by:
saveReturningElasticPipeline
in interfaceAgentManager
- Parameters:
elasticDefinition
- returning elastic agent definition
-
getAllPersistedAgentDefinitions
public List<PipelineDefinition> getAllPersistedAgentDefinitions()
Description copied from interface:AgentManager
Retrieves a list of all agent definitions stored in the database.- Specified by:
getAllPersistedAgentDefinitions
in interfaceAgentManager
-
abandonBuild
public void abandonBuild(@NotNull @NotNull BuildAgent remoteAgent, boolean agentStartingUp)
- Specified by:
abandonBuild
in interfaceAgentManager
-
onAgentReturning
public void onAgentReturning(@NotNull @NotNull BuildAgent agent)
Description copied from interface:AgentManager
Performs any other operations required when an agent goes offline, such as updating the status and shutdown time. Called when agent re-registered without being marked as offline.- Specified by:
onAgentReturning
in interfaceAgentManager
- Parameters:
agent
- to be stopped
-
stopAgent
public void stopAgent(@NotNull @NotNull BuildAgent agent)
Description copied from interface:AgentManager
Performs any other operations required when an agent goes offline, such as updating the status and shutdown time.- Specified by:
stopAgent
in interfaceAgentManager
- Parameters:
agent
- to be stopped
-
getLocalAgent
public LocalBuildAgent getLocalAgent(long pipelineId)
Description copied from interface:AgentManager
Returns the pipeline that matches the passed id- Specified by:
getLocalAgent
in interfaceAgentManager
- Returns:
- Matching
LocalBuildAgent
object. Null if pipeline does not exist
-
getAgent
@Nullable public @Nullable BuildAgent getAgent(long agentId)
- Specified by:
getAgent
in interfaceAgentManager
-
getAgentDefinition
@Nullable public @Nullable PipelineDefinition getAgentDefinition(@NotNull @NotNull Long agentId)
- Specified by:
getAgentDefinition
in interfaceAgentManager
-
getEphemeralAgentPods
@NotNull public @NotNull List<EphemeralAgentPod> getEphemeralAgentPods()
Description copied from interface:AgentManager
Returns a list of ephemeral agents related pods in any phase present in the connected cluster at the moment of request.- Specified by:
getEphemeralAgentPods
in interfaceAgentManager
- Returns:
- a List of
EphemeralAgentPod
-
getEventuallyConsistentEphemeralAgentPods
@NotNull public @NotNull List<EphemeralAgentPod> getEventuallyConsistentEphemeralAgentPods()
Description copied from interface:AgentManager
Returns a list of ephemeral agents related pods in any phase present in the connected cluster. The results may be stale. The desired order of magnitude of delay is seconds.- Specified by:
getEventuallyConsistentEphemeralAgentPods
in interfaceAgentManager
- Returns:
- a List of
EphemeralAgentPod
-
getPendingEphemeralAgentsEstimatedCount
public int getPendingEphemeralAgentsEstimatedCount()
Description copied from interface:AgentManager
Get estimated number of pending ephemeral agents.- Specified by:
getPendingEphemeralAgentsEstimatedCount
in interfaceAgentManager
-
getEphemeralAgentByPodName
@NotNull public @NotNull Optional<BuildAgent> getEphemeralAgentByPodName(@NotNull @NotNull String podName)
Description copied from interface:AgentManager
Returns aBuildAgent
by given pod name (if exists).- Specified by:
getEphemeralAgentByPodName
in interfaceAgentManager
-
stopEphemeralAgentByPodName
public void stopEphemeralAgentByPodName(@NotNull @NotNull String podName)
Description copied from interface:AgentManager
Stops the ephemeral agent with requested pod name.- Specified by:
stopEphemeralAgentByPodName
in interfaceAgentManager
- Parameters:
podName
- name of the pod the ephemeral agent is running on
-
findAllAgentsForAgentIds
public Map<Long,PipelineDefinition> findAllAgentsForAgentIds(@NotNull @NotNull Collection<Long> agentIds)
Description copied from interface:AgentManager
Returns a Map ofPipelineDefinition
s keyed by their id- Specified by:
findAllAgentsForAgentIds
in interfaceAgentManager
- Returns:
- agentMap
-
getAgentDefinitionByName
@Nullable public @Nullable PipelineDefinition getAgentDefinitionByName(@NotNull @NotNull String name)
Description copied from interface:AgentManager
Retrieve a pipelineDefinition by name. Names should be unique.- Specified by:
getAgentDefinitionByName
in interfaceAgentManager
- Parameters:
name
- of the agent to find- Returns:
- the agent that has the given name.
-
getAgentDefinitionsWithNameLike
@NotNull public @NotNull List<PipelineDefinition> getAgentDefinitionsWithNameLike(@NotNull @NotNull String likeName)
Description copied from interface:AgentManager
Return a list of agents whose name is like the provided string. Uses hibernate's "like" so % to mark wild card.- Specified by:
getAgentDefinitionsWithNameLike
in interfaceAgentManager
- Parameters:
likeName
- the string to match- Returns:
- List of Pipeline Definitions
-
saveAnyPipeline
public void saveAnyPipeline(@NotNull @NotNull PipelineDefinition pipelineDefinition)
Description copied from interface:AgentManager
Stores a pipelinePipelineDefinition
of any type (elastic, local, remote) AgentConfigurationUpdateEvent is fired after the pipeline is saved- Specified by:
saveAnyPipeline
in interfaceAgentManager
- Parameters:
pipelineDefinition
- - Must not be null
-
saveAnyPipeline
public void saveAnyPipeline(@NotNull @NotNull PipelineDefinition pipelineDefinition, @Nullable @Nullable AgentConfigurationUpdatedEventFactory eventFactory)
Description copied from interface:AgentManager
Stores a pipelinePipelineDefinition
of any type (elastic, local, remote)- Specified by:
saveAnyPipeline
in interfaceAgentManager
- Parameters:
pipelineDefinition
- Must not be nulleventFactory
- event factory used to create event sent after the pipeline is saved
-
disableAllAgents
public void disableAllAgents()
Description copied from interface:AgentManager
Disable all pipelines- Specified by:
disableAllAgents
in interfaceAgentManager
-
enableAllAgents
public void enableAllAgents()
Description copied from interface:AgentManager
Enable all pipelines- Specified by:
enableAllAgents
in interfaceAgentManager
-
checkPipelinesAreDisabled
public boolean checkPipelinesAreDisabled()
- Specified by:
checkPipelinesAreDisabled
in interfaceAgentManager
- Returns:
- whether or not all pipelines are disabled
-
executeIfIdle
public <T> T executeIfIdle(Callable<T> callable) throws Exception
Description copied from interface:AgentManager
Executes a given
Callable
only if no builds are in progress. Builds are prevented from starting while theCallable
executes.- Specified by:
executeIfIdle
in interfaceAgentManager
- Parameters:
callable
- theCallable
to be executed- Returns:
- the result of
callable
- Throws:
BambooBusyException
- if builds are in progressException
- if thrown bycallable
-
removeAgent
public void removeAgent(long agentId) throws TimeoutException
Description copied from interface:AgentManager
Removes the passed agent- Specified by:
removeAgent
in interfaceAgentManager
- Throws:
TimeoutException
-
removeEphemeralAgent
public void removeEphemeralAgent(long agentId)
Description copied from interface:AgentManager
Removes the agent if the ephemeral one with requested ID is found. If the agent is not ephemeral - nothing happens.- Specified by:
removeEphemeralAgent
in interfaceAgentManager
- Parameters:
agentId
- agent unique identifier
-
allowNewRemoteAgent
public boolean allowNewRemoteAgent()
Description copied from interface:AgentManager
Allow a remote agent to register and come online? Based on licensing restrictions. The method takes into consideration the number of agents "reserved" for pending elastic instances.- Specified by:
allowNewRemoteAgent
in interfaceAgentManager
- Returns:
- true if a new agent is allowed, otherise false
-
allowNewRemoteAgentWithId
public boolean allowNewRemoteAgentWithId(long id)
Description copied from interface:AgentManager
Allow a remote agent with specific id to register and come online? Based on licensing restrictions. The method takes into consideration the number of agents "reserved" for pending elastic instances.- Specified by:
allowNewRemoteAgentWithId
in interfaceAgentManager
- Parameters:
id
- agent id- Returns:
- true if a new agent is allowed, otherise false
-
allowNewRemoteAgents
public boolean allowNewRemoteAgents(int numOfAgentsToCreate)
Description copied from interface:AgentManager
Allow a specified number of remote agents to register and come online? Based on licensing restrictions. The method takes into consideration the number of agents "reserved" for pending elastic instances.- Specified by:
allowNewRemoteAgents
in interfaceAgentManager
- Returns:
- true if a specified number agents is allowed, otherise false
-
allowNewElasticAgent
public boolean allowNewElasticAgent()
Description copied from interface:AgentManager
Allow an elastic agent to register and come online? Based on licensing restrictions.- Specified by:
allowNewElasticAgent
in interfaceAgentManager
- Returns:
- true if a new agent is allowed, otherise false
-
allowNewElasticAgentWithId
public boolean allowNewElasticAgentWithId(long id)
Description copied from interface:AgentManager
Allow an elastic agent with specific id to register and come online? Based on licensing restrictions.- Specified by:
allowNewElasticAgentWithId
in interfaceAgentManager
- Parameters:
id
- agent id- Returns:
- true if a new agent is allowed, otherise false
-
allowNewEphemeralAgent
public boolean allowNewEphemeralAgent()
Description copied from interface:AgentManager
Allow an ephemeral agent to register and come online? Based on licensing restrictions.- Specified by:
allowNewEphemeralAgent
in interfaceAgentManager
- Returns:
- true if a new agent is allowed, otherise false
-
allowNewEphemeralAgentWithId
public boolean allowNewEphemeralAgentWithId(long id)
Description copied from interface:AgentManager
Allow an ephemeral agent with specific id to register and come online? Based on licensing restrictions.- Specified by:
allowNewEphemeralAgentWithId
in interfaceAgentManager
- Parameters:
id
- agent id- Returns:
- true if a new agent is allowed, otherise false
-
allowNewElasticAgents
public boolean allowNewElasticAgents(int numOfAgentsToCreate)
Description copied from interface:AgentManager
Allow a specified number of elastic agents to register and come online? Based on licensing restrictions.- Specified by:
allowNewElasticAgents
in interfaceAgentManager
- Returns:
- true if a specified number agents is allowed, otherise false
-
allowNewLocalAgent
public boolean allowNewLocalAgent()
Description copied from interface:AgentManager
Allow a local agent to come online? Based on licensing restrictions.- Specified by:
allowNewLocalAgent
in interfaceAgentManager
- Returns:
- true if a new local agent is allowed, otherwise false
-
updateAgentStatusIfResultReturnPossibleAfterServerRestart
public boolean updateAgentStatusIfResultReturnPossibleAfterServerRestart(long agentId, ResultKey resultKey, String displayName, long deploymentResultId)
Description copied from interface:AgentManager
Checks if agent is capable of 'surviving' a server restart, i.e. if agent exists and is configured to reconnect after server restart, allowing it to return build result produced while the server was down. Sets agent status to 'building' if it is so.- Specified by:
updateAgentStatusIfResultReturnPossibleAfterServerRestart
in interfaceAgentManager
- Returns:
- true iff agents is capable of surviving a server restart.
-
setAgentEnabled
public Optional<BuildAgent> setAgentEnabled(long agentId, boolean enable)
- Specified by:
setAgentEnabled
in interfaceAgentManager
-
-