Package jetbrains.buildServer.serverSide
Interface SBuildAgent
-
- All Superinterfaces:
AgentBuildHistory
,AgentDescription
,BuildAgent
,java.lang.Comparable<BuildAgent>
,jetbrains.buildServer.log.Loggable
public interface SBuildAgent extends BuildAgent, AgentDescription, java.lang.Comparable<BuildAgent>, AgentBuildHistory, jetbrains.buildServer.log.Loggable
Represents agent on the server side.
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.BuildAgent
DEFAULT_POOL_ID, DEFAULT_POOL_NAME
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canStartBuildIfAgentOutdated()
java.lang.String
describe(boolean verbose)
AgentPool
getAgentPool()
java.util.Date
getAgentStatusRestoringTimestamp()
Returns null if agent status will not be restored, otherwise returns status restoring timestampjava.lang.Boolean
getAgentStatusToRestore()
Returns null if agent status will not be restored, otherwise returns status to restoreint
getAgentTypeId()
Returns id of this agent type.java.lang.String
getAuthorizationToken()
Returns agent token which should be used to authorize build agentComment
getAuthorizeComment()
Returns information about changing agent authorized status, including timestamp, user, comment textjava.util.List<SBuildType>
getBuildConfigurationsBuilt()
Returns build configurations ever built on this agent.java.lang.String
getCommunicationProtocolDescription()
Returns short description of the protocol that is used to communicate with this agent.java.lang.String
getCommunicationProtocolType()
Returns type (identifier) of the protocol that is used to communicate with this agent.java.lang.String
getHostAddress()
Returns IP address or fully qualified domain name (depending on the ownAddress property in the buildAgent.properties) of the computer where build agent is runningjava.lang.String
getHostName()
Returns hostname of the computer where build agent is running.long
getIdleTime()
java.util.Date
getLastCommunicationTimestamp()
Returns timestamp of the last agent - server (or server - agent) successful communication.java.lang.String
getPluginsSignature()
Returns signature of plugins installed on the agent.int
getPort()
Port where agent is listening for server commands.java.util.Date
getRegistrationTimestamp()
Returns timestamp of this agent registration.SRunningBuild
getRunningBuild()
Returns the build which is currently running on the agent; null if no such build availableComment
getStatusComment()
Returns information about changing agent enabled/disabled status, including timestamp, user, comment textjava.lang.String
getUnregistrationComment()
If agent is not registered returns reason of its' unregistration.java.lang.String
getVersion()
Returns agent version.boolean
isAuthorized()
Returns true if agent is authorized by administrator.boolean
isCloudAgent()
boolean
isEnabled()
Returns true if agent is enabled.boolean
isOutdated()
Returns true if version of this agent does not match version of the server.boolean
isPluginsOutdated()
Returns true if some of the agent plugins are outdated.boolean
isRegistered()
Returns true or false depending on whether this agent is currently registered on server or not.boolean
ping()
Try to ping agent over networksvoid
releaseSources()
Releases sources of all of the build configurations ever built on this agent, after that a full checkout will be performed for all of these configurations on this agent.void
releaseSources(SBuildType buildType)
Releases sources of the specified build configuration on this agent.void
setAuthorized(boolean authorized, SUser user, java.lang.String reason)
Changes this agent authorization status.void
setEnabled(boolean enabled, SUser user, java.lang.String reason)
Changes this agent enabled status.void
setEnabled(boolean enabled, SUser user, java.lang.String reason, long statusRestoringTimestamp)
Changes this agent enabled status and restores it in the specified time.-
Methods inherited from interface jetbrains.buildServer.serverSide.AgentBuildHistory
getBuildHistory
-
Methods inherited from interface jetbrains.buildServer.serverSide.AgentDescription
getAvailableParameters, getAvailableRunTypeIds, getAvailableRunTypes, getAvailableVcsPlugins, getBuildParameters, getConfigurationParameters, getCpuBenchmarkIndex, getCpuCount, getDefinedParameters, getOperatingSystemName, isCaseInsensitiveEnvironment
-
Methods inherited from interface jetbrains.buildServer.BuildAgent
getAgentPoolId, getCpuBenchmarkIndex, getCpuCount, getId, getName, isUpgrading
-
-
-
-
Method Detail
-
getAgentTypeId
int getAgentTypeId()
Returns id of this agent type. All non cloud agents have own agent type. Cloud agents can share the same agent type. For cloud agents, agent type is the same as image.- Returns:
- agent type id.
- Since:
- 5.1
-
getVersion
@NotNull java.lang.String getVersion()
Returns agent version.- Returns:
- agent version
-
getPluginsSignature
@NotNull java.lang.String getPluginsSignature()
Returns signature of plugins installed on the agent. The agent version and plugins signature are used to determine whether upgrade of this agent is required or not.- Returns:
- signature of plugins installed on the agent.
-
isOutdated
boolean isOutdated()
Returns true if version of this agent does not match version of the server.- Returns:
- see above
-
isPluginsOutdated
boolean isPluginsOutdated()
Returns true if some of the agent plugins are outdated.- Returns:
- see above
-
getRunningBuild
@Nullable SRunningBuild getRunningBuild()
Returns the build which is currently running on the agent; null if no such build available- Returns:
- the build which is currently running on the agent; null if no such build available
-
getAuthorizationToken
@NotNull java.lang.String getAuthorizationToken()
Returns agent token which should be used to authorize build agent- Returns:
- agent token which should be used to authorize build agent
-
getHostName
java.lang.String getHostName()
Returns hostname of the computer where build agent is running. If server is unable to resolve agent address to host name the address is returned.- Returns:
- Returns hostname of the computer where build agent is running
-
getHostAddress
java.lang.String getHostAddress()
Returns IP address or fully qualified domain name (depending on the ownAddress property in the buildAgent.properties) of the computer where build agent is running- Returns:
- see above
-
getPort
int getPort()
Port where agent is listening for server commands.- Returns:
- see above
-
getCommunicationProtocolDescription
@NotNull java.lang.String getCommunicationProtocolDescription()
Returns short description of the protocol that is used to communicate with this agent.
Examples: "unidirectional", "local".- Since:
- 9.1
-
getCommunicationProtocolType
@NotNull java.lang.String getCommunicationProtocolType()
Returns type (identifier) of the protocol that is used to communicate with this agent. Opposite togetCommunicationProtocolDescription()
this type is constant and will not change for the particular protocol in future.- Since:
- 9.1.2
-
ping
boolean ping()
Try to ping agent over networks- Returns:
- true if agent is reachable
-
isEnabled
boolean isEnabled()
Returns true if agent is enabled.- Specified by:
isEnabled
in interfaceBuildAgent
- Returns:
- see above
- See Also:
for additional information about agent status change
-
isAuthorized
boolean isAuthorized()
Returns true if agent is authorized by administrator.- Returns:
- see above
- See Also:
for additional information about agent status change
-
getStatusComment
@NotNull Comment getStatusComment()
Returns information about changing agent enabled/disabled status, including timestamp, user, comment text- Returns:
- see above
- See Also:
Comment
,isEnabled()
-
getAuthorizeComment
@NotNull Comment getAuthorizeComment()
Returns information about changing agent authorized status, including timestamp, user, comment text- Returns:
- see above
- See Also:
Comment
,isAuthorized()
-
isRegistered
boolean isRegistered()
Returns true or false depending on whether this agent is currently registered on server or not.- Returns:
- see above
-
getUnregistrationComment
@Nullable java.lang.String getUnregistrationComment()
If agent is not registered returns reason of its' unregistration.- Returns:
- agent is not registered returns reason of its' unregistration.
-
getRegistrationTimestamp
@NotNull java.util.Date getRegistrationTimestamp()
Returns timestamp of this agent registration. If agent is not registered the returned timestamp is timestamp of last agent registration.- Returns:
- see above
-
getLastCommunicationTimestamp
java.util.Date getLastCommunicationTimestamp()
Returns timestamp of the last agent - server (or server - agent) successful communication.- Returns:
- see above
-
setEnabled
void setEnabled(boolean enabled, @Nullable SUser user, @NotNull java.lang.String reason)
Changes this agent enabled status.- Parameters:
enabled
- true if agent is enabled, and false otherwiseuser
- user who changes the status or nullreason
- reason why the status is changed
-
setEnabled
void setEnabled(boolean enabled, @Nullable SUser user, @NotNull java.lang.String reason, long statusRestoringTimestamp)
Changes this agent enabled status and restores it in the specified time.- Parameters:
enabled
- true if agent is enabled, and false otherwiseuser
- user who changes the status or nullreason
- reason why the status is changedstatusRestoringTimestamp
- timestamp at which agent status will be restored- Since:
- 4.0.2
-
setAuthorized
void setAuthorized(boolean authorized, @Nullable SUser user, @NotNull java.lang.String reason) throws LicenseNotGrantedException
Changes this agent authorization status.- Parameters:
authorized
- true if agent should become authorized and false otherwiseuser
- user who changes the status or nullreason
- reason why the status changed- Throws:
LicenseNotGrantedException
- if agent cannot be authorized because there is not enough license tokens
-
releaseSources
void releaseSources()
Releases sources of all of the build configurations ever built on this agent, after that a full checkout will be performed for all of these configurations on this agent.
-
releaseSources
void releaseSources(@NotNull SBuildType buildType)
Releases sources of the specified build configuration on this agent. A full checkout will be performed when a build of this build configuration is started on this agent.- Parameters:
buildType
- build configuration
-
getBuildConfigurationsBuilt
@NotNull java.util.List<SBuildType> getBuildConfigurationsBuilt()
Returns build configurations ever built on this agent.- Returns:
- see above
-
getAgentStatusToRestore
@Nullable java.lang.Boolean getAgentStatusToRestore()
Returns null if agent status will not be restored, otherwise returns status to restore- Returns:
- null if agent status will not be restored, otherwise returns status to restore
-
getAgentStatusRestoringTimestamp
@Nullable java.util.Date getAgentStatusRestoringTimestamp()
Returns null if agent status will not be restored, otherwise returns status restoring timestamp- Returns:
- null if agent status will not be restored, otherwise returns status restoring timestamp
-
getIdleTime
long getIdleTime()
- Returns:
- number of milliseconds build agent was idle. If there was no build started time since registration is returned. If agent is running a build, 0 is returned.
-
describe
@NotNull java.lang.String describe(boolean verbose)
- Specified by:
describe
in interfacejetbrains.buildServer.log.Loggable
- Parameters:
verbose
- verbosity of object description- Returns:
- description of this object. If verbose is true, description should have mode details.
- Since:
- 8.0.2
-
getAgentPool
@NotNull AgentPool getAgentPool()
- Returns:
- agent pool agent belongs to
-
isCloudAgent
boolean isCloudAgent()
- Returns:
- true if this agent is started by TeamCity cloud integration
- Since:
- 2017.2
-
canStartBuildIfAgentOutdated
boolean canStartBuildIfAgentOutdated()
- Returns:
- true if agent can start builds even if the agent is outdated
- Since:
- 2020.1
-
-