jetbrains.buildServer.agent
Interface BuildAgentConfiguration


public interface BuildAgentConfiguration

Represents configuration of build agent (loaded from buildAgent.properties file)


Method Summary
 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)
          Deprecated. use addConfigurationParameter(String, String), addEnvironmentVariable(String, String) or addSystemProperty(String, String)
 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 files
 java.util.Map<java.lang.String,java.lang.String> getAgentParameters()
          Deprecated. use getBuildParameters() or getConfigurationParameters() to get resolved parameters map
 java.io.File getAgentPluginsDirectory()
           
 java.io.File getAgentTempDirectory()
          Deprecated. use AgentBuildSettings.getAgentTempDirectory()
 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 agent
 BuildParametersMap getBuildParameters()
          Returns build parameters.
 java.io.File getBuildTempDirectory()
          Deprecated. use AgentBuildSettings.getBuildTempDirectory()
 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 build
 java.util.Map<java.lang.String,java.lang.String> getCustomProperties()
          Deprecated. use getBuildParameters() or getConfigurationParameters()
 java.lang.String getEnv(java.lang.String key)
          Deprecated. use getBuildParameters() -> BuildParametersMap.getEnvironmentVariables()
 java.lang.String getName()
          Returns name of the agent
 java.lang.String getOwnAddress()
          Returns IP address where agent accepts commands from the server
 int getOwnPort()
          Returns port where agent accepts commands from the server
 ValueResolver getParametersResolver()
          Creates value resolver for parameters resolution in strings.
 int getServerConnectionTimeout()
          Returns connection timeout in seconds.
 java.lang.String getServerUrl()
          Returns server URL
 BuildAgentSystemInfo getSystemInfo()
          Returns agent jvm(system) information
 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.
 java.io.File getWorkDirectory()
          Returns path to AGENT_INSTALL_DIR/work directory
 

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

getWorkDirectory

@NotNull
java.io.File getWorkDirectory()
Returns path to AGENT_INSTALL_DIR/work directory

Returns:
see above

getBuildTempDirectory

@NotNull
java.io.File getBuildTempDirectory()
Deprecated. use AgentBuildSettings.getBuildTempDirectory()

Returns path to a folder under getTempDirectory(). This folder is cleaned before build is started.

Returns:
see above

getAgentTempDirectory

@Deprecated
@NotNull
java.io.File getAgentTempDirectory()
Deprecated. use AgentBuildSettings.getAgentTempDirectory()

Returns path to a folder under getTempDirectory(). 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

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. use getBuildParameters() or getConfigurationParameters()

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

getAgentParameters

@NotNull
@Deprecated
java.util.Map<java.lang.String,java.lang.String> getAgentParameters()
Deprecated. use getBuildParameters() or getConfigurationParameters() to get resolved parameters map

Returns map of agent-defined parameters except for custom properties. Includes environment variables, agent's own JVM options and agent-specific properties. The property names are prefixed with env. and system.

Returns:
map of the properties

addCustomProperty

@Deprecated
void addCustomProperty(@NotNull
                                  java.lang.String name,
                                  @NotNull
                                  java.lang.String value)
Deprecated. use addConfigurationParameter(String, String), addEnvironmentVariable(String, String) or addSystemProperty(String, String)

Adds new custom property to the configuration

Parameters:
name - property name
value - property value

getEnv

@Nullable
@Deprecated
java.lang.String getEnv(@NotNull
                                            java.lang.String key)
Deprecated. use getBuildParameters() -> BuildParametersMap.getEnvironmentVariables()

Returns environment variable by name

Parameters:
key - name of environment variable
Returns:
see above

addSystemProperty

void addSystemProperty(@NotNull
                       java.lang.String key,
                       @NotNull
                       java.lang.String value)
Adds all-builds wide system property.

Creates build parameters with Constants.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 with Constants.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 OS
value - 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 - name
value - value
Since:
6.0

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