Package jetbrains.buildServer.agent
Interface BuildAgentConfiguration
-
public interface BuildAgentConfiguration
Represents configuration of build agent (loaded from buildAgent.properties file)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
addAlternativeAgentAddress(java.lang.String address)
Adds alternative agent address that may be used by the server to communicate with agent.void
addConfigurationParameter(java.lang.String key, java.lang.String value)
Adds all-builds wide configuration parameter.void
addCustomProperty(java.lang.String name, java.lang.String value)
void
addEnvironmentVariable(java.lang.String key, java.lang.String value)
Adds all-builds wide environment variable.void
addSystemProperty(java.lang.String key, java.lang.String value)
Adds all-builds wide system property.java.io.File
getAgentHomeDirectory()
java.io.File
getAgentLibDirectory()
java.io.File
getAgentLogsDirectory()
Returns directory containing agent log filesjava.io.File
getAgentPluginsDirectory()
java.io.File
getAgentTempDirectory()
Deprecated.java.io.File
getAgentToolsDirectory()
Provides path to tools folder on build agent.java.io.File
getAgentUpdateDirectory()
java.lang.String
getAuthorizationToken()
Returns agent authorization token which should be used to authorize build agentBuildParametersMap
getBuildParameters()
Returns build parameters.java.io.File
getBuildTempDirectory()
Deprecated.java.io.File
getCacheDirectory(java.lang.String key)
Returns path to a folder under agent's system directory by a key.java.util.Map<java.lang.String,java.lang.String>
getConfigurationParameters()
Returns configuration parameters of this buildjava.util.Map<java.lang.String,java.lang.String>
getCustomProperties()
Deprecated.java.lang.String
getName()
Returns name of the agentdefault AgentOperationMode
getOperationMode()
Returns agent's current operation mode.java.lang.String
getOwnAddress()
Returns IP address where agent accepts commands from the serverint
getOwnPort()
Returns port where agent accepts commands from the serverValueResolver
getParametersResolver()
Creates value resolver for parameters resolution in strings.java.lang.String
getPingCode()
Returns the code to be returned from the ping methodint
getServerConnectionTimeout()
Returns connection timeout in seconds.java.lang.String
getServerUrl()
Returns server URLjava.io.File
getSystemDirectory()
Returns path to a folder containing all system caches.BuildAgentSystemInfo
getSystemInfo()
Returns agent jvm(system) informationjava.io.File
getTempDirectory()
Returns path to temp directory: parent folder of agent temp directory and build temp directory By default it returns INSTALL_DIR/temp, but that may be changes in buildAgent.properties file.java.io.File
getWorkDirectory()
Returns path to AGENT_INSTALL_DIR/work directoryboolean
removeConfigurationParameter(java.lang.String key)
Remove build agent configuration parameter added via @code(addConfigurationParameter) method.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns name of the agent- Returns:
- name of the agent
-
getOwnPort
int getOwnPort()
Returns port where agent accepts commands from the server- Returns:
- see above
-
getOwnAddress
java.lang.String getOwnAddress()
Returns IP address where agent accepts commands from the server- Returns:
- see above
-
getServerUrl
java.lang.String getServerUrl()
Returns server URL- Returns:
- server URL
-
getAuthorizationToken
@NotNull java.lang.String getAuthorizationToken()
Returns agent authorization token which should be used to authorize build agent- Returns:
- agent authorization token which should be used to authorize build agent
-
getPingCode
@NotNull java.lang.String getPingCode()
Returns the code to be returned from the ping method- Returns:
- see above
-
getWorkDirectory
@NotNull java.io.File getWorkDirectory()
Returns path to AGENT_INSTALL_DIR/work directory- Returns:
- see above
-
getBuildTempDirectory
@NotNull java.io.File getBuildTempDirectory()
Deprecated.Returns path to a folder undergetTempDirectory()
. This folder is cleaned before build is started.- Returns:
- see above
-
getAgentTempDirectory
@Deprecated @NotNull java.io.File getAgentTempDirectory()
Deprecated.Returns path to a folder undergetTempDirectory()
. This folder is cleaned before build is started.- Returns:
- file to agent's temp dir. All temp files of agent should be put under that folder
-
getAgentToolsDirectory
@NotNull java.io.File getAgentToolsDirectory()
Provides path to tools folder on build agent. Returned folder is an existing path on the disk.- Returns:
- path to agent tools folder
- Since:
- 6.5
-
getCacheDirectory
@NotNull java.io.File getCacheDirectory(@NotNull java.lang.String key)
Returns path to a folder under agent's system directory by a key. It is guaranteed the folder exists. Use this folder to store some persistent data on the agent. Note: No cleaning is performed by the agent!- Parameters:
key
- plugin unique key- Returns:
- path to a directory
- Since:
- 5.0
-
getSystemDirectory
@NotNull java.io.File getSystemDirectory()
Returns path to a folder containing all system caches.- Returns:
- see above
- Since:
- 8.1.1
-
getTempDirectory
@NotNull java.io.File getTempDirectory()
Returns path to temp directory: parent folder of agent temp directory and build temp directory By default it returns INSTALL_DIR/temp, but that may be changes in buildAgent.properties file.- Returns:
- see above
-
getAgentLibDirectory
@NotNull java.io.File getAgentLibDirectory()
- Returns:
- returns path to agent's lib dir
-
getAgentPluginsDirectory
@NotNull java.io.File getAgentPluginsDirectory()
- Returns:
- path to agent's plugins dir
-
getAgentUpdateDirectory
@NotNull java.io.File getAgentUpdateDirectory()
- Returns:
- path to agent's update dir
-
getAgentHomeDirectory
@NotNull java.io.File getAgentHomeDirectory()
- Returns:
- path to agent home
-
getAgentLogsDirectory
@NotNull java.io.File getAgentLogsDirectory()
Returns directory containing agent log files- Returns:
- directory containing agent log files
-
getSystemInfo
@NotNull BuildAgentSystemInfo getSystemInfo()
Returns agent jvm(system) information- Returns:
- agent jvm(system) information
-
getServerConnectionTimeout
int getServerConnectionTimeout()
Returns connection timeout in seconds. This timeout should be specified to all HTTP connections to the server.- Returns:
- see above.
-
addAlternativeAgentAddress
void addAlternativeAgentAddress(@NotNull java.lang.String address)
Adds alternative agent address that may be used by the server to communicate with agent.- Parameters:
address
- ip address- Since:
- 5.1
-
getCustomProperties
@NotNull @Deprecated java.util.Map<java.lang.String,java.lang.String> getCustomProperties()
Deprecated.Returns map of custom properties (defined in buildAgent.properties file and added by extensions). The property names are normally prefixed with env. and system.- Returns:
- map of custom properties
-
addCustomProperty
@Deprecated void addCustomProperty(@NotNull java.lang.String name, @NotNull java.lang.String value)
Deprecated.Adds new custom property to the configuration- Parameters:
name
- property namevalue
- property value
-
addSystemProperty
void addSystemProperty(@NotNull java.lang.String key, @NotNull java.lang.String value)
Adds all-builds wide system property. Creates build parameters withConstants.SYSTEM_PREFIX
prefix Modifications will be available for all builds on this agent- Parameters:
key
- property name (without the "system." prefix)value
- property value- Since:
- 6.0
-
addEnvironmentVariable
void addEnvironmentVariable(@NotNull java.lang.String key, @NotNull java.lang.String value)
Adds all-builds wide environment variable. Creates build parameters withConstants.ENV_PREFIX
prefix Note, on Windows machines environment size can be limited. Modifications will be available for all builds on this agent- Parameters:
key
- name (without the "env." prefix), may be case sensitive or not depending on OSvalue
- value- Since:
- 6.0
-
addConfigurationParameter
void addConfigurationParameter(@NotNull java.lang.String key, @NotNull java.lang.String value)
Adds all-builds wide configuration parameter. Modifications will be available for all builds on this agent- Parameters:
key
- namevalue
- value- Since:
- 6.0
-
removeConfigurationParameter
boolean removeConfigurationParameter(@NotNull java.lang.String key)
Remove build agent configuration parameter added via @code(addConfigurationParameter) method. Will not remove parameter specified in buildAgent.properties file.- Parameters:
key
- name- Returns:
- true if parameter was actually deleted, false otherwise (e.g parameter doesn't exist or is specified in buildAgent.properties file)
- Since:
- 2017.1
-
getBuildParameters
@NotNull BuildParametersMap getBuildParameters()
Returns build parameters. Some of values may not be fully resolved.- Returns:
- build-wide build parameters
- Since:
- 6.0
-
getConfigurationParameters
@NotNull java.util.Map<java.lang.String,java.lang.String> getConfigurationParameters()
Returns configuration parameters of this build- Returns:
- unmodifiable configuration parameters map
- Since:
- 6.0
-
getParametersResolver
@NotNull ValueResolver getParametersResolver()
Creates value resolver for parameters resolution in strings. The resolution rules are the same as for build parameters- Returns:
- value resolver to perform resolution of all parameters references within string
- Since:
- 6.0
-
getOperationMode
@NotNull default AgentOperationMode getOperationMode()
Returns agent's current operation mode. SeeAgentOperationMode
- Returns:
-
-