Package jetbrains.buildServer.serverSide
Interface BuildAgentEx
-
- All Superinterfaces:
AgentBuildHistory
,AgentDescription
,BuildAgent
,BuildAgentInit
,Comparable<BuildAgent>
,Loggable
,SBuildAgent
- All Known Implementing Classes:
AbstractBuildAgent
,AbstractBuildAgentContext
,DeadAgent
,MockBuildAgent
,RegisteredAgent
,SecuredBuildAgent
,UnregisteredAgent
public interface BuildAgentEx extends SBuildAgent, BuildAgentInit
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.BuildAgent
DEFAULT_POOL_ID, DEFAULT_POOL_NAME
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
buildStartedOnAgent(SRunningBuild build)
Called when a new build is started on this agentvoid
clearSpecialState(BuildAgentSpecialState specialState)
Clears special state if set to the given valueSAgentType
getAgentType()
RemoteAgentConnection
getConnection()
String
getCurrentAgentPluginsSignature()
String
getCurrentAgentVersion()
Date
getLastFinishedBuildDateOnAgent(Date finishTimeAfter)
Returns date of last finished build since given timeString
getParameterValue(String paramName)
Returns value of a parameter with a given name.String
getPingCode()
<T> T
getRemoteInterface(Class<T> type)
Extension point allowing to call custom methods on agent remotely.BuildAgentSpecialState
getSpecialState()
Returns current special statedefault boolean
isAccessible()
Returns true if the agent is connected to the current node, otherwise returns false.boolean
isFakeAgent()
Usually running builds have some agent, but sometimes this is not the case (composite build).void
isLocal(Action<Boolean> callback)
Calls callback with true if this agent is local for sure (i.e.Boolean
isLocalFast()
Returns the result ofisLocal(Action)
if the operation is fast, null otherwiseboolean
isRemoved()
void
markAsRemoved()
Marks the agent as removed.void
register()
Makes this agent registered.AgentBuildResult
runBuild(AgentBuild agentBuild)
Send runBuild command to the Agent.void
setAgentDescription(AgentDescription description)
Updates agent description of agent.void
setCommunicationTimestamp(Date timestamp)
Updates agent - server binding timestamp and persists it in database if current node is allowed to do thatvoid
setPingCode(String pingCode)
void
setUpgrading(boolean isUpgrading)
Changes agent upgrading status.boolean
stopBuild(SRunningBuild build)
Sends stop build command to agent.default boolean
trySetSpecialState(BuildAgentSpecialState specialState)
Tries atomically to set a certain special state on agent.void
unregister(String unregistrationReason)
Makes this agent unregistered.void
updateAgent()
Assuming that some other node can change agent information in database, this method reloads agent fields from database.void
updateCommunicationTimestampInMemory(Date timestamp)
Updates agent - server binding timestamp in memory, does not persists it in databaseboolean
upgrade(Action<Boolean> callback)
Sends upgrade command on agent-
Methods inherited from interface jetbrains.buildServer.serverSide.AgentBuildHistory
getBuildHistory
-
Methods inherited from interface jetbrains.buildServer.serverSide.AgentDescription
getAvailableParameters, getAvailableParameterValue, getAvailableRunTypeIds, getAvailableRunTypes, getAvailableVcsPlugins, getBuildParameters, getConfigurationParameters, getCpuBenchmarkIndex, getCpuCount, getDefinedParameters, getOperatingSystemName, isCaseInsensitiveEnvironment
-
Methods inherited from interface jetbrains.buildServer.BuildAgent
getAgentPoolId, getCpuBenchmarkIndex, getCpuCount, getId, getName, isUpgrading
-
Methods inherited from interface jetbrains.buildServer.serverSide.BuildAgentInit
generateUniqueAgentAuthorizationToken, initAgentTypeId, initAuthorized, initEnabled, restoreAgent, setAgentTypeId, setAuthorizationToken, setId, setName
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface jetbrains.buildServer.serverSide.SBuildAgent
canStartBuildIfAgentOutdated, describe, getAgentPool, getAgentStatusRestoringTimestamp, getAgentStatusToRestore, getAgentTypeId, getAuthorizationToken, getAuthorizeComment, getBuildConfigurationsBuilt, getCommunicationProtocolDescription, getCommunicationProtocolType, getHostAddress, getHostName, getIdleTime, getLastCommunicationTimestamp, getPluginsSignature, getPort, getRegistrationTimestamp, getRunningBuild, getStatusComment, getUnregistrationComment, getVersion, isAuthorized, isCloudAgent, isEnabled, isOutdated, isPluginsOutdated, isRegistered, ping, releaseSources, releaseSources, setAuthorized, setEnabled, setEnabled
-
-
-
-
Method Detail
-
isLocal
void isLocal(Action<Boolean> callback)
Calls callback with true if this agent is local for sure (i.e. installed on the same machine as server).
-
isLocalFast
@Nullable Boolean isLocalFast()
Returns the result ofisLocal(Action)
if the operation is fast, null otherwise
-
getAgentType
@NotNull SAgentType getAgentType()
-
runBuild
AgentBuildResult runBuild(@NotNull AgentBuild agentBuild)
Send runBuild command to the Agent.- Throws:
AlreadyRunningBuildException
- if the agent says that it runs some other build.ShutdownInProgressException
- if the agent says that it is in the shutdown process.AgentTimeoutException
- if the agent didn't get this command because of timeoutTeamCityRuntimeException
- if the agent report some other error.
-
upgrade
boolean upgrade(Action<Boolean> callback)
Sends upgrade command on agent- Parameters:
callback
- will be called with true if upgrade was accepted by agent.- Returns:
- true if upgrade is scheduled, false otherwise (for example if previous Upgrade call is still in progress).
-
setUpgrading
void setUpgrading(boolean isUpgrading)
Changes agent upgrading status. Note that this method does not initiate upgrade. To initiate upgrade useupgrade(Action)
method.- Parameters:
isUpgrading
- agent upgrade status
-
getPingCode
@NotNull String getPingCode()
-
register
void register()
Makes this agent registered.
-
unregister
void unregister(@NotNull String unregistrationReason)
Makes this agent unregistered.- Parameters:
unregistrationReason
- reason of the agent unregistration
-
setCommunicationTimestamp
void setCommunicationTimestamp(Date timestamp)
Updates agent - server binding timestamp and persists it in database if current node is allowed to do that- Parameters:
timestamp
- timestamp
-
updateCommunicationTimestampInMemory
void updateCommunicationTimestampInMemory(@NotNull Date timestamp)
Updates agent - server binding timestamp in memory, does not persists it in database- Parameters:
timestamp
-
-
setAgentDescription
void setAgentDescription(@NotNull AgentDescription description)
Updates agent description of agent.- Parameters:
description
-
-
stopBuild
boolean stopBuild(@NotNull SRunningBuild build)
Sends stop build command to agent.- Returns:
- true if build was stopped on agent and false otherwise
-
getRemoteInterface
<T> T getRemoteInterface(@NotNull Class<T> type)
Extension point allowing to call custom methods on agent remotely.- Parameters:
type
- should contain only simple methods - with simple parameters and return types (number and strings)
-
updateAgent
void updateAgent()
Assuming that some other node can change agent information in database, this method reloads agent fields from database.- Since:
- 2018.1
-
setPingCode
void setPingCode(String pingCode)
-
isFakeAgent
boolean isFakeAgent()
Usually running builds have some agent, but sometimes this is not the case (composite build). To avoid returning null in such cases and make other code work properly a fake agent is created.- Returns:
- true if this agent is a fake, not real agent.
- Since:
- 2017.2
-
trySetSpecialState
default boolean trySetSpecialState(BuildAgentSpecialState specialState)
Tries atomically to set a certain special state on agent. This operation is thread-safe- Parameters:
specialState
-- Returns:
- boolean if successful, false otherwise
- Since:
- 2017.2.2
-
clearSpecialState
void clearSpecialState(BuildAgentSpecialState specialState)
Clears special state if set to the given value- Parameters:
specialState
-- Since:
- 2017.2.2
-
getSpecialState
@Nullable BuildAgentSpecialState getSpecialState()
Returns current special state- Returns:
- see above
- Since:
- 2017.2.1
-
getCurrentAgentVersion
@NotNull String getCurrentAgentVersion()
- Returns:
- current agent version, i.e. version which corresponds to a fully updated agent
- Since:
- 2018.1
-
getCurrentAgentPluginsSignature
@NotNull String getCurrentAgentPluginsSignature()
- Returns:
- current plugins signature, i.e. a signature which corresponds to a fully updated agent
- Since:
- 2018.1
-
isAccessible
default boolean isAccessible()
Returns true if the agent is connected to the current node, otherwise returns false. For example on the read-only node always return false. The remote operations can be executed on the agent only if the method returns true.- Since:
- 2018.1
-
buildStartedOnAgent
void buildStartedOnAgent(@NotNull SRunningBuild build)
Called when a new build is started on this agent- Parameters:
build
-- Since:
- 2018.2.2
-
getLastFinishedBuildDateOnAgent
@Nullable Date getLastFinishedBuildDateOnAgent(Date finishTimeAfter)
Returns date of last finished build since given time- Parameters:
finishTimeAfter
- finish time lower bound- Returns:
-
isRemoved
boolean isRemoved()
- Returns:
- true if this agent is removed
- Since:
- 2022.08
-
markAsRemoved
void markAsRemoved()
Marks the agent as removed.- Since:
- 2022.08
-
getConnection
@NotNull RemoteAgentConnection getConnection()
-
getParameterValue
String getParameterValue(@NotNull String paramName)
Returns value of a parameter with a given name. This method can access all agent parameters, including those which should not be exposed in the UI. The method can only be called by an authority with system admin like permission.- Parameters:
paramName
- parameter name- Returns:
- see above
-
-