Class SecuredBuildAgent
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.auth.SecuredBuildAgent
-
- All Implemented Interfaces:
Comparable<BuildAgent>
,BuildAgent
,Loggable
,AgentBuildHistory
,AgentDescription
,BuildAgentEx
,BuildAgentInit
,SBuildAgent
public class SecuredBuildAgent extends Object implements BuildAgentEx
- Author:
- Pavel.Sher Date: 30.01.2008
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.BuildAgent
DEFAULT_POOL_ID, DEFAULT_POOL_NAME
-
-
Constructor Summary
Constructors Constructor Description SecuredBuildAgent(BuildAgentEx delegate, SecurityContextEx securityContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildStartedOnAgent(SRunningBuild build)
Called when a new build is started on this agentboolean
canStartBuildIfAgentOutdated()
void
clearSpecialState(BuildAgentSpecialState specialState)
Clears special state if set to the given valueint
compareTo(BuildAgent o)
String
describe(boolean verbose)
void
generateUniqueAgentAuthorizationToken()
Generates new agent authorization token for this agent.AgentPool
getAgentPool()
int
getAgentPoolId()
Returns the pool id the agent belongs to.Date
getAgentStatusRestoringTimestamp()
Returns null if agent status will not be restored, otherwise returns status restoring timestampBoolean
getAgentStatusToRestore()
Returns null if agent status will not be restored, otherwise returns status to restoreSAgentType
getAgentType()
int
getAgentTypeId()
Returns id of this agent type.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 textMap<String,String>
getAvailableParameters()
Returns map of parameters available on the agent.String
getAvailableParameterValue(String parameterName)
Returns value of a single available parameter.Set<String>
getAvailableRunTypeIds()
Returns set of runner types available on the agentList<RunType>
getAvailableRunTypes()
Returns list of runners available on the agentList<String>
getAvailableVcsPlugins()
List<SBuildType>
getBuildConfigurationsBuilt()
Returns build configurations ever built on this agent.List<SFinishedBuild>
getBuildHistory(User user, boolean includeCanceled)
Returns the build history of this agent.Map<String,String>
getBuildParameters()
Returns map of build parameters that will be added to the build parameters when build is started on the agent.String
getCommunicationProtocolDescription()
Returns short description of the protocol that is used to communicate with this agent.String
getCommunicationProtocolType()
Returns type (identifier) of the protocol that is used to communicate with this agent.Map<String,String>
getConfigurationParameters()
Returns map of configuration parameters that are defined on the build agent.RemoteAgentConnection
getConnection()
int
getCpuBenchmarkIndex()
Returns this agent CPU benchmark index.int
getCpuCount()
Returns the number of CPUs of this agentString
getCurrentAgentPluginsSignature()
String
getCurrentAgentVersion()
Map<String,String>
getDefinedParameters()
Returns map of parameters explicitly defined in the agent configuration file.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 runningString
getHostName()
Returns hostname of the computer where build agent is running.int
getId()
Returns this agent unique idlong
getIdleTime()
Date
getLastCommunicationTimestamp()
Returns timestamp of the last agent - server (or server - agent) successful communication.Date
getLastFinishedBuildDateOnAgent(Date finishTimeAfter)
Returns date of last finished build since given timeString
getName()
Returns name of the agentString
getOperatingSystemName()
Returns name of the operating system where the agent is currently running.String
getParameterValue(String paramName)
Returns value of a parameter with a given name.String
getPingCode()
String
getPluginsSignature()
Returns signature of plugins installed on the agent.int
getPort()
Port where agent is listening for server commands.Date
getRegistrationTimestamp()
Returns timestamp of this agent registration.<T> T
getRemoteInterface(Class<T> type)
Extension point allowing to call custom methods on agent remotely.SRunningBuild
getRunningBuild()
Returns the build which is currently running on the agent; null if no such build availableBuildAgentSpecialState
getSpecialState()
Returns current special stateComment
getStatusComment()
Returns information about changing agent enabled/disabled status, including timestamp, user, comment textString
getUnregistrationComment()
If agent is not registered returns reason of its' unregistration.String
getVersion()
Returns agent version.void
initAgentTypeId(int agentTypeId)
Initializes agent type id in agentvoid
initAuthorized(boolean authorized)
Initializes authorized status in agentvoid
initEnabled(boolean enabled)
Initializes enabled status in agentboolean
isAccessible()
Returns true if the agent is connected to the current node, otherwise returns false.boolean
isAuthorized()
Returns true if agent is authorized by administrator.boolean
isCaseInsensitiveEnvironment()
boolean
isCloudAgent()
boolean
isEnabled()
Returns true if agent is enabled.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 ofBuildAgentEx.isLocal(Action)
if the operation is fast, null otherwiseboolean
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
isRemoved()
boolean
isUpgrading()
Returns true if agent is upgradingvoid
markAsRemoved()
Marks the agent as removed.boolean
ping()
Try to ping agent over networksvoid
register()
Makes this agent registered.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.void
releaseSources(SBuildType buildType)
Releases sources of the specified build configuration on this agent.boolean
restoreAgent()
Restores this agent data from the database.AgentBuildResult
runBuild(AgentBuild agentBuild)
Send runBuild command to the Agent.void
setAgentDescription(AgentDescription description)
Updates agent description of agent.void
setAgentTypeId(int agentTypeId)
Set agent type id to the instance of the agent.void
setAuthorizationToken(String agentAuthorizationToken)
void
setAuthorized(boolean authorized, SUser user, String reason)
Changes this agent authorization status.void
setCommunicationTimestamp(Date timestamp)
Updates agent - server binding timestamp and persists it in database if current node is allowed to do thatvoid
setEnabled(boolean enabled, SUser user, String reason)
Changes this agent enabled status.void
setEnabled(boolean enabled, SUser user, String reason, long statusRestoringTimestamp)
Changes this agent enabled status and restores it in the specified time.void
setId(int id)
void
setName(String name)
Sets new name to the agent.void
setPingCode(String pingCode)
void
setUpgrading(boolean isUpgrading)
Changes agent upgrading status.boolean
stopBuild(SRunningBuild build)
Sends stop build command to agent.String
toString()
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
-
-
-
Constructor Detail
-
SecuredBuildAgent
public SecuredBuildAgent(@NotNull BuildAgentEx delegate, @NotNull SecurityContextEx securityContext)
-
-
Method Detail
-
setAgentDescription
public void setAgentDescription(@NotNull AgentDescription description)
Description copied from interface:BuildAgentEx
Updates agent description of agent.- Specified by:
setAgentDescription
in interfaceBuildAgentEx
-
getAuthorizationToken
@NotNull public String getAuthorizationToken()
Description copied from interface:SBuildAgent
Returns agent token which should be used to authorize build agent- Specified by:
getAuthorizationToken
in interfaceSBuildAgent
- Returns:
- agent token which should be used to authorize build agent
-
setAuthorizationToken
public void setAuthorizationToken(@NotNull String agentAuthorizationToken)
- Specified by:
setAuthorizationToken
in interfaceBuildAgentInit
-
getPingCode
@NotNull public String getPingCode()
- Specified by:
getPingCode
in interfaceBuildAgentEx
-
runBuild
public AgentBuildResult runBuild(@NotNull AgentBuild agentBuild)
Description copied from interface:BuildAgentEx
Send runBuild command to the Agent.- Specified by:
runBuild
in interfaceBuildAgentEx
-
upgrade
public boolean upgrade(Action<Boolean> callback)
Description copied from interface:BuildAgentEx
Sends upgrade command on agent- Specified by:
upgrade
in interfaceBuildAgentEx
- 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).
-
setEnabled
public void setEnabled(boolean enabled, @Nullable SUser user, @NotNull String reason)
Description copied from interface:SBuildAgent
Changes this agent enabled status.- Specified by:
setEnabled
in interfaceSBuildAgent
- Parameters:
enabled
- true if agent is enabled, and false otherwiseuser
- user who changes the status or nullreason
- reason why the status is changed
-
setEnabled
public void setEnabled(boolean enabled, @Nullable SUser user, @NotNull String reason, long statusRestoringTimestamp)
Description copied from interface:SBuildAgent
Changes this agent enabled status and restores it in the specified time.- Specified by:
setEnabled
in interfaceSBuildAgent
- 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
-
setAuthorized
public void setAuthorized(boolean authorized, @Nullable SUser user, @NotNull String reason) throws LicenseNotGrantedException
Description copied from interface:SBuildAgent
Changes this agent authorization status.- Specified by:
setAuthorized
in interfaceSBuildAgent
- 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
-
isLocal
public void isLocal(Action<Boolean> callback)
Description copied from interface:BuildAgentEx
Calls callback with true if this agent is local for sure (i.e. installed on the same machine as server).- Specified by:
isLocal
in interfaceBuildAgentEx
-
isLocalFast
@Nullable public Boolean isLocalFast()
Description copied from interface:BuildAgentEx
Returns the result ofBuildAgentEx.isLocal(Action)
if the operation is fast, null otherwise- Specified by:
isLocalFast
in interfaceBuildAgentEx
-
getAgentType
@NotNull public SAgentType getAgentType()
- Specified by:
getAgentType
in interfaceBuildAgentEx
-
releaseSources
public void releaseSources()
Description copied from interface:SBuildAgent
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.- Specified by:
releaseSources
in interfaceSBuildAgent
-
releaseSources
public void releaseSources(@NotNull SBuildType buildType)
Description copied from interface:SBuildAgent
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.- Specified by:
releaseSources
in interfaceSBuildAgent
- Parameters:
buildType
- build configuration
-
getBuildConfigurationsBuilt
@NotNull public List<SBuildType> getBuildConfigurationsBuilt()
Description copied from interface:SBuildAgent
Returns build configurations ever built on this agent.- Specified by:
getBuildConfigurationsBuilt
in interfaceSBuildAgent
- Returns:
- see above
-
getAgentStatusToRestore
@Nullable public Boolean getAgentStatusToRestore()
Description copied from interface:SBuildAgent
Returns null if agent status will not be restored, otherwise returns status to restore- Specified by:
getAgentStatusToRestore
in interfaceSBuildAgent
- Returns:
- null if agent status will not be restored, otherwise returns status to restore
-
getAgentStatusRestoringTimestamp
@Nullable public Date getAgentStatusRestoringTimestamp()
Description copied from interface:SBuildAgent
Returns null if agent status will not be restored, otherwise returns status restoring timestamp- Specified by:
getAgentStatusRestoringTimestamp
in interfaceSBuildAgent
- Returns:
- null if agent status will not be restored, otherwise returns status restoring timestamp
-
getBuildHistory
@NotNull public List<SFinishedBuild> getBuildHistory(@Nullable User user, boolean includeCanceled)
Description copied from interface:AgentBuildHistory
Returns the build history of this agent.The history can be filtered by user, as well as by cancelled builds.
- Specified by:
getBuildHistory
in interfaceAgentBuildHistory
- Parameters:
user
- if set the result will contain only builds byuser
includeCanceled
- if set the result will include canceled builds as well- Returns:
- build history
-
getIdleTime
public long getIdleTime()
- Specified by:
getIdleTime
in interfaceSBuildAgent
- 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.
-
getCpuBenchmarkIndex
public int getCpuBenchmarkIndex()
Description copied from interface:BuildAgent
Returns this agent CPU benchmark index. The higher this value the more powerful agent CPU.- Specified by:
getCpuBenchmarkIndex
in interfaceAgentDescription
- Specified by:
getCpuBenchmarkIndex
in interfaceBuildAgent
- Returns:
- CPU index or -1 if index is not available
-
getCpuCount
public int getCpuCount()
Description copied from interface:BuildAgent
Returns the number of CPUs of this agent- Specified by:
getCpuCount
in interfaceAgentDescription
- Specified by:
getCpuCount
in interfaceBuildAgent
- Returns:
- number of CPUs or -1 if count is not available
-
getAgentPoolId
public int getAgentPoolId()
Description copied from interface:BuildAgent
Returns the pool id the agent belongs to.
- Specified by:
getAgentPoolId
in interfaceBuildAgent
- Returns:
- agent pool id the agent belongs to
-
setUpgrading
public void setUpgrading(boolean isUpgrading)
Description copied from interface:BuildAgentEx
Changes agent upgrading status. Note that this method does not initiate upgrade. To initiate upgrade useBuildAgentEx.upgrade(Action)
method.- Specified by:
setUpgrading
in interfaceBuildAgentEx
- Parameters:
isUpgrading
- agent upgrade status
-
register
public void register()
Description copied from interface:BuildAgentEx
Makes this agent registered.- Specified by:
register
in interfaceBuildAgentEx
-
unregister
public void unregister(@NotNull String unregistrationReason)
Description copied from interface:BuildAgentEx
Makes this agent unregistered.- Specified by:
unregister
in interfaceBuildAgentEx
- Parameters:
unregistrationReason
- reason of the agent unregistration
-
setCommunicationTimestamp
public void setCommunicationTimestamp(Date timestamp)
Description copied from interface:BuildAgentEx
Updates agent - server binding timestamp and persists it in database if current node is allowed to do that- Specified by:
setCommunicationTimestamp
in interfaceBuildAgentEx
- Parameters:
timestamp
- timestamp
-
updateCommunicationTimestampInMemory
public void updateCommunicationTimestampInMemory(@NotNull Date timestamp)
Description copied from interface:BuildAgentEx
Updates agent - server binding timestamp in memory, does not persists it in database- Specified by:
updateCommunicationTimestampInMemory
in interfaceBuildAgentEx
-
getAgentTypeId
public int getAgentTypeId()
Description copied from interface:SBuildAgent
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.- Specified by:
getAgentTypeId
in interfaceSBuildAgent
- Returns:
- agent type id.
-
getVersion
@NotNull public String getVersion()
Description copied from interface:SBuildAgent
Returns agent version.- Specified by:
getVersion
in interfaceSBuildAgent
- Returns:
- agent version
-
getPluginsSignature
@NotNull public String getPluginsSignature()
Description copied from interface:SBuildAgent
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.- Specified by:
getPluginsSignature
in interfaceSBuildAgent
- Returns:
- signature of plugins installed on the agent.
-
isOutdated
public boolean isOutdated()
Description copied from interface:SBuildAgent
Returns true if version of this agent does not match version of the server.- Specified by:
isOutdated
in interfaceSBuildAgent
- Returns:
- see above
-
isPluginsOutdated
public boolean isPluginsOutdated()
Description copied from interface:SBuildAgent
Returns true if some of the agent plugins are outdated.- Specified by:
isPluginsOutdated
in interfaceSBuildAgent
- Returns:
- see above
-
getOperatingSystemName
@NotNull public String getOperatingSystemName()
Description copied from interface:AgentDescription
Returns name of the operating system where the agent is currently running.- Specified by:
getOperatingSystemName
in interfaceAgentDescription
- Returns:
- name of the operating system where the agent is currently running.
-
getAvailableParameters
@NotNull public Map<String,String> getAvailableParameters()
Description copied from interface:AgentDescription
Returns map of parameters available on the agent. These parameters include environment variables defined for the agent process as well as parameters defined in the agent configuration file.- Specified by:
getAvailableParameters
in interfaceAgentDescription
- Returns:
- see above
-
getAvailableParameterValue
@Nullable public String getAvailableParameterValue(@NotNull String parameterName)
Description copied from interface:AgentDescription
Returns value of a single available parameter. This is equivalent to {@link #getAvailableParameters().get(name)} but can work faster.- Specified by:
getAvailableParameterValue
in interfaceAgentDescription
- Parameters:
parameterName
- name of the parameter- Returns:
- see above
-
getDefinedParameters
@NotNull public Map<String,String> getDefinedParameters()
Description copied from interface:AgentDescription
Returns map of parameters explicitly defined in the agent configuration file.- Specified by:
getDefinedParameters
in interfaceAgentDescription
- Returns:
- see above
-
getBuildParameters
@NotNull public Map<String,String> getBuildParameters()
Description copied from interface:AgentDescription
Returns map of build parameters that will be added to the build parameters when build is started on the agent. Keys in the map have prefixesConstants.SYSTEM_PREFIX
orConstants.ENV_PREFIX
- Specified by:
getBuildParameters
in interfaceAgentDescription
- Returns:
- map of build parameters.
-
isCaseInsensitiveEnvironment
public boolean isCaseInsensitiveEnvironment()
- Specified by:
isCaseInsensitiveEnvironment
in interfaceAgentDescription
- Returns:
- true if names of environment variables are case insensitive
-
getConfigurationParameters
@NotNull public Map<String,String> getConfigurationParameters()
Description copied from interface:AgentDescription
Returns map of configuration parameters that are defined on the build agent. Those parameters may be defined in agent configuration files or may be provided by agent plugins.- Specified by:
getConfigurationParameters
in interfaceAgentDescription
- Returns:
- map of parameters
-
getAvailableRunTypes
@NotNull public List<RunType> getAvailableRunTypes()
Description copied from interface:AgentDescription
Returns list of runners available on the agent- Specified by:
getAvailableRunTypes
in interfaceAgentDescription
- Returns:
- list of runners ordered by display name
-
getAvailableRunTypeIds
@NotNull public Set<String> getAvailableRunTypeIds()
Description copied from interface:AgentDescription
Returns set of runner types available on the agent- Specified by:
getAvailableRunTypeIds
in interfaceAgentDescription
- Returns:
- set of runner types
-
getAvailableVcsPlugins
@NotNull public List<String> getAvailableVcsPlugins()
- Specified by:
getAvailableVcsPlugins
in interfaceAgentDescription
-
stopBuild
public boolean stopBuild(@NotNull SRunningBuild build)
Description copied from interface:BuildAgentEx
Sends stop build command to agent.- Specified by:
stopBuild
in interfaceBuildAgentEx
- Returns:
- true if build was stopped on agent and false otherwise
-
getRemoteInterface
public <T> T getRemoteInterface(@NotNull Class<T> type)
Description copied from interface:BuildAgentEx
Extension point allowing to call custom methods on agent remotely.- Specified by:
getRemoteInterface
in interfaceBuildAgentEx
- Parameters:
type
- should contain only simple methods - with simple parameters and return types (number and strings)
-
updateAgent
public void updateAgent()
Description copied from interface:BuildAgentEx
Assuming that some other node can change agent information in database, this method reloads agent fields from database.- Specified by:
updateAgent
in interfaceBuildAgentEx
-
setPingCode
public void setPingCode(String pingCode)
- Specified by:
setPingCode
in interfaceBuildAgentEx
-
isFakeAgent
public boolean isFakeAgent()
Description copied from interface:BuildAgentEx
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.- Specified by:
isFakeAgent
in interfaceBuildAgentEx
- Returns:
- true if this agent is a fake, not real agent.
-
trySetSpecialState
public boolean trySetSpecialState(BuildAgentSpecialState specialState)
Description copied from interface:BuildAgentEx
Tries atomically to set a certain special state on agent. This operation is thread-safe- Specified by:
trySetSpecialState
in interfaceBuildAgentEx
- Returns:
- boolean if successful, false otherwise
-
clearSpecialState
public void clearSpecialState(BuildAgentSpecialState specialState)
Description copied from interface:BuildAgentEx
Clears special state if set to the given value- Specified by:
clearSpecialState
in interfaceBuildAgentEx
-
getSpecialState
public BuildAgentSpecialState getSpecialState()
Description copied from interface:BuildAgentEx
Returns current special state- Specified by:
getSpecialState
in interfaceBuildAgentEx
- Returns:
- see above
-
getCurrentAgentVersion
@NotNull public String getCurrentAgentVersion()
- Specified by:
getCurrentAgentVersion
in interfaceBuildAgentEx
- Returns:
- current agent version, i.e. version which corresponds to a fully updated agent
-
getCurrentAgentPluginsSignature
@NotNull public String getCurrentAgentPluginsSignature()
- Specified by:
getCurrentAgentPluginsSignature
in interfaceBuildAgentEx
- Returns:
- current plugins signature, i.e. a signature which corresponds to a fully updated agent
-
getAgentPool
@NotNull public AgentPool getAgentPool()
- Specified by:
getAgentPool
in interfaceSBuildAgent
- Returns:
- agent pool agent belongs to
-
isCloudAgent
public boolean isCloudAgent()
- Specified by:
isCloudAgent
in interfaceSBuildAgent
- Returns:
- true if this agent is started by TeamCity cloud integration
-
canStartBuildIfAgentOutdated
public boolean canStartBuildIfAgentOutdated()
- Specified by:
canStartBuildIfAgentOutdated
in interfaceSBuildAgent
- Returns:
- true if agent can start builds even if the agent is outdated
-
getCommunicationProtocolDescription
@NotNull public String getCommunicationProtocolDescription()
Description copied from interface:SBuildAgent
Returns short description of the protocol that is used to communicate with this agent.
Examples: "unidirectional", "local".- Specified by:
getCommunicationProtocolDescription
in interfaceSBuildAgent
-
getCommunicationProtocolType
@NotNull public String getCommunicationProtocolType()
Description copied from interface:SBuildAgent
Returns type (identifier) of the protocol that is used to communicate with this agent. Opposite toSBuildAgent.getCommunicationProtocolDescription()
this type is constant and will not change for the particular protocol in future.- Specified by:
getCommunicationProtocolType
in interfaceSBuildAgent
-
getRunningBuild
@Nullable public SRunningBuild getRunningBuild()
Description copied from interface:SBuildAgent
Returns the build which is currently running on the agent; null if no such build available- Specified by:
getRunningBuild
in interfaceSBuildAgent
- Returns:
- the build which is currently running on the agent; null if no such build available
-
getHostName
public String getHostName()
Description copied from interface:SBuildAgent
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.- Specified by:
getHostName
in interfaceSBuildAgent
- Returns:
- Returns hostname of the computer where build agent is running
-
getHostAddress
public String getHostAddress()
Description copied from interface:SBuildAgent
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- Specified by:
getHostAddress
in interfaceSBuildAgent
- Returns:
- see above
-
getPort
public int getPort()
Description copied from interface:SBuildAgent
Port where agent is listening for server commands.- Specified by:
getPort
in interfaceSBuildAgent
- Returns:
- see above
-
ping
public boolean ping()
Description copied from interface:SBuildAgent
Try to ping agent over networks- Specified by:
ping
in interfaceSBuildAgent
- Returns:
- true if agent is reachable
-
getId
public int getId()
Description copied from interface:BuildAgent
Returns this agent unique id- Specified by:
getId
in interfaceBuildAgent
- Returns:
- agent unique id
-
getName
public String getName()
Description copied from interface:BuildAgent
Returns name of the agent- Specified by:
getName
in interfaceBuildAgent
- Returns:
- name of the agent
-
setName
public void setName(@NotNull String name)
Description copied from interface:BuildAgentInit
Sets new name to the agent.- Specified by:
setName
in interfaceBuildAgentInit
- Parameters:
name
- new name for an agent
-
setAgentTypeId
public void setAgentTypeId(int agentTypeId)
Description copied from interface:BuildAgentInit
Set agent type id to the instance of the agent.- Specified by:
setAgentTypeId
in interfaceBuildAgentInit
- Parameters:
agentTypeId
- new type id.
-
initEnabled
public void initEnabled(boolean enabled)
Description copied from interface:BuildAgentInit
Initializes enabled status in agent- Specified by:
initEnabled
in interfaceBuildAgentInit
- Parameters:
enabled
- true if agent is enabled
-
initAuthorized
public void initAuthorized(boolean authorized)
Description copied from interface:BuildAgentInit
Initializes authorized status in agent- Specified by:
initAuthorized
in interfaceBuildAgentInit
-
initAgentTypeId
public void initAgentTypeId(int agentTypeId)
Description copied from interface:BuildAgentInit
Initializes agent type id in agent- Specified by:
initAgentTypeId
in interfaceBuildAgentInit
-
isUpgrading
public boolean isUpgrading()
Description copied from interface:BuildAgent
Returns true if agent is upgrading- Specified by:
isUpgrading
in interfaceBuildAgent
- Returns:
- true if agent is upgrading
-
isEnabled
public boolean isEnabled()
Description copied from interface:SBuildAgent
Returns true if agent is enabled.- Specified by:
isEnabled
in interfaceBuildAgent
- Specified by:
isEnabled
in interfaceSBuildAgent
- Returns:
- see above
- See Also:
for additional information about agent status change
-
isAuthorized
public boolean isAuthorized()
Description copied from interface:SBuildAgent
Returns true if agent is authorized by administrator.- Specified by:
isAuthorized
in interfaceSBuildAgent
- Returns:
- see above
- See Also:
for additional information about agent status change
-
getStatusComment
@NotNull public Comment getStatusComment()
Description copied from interface:SBuildAgent
Returns information about changing agent enabled/disabled status, including timestamp, user, comment text- Specified by:
getStatusComment
in interfaceSBuildAgent
- Returns:
- see above
- See Also:
Comment
,SBuildAgent.isEnabled()
-
getAuthorizeComment
@NotNull public Comment getAuthorizeComment()
Description copied from interface:SBuildAgent
Returns information about changing agent authorized status, including timestamp, user, comment text- Specified by:
getAuthorizeComment
in interfaceSBuildAgent
- Returns:
- see above
- See Also:
Comment
,SBuildAgent.isAuthorized()
-
isRegistered
public boolean isRegistered()
Description copied from interface:SBuildAgent
Returns true or false depending on whether this agent is currently registered on server or not.- Specified by:
isRegistered
in interfaceSBuildAgent
- Returns:
- see above
-
getUnregistrationComment
@Nullable public String getUnregistrationComment()
Description copied from interface:SBuildAgent
If agent is not registered returns reason of its' unregistration.- Specified by:
getUnregistrationComment
in interfaceSBuildAgent
- Returns:
- agent is not registered returns reason of its' unregistration.
-
getRegistrationTimestamp
@NotNull public Date getRegistrationTimestamp()
Description copied from interface:SBuildAgent
Returns timestamp of this agent registration. If agent is not registered the returned timestamp is timestamp of last agent registration.- Specified by:
getRegistrationTimestamp
in interfaceSBuildAgent
- Returns:
- see above
-
getLastCommunicationTimestamp
public Date getLastCommunicationTimestamp()
Description copied from interface:SBuildAgent
Returns timestamp of the last agent - server (or server - agent) successful communication.- Specified by:
getLastCommunicationTimestamp
in interfaceSBuildAgent
- Returns:
- see above
-
restoreAgent
public boolean restoreAgent()
Description copied from interface:BuildAgentInit
Restores this agent data from the database.- Specified by:
restoreAgent
in interfaceBuildAgentInit
- Returns:
- true if agent was in the database and its status was restored and false if this agent is new
-
setId
public void setId(int id)
- Specified by:
setId
in interfaceBuildAgentInit
-
compareTo
public int compareTo(BuildAgent o)
- Specified by:
compareTo
in interfaceComparable<BuildAgent>
-
generateUniqueAgentAuthorizationToken
public void generateUniqueAgentAuthorizationToken()
Description copied from interface:BuildAgentInit
Generates new agent authorization token for this agent. It is guaranteed that the new authorization token is unique among the all agents in the database.- Specified by:
generateUniqueAgentAuthorizationToken
in interfaceBuildAgentInit
-
describe
@NotNull public String describe(boolean verbose)
- Specified by:
describe
in interfaceLoggable
- Specified by:
describe
in interfaceSBuildAgent
- Parameters:
verbose
- verbosity of object description- Returns:
- description of this object. If verbose is true, description should have mode details.
-
isAccessible
public boolean isAccessible()
Description copied from interface:BuildAgentEx
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.- Specified by:
isAccessible
in interfaceBuildAgentEx
-
buildStartedOnAgent
public void buildStartedOnAgent(@NotNull SRunningBuild build)
Description copied from interface:BuildAgentEx
Called when a new build is started on this agent- Specified by:
buildStartedOnAgent
in interfaceBuildAgentEx
-
getLastFinishedBuildDateOnAgent
@Nullable public Date getLastFinishedBuildDateOnAgent(Date finishTimeAfter)
Description copied from interface:BuildAgentEx
Returns date of last finished build since given time- Specified by:
getLastFinishedBuildDateOnAgent
in interfaceBuildAgentEx
- Parameters:
finishTimeAfter
- finish time lower bound- Returns:
-
isRemoved
public boolean isRemoved()
- Specified by:
isRemoved
in interfaceBuildAgentEx
- Returns:
- true if this agent is removed
-
markAsRemoved
public void markAsRemoved()
Description copied from interface:BuildAgentEx
Marks the agent as removed.- Specified by:
markAsRemoved
in interfaceBuildAgentEx
-
getConnection
@NotNull public RemoteAgentConnection getConnection()
- Specified by:
getConnection
in interfaceBuildAgentEx
-
getParameterValue
public String getParameterValue(@NotNull String paramName)
Description copied from interface:BuildAgentEx
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.- Specified by:
getParameterValue
in interfaceBuildAgentEx
- Parameters:
paramName
- parameter name- Returns:
- see above
-
-