jetbrains.buildServer.agent
Interface BuildRunnerContext


@SystemProvided
public interface BuildRunnerContext

Represents current build runner. All update methods will modify current state. Modified state will be lost on the end of current running state.

Since:
6.0
Author:
Eugene Petrenko

Method Summary
 void addConfigParameter(java.lang.String key, java.lang.String value)
          Adds configuration parameter ONTO this build runner state ONLY.
 void addEnvironmentVariable(java.lang.String key, java.lang.String value)
          Adds environment variable ONTO this build runner state ONLY.
 void addRunnerParameter(java.lang.String key, java.lang.String value)
          Adds runner parameter for current build runner.
 void addSystemProperty(java.lang.String key, java.lang.String value)
          Adds build system property ONTO this build runner state ONLY.
 AgentRunningBuild getBuild()
          Return agent running build instance of current build runner context
 BuildParametersMap getBuildParameters()
          Returns current runner build parameters with all references expanded

NOTE: Parameters may contain modifications for current state only

 java.util.Map<java.lang.String,java.lang.String> getConfigParameters()
          Returns current runner's configuration parameters with all references expanded
 java.lang.String getId()
           
 java.lang.String getName()
           
 ValueResolver getParametersResolver()
          Creates value resolver for parameters resolution in strings.
 java.util.Map<java.lang.String,java.lang.String> getRunnerParameters()
          Returns unmodifiable map of runner parameters with all references expanded
 java.lang.String getRunType()
           
 java.lang.String getToolPath(java.lang.String toolName)
          Returns path to a tool with given name
 java.io.File getWorkingDirectory()
          Returns current runner working directory.
 boolean parametersHaveReferencesTo(java.util.Collection<java.lang.String> keys)
          Finds usages of any of the given keys in all build and runner parameters
 

Method Detail

getId

java.lang.String getId()
Returns:
build runner Id from server
Since:
8.0

getBuild

@NotNull
AgentRunningBuild getBuild()
Return agent running build instance of current build runner context

Returns:
build from what this runner context was created
Since:
6.0

getWorkingDirectory

@NotNull
java.io.File getWorkingDirectory()
Returns current runner working directory. This directory is expected to be set as working directory in a build process that build runner will start.

Returns:
path
Since:
6.0

getRunType

@NotNull
java.lang.String getRunType()
Returns:
current runner type of the build
Since:
6.0

getName

@NotNull
java.lang.String getName()
Returns:
build runner descriptor name, defined by the user
Since:
6.5

getBuildParameters

@NotNull
BuildParametersMap getBuildParameters()
Returns current runner build parameters with all references expanded

NOTE: Parameters may contain modifications for current state only

Returns:
see above
Since:
6.0

getConfigParameters

@NotNull
java.util.Map<java.lang.String,java.lang.String> getConfigParameters()
Returns current runner's configuration parameters with all references expanded

Returns:
see above
Since:
7.1

getRunnerParameters

@NotNull
java.util.Map<java.lang.String,java.lang.String> getRunnerParameters()
Returns unmodifiable map of runner parameters with all references expanded

Returns:
see above
Since:
6.0

addSystemProperty

void addSystemProperty(@NotNull
                       java.lang.String key,
                       @NotNull
                       java.lang.String value)
Adds build system property ONTO this build runner state ONLY. Creates build parameters with Constants.SYSTEM_PREFIX prefix

NOTE:. Modification will only affect current build runner state. Modifications will NOT be available in anther build runner states.

Parameters:
key - property name
value - property value that may contain references
Since:
6.0

addEnvironmentVariable

void addEnvironmentVariable(@NotNull
                            java.lang.String key,
                            @NotNull
                            java.lang.String value)
Adds environment variable ONTO this build runner state ONLY. Creates build parameters with Constants.ENV_PREFIX prefix

Note, on Windows machines environment size can be limited.

NOTE:. Modification will only affect current build runner state. Modifications will NOT be available in anther build runner states.

Parameters:
key - name, may be case sensitive or not depending on OS
value - value
Since:
6.0

addConfigParameter

void addConfigParameter(@NotNull
                        java.lang.String key,
                        @NotNull
                        java.lang.String value)
Adds configuration parameter ONTO this build runner state ONLY.

NOTE:. Modification will only affect current build runner state. Modifications will NOT be available in anther build runner states.

Parameters:
key - name, may be case sensitive or not depending on OS
value - value
Since:
7.1

addRunnerParameter

void addRunnerParameter(@NotNull
                        java.lang.String key,
                        @NotNull
                        java.lang.String value)
Adds runner parameter for current build runner. NOTE:. Modification will only affect current build runner state. Modifications will NOT be available in anther build runner states.

Parameters:
key - key
value - value
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

getToolPath

@NotNull
java.lang.String getToolPath(@NotNull
                                     java.lang.String toolName)
                             throws ToolCannotBeFoundException
Returns path to a tool with given name

Parameters:
toolName - name of the tool
Returns:
path to a tool on the filesystem
Throws:
ToolCannotBeFoundException - if path to a tool can't be located
Since:
6.0

parametersHaveReferencesTo

boolean parametersHaveReferencesTo(@NotNull
                                   java.util.Collection<java.lang.String> keys)
Finds usages of any of the given keys in all build and runner parameters

Parameters:
keys - the collection of keys
Returns:
true if a usage of any given keys is found