Package jetbrains.buildServer.agent
Interface BuildRunnerContext
-
- All Known Subinterfaces:
BuildRunnerContextEx
- All Known Implementing Classes:
BuildRunnerContextImpl
@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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddConfigParameter(String key, String value)Adds configuration parameter ONTO this build runner state ONLY.voidaddEnvironmentVariable(String key, String value)Adds environment variable ONTO this build runner state ONLY.voidaddRunnerParameter(String key, String value)Adds runner parameter for current build runner.voidaddSystemProperty(String key, String value)Adds build system property ONTO this build runner state ONLY.AgentRunningBuildgetBuild()Return agent running build instance of current build runner contextBuildParametersMapgetBuildParameters()Returns current runner build parameters with all references expandedMap<String,String>getConfigParameters()Returns current runner's configuration parameters with all references expandedStringgetId()StringgetName()ValueResolvergetParametersResolver()Creates value resolver for parameters resolution in strings.Map<String,String>getRunnerParameters()Returns unmodifiable map of runner parameters with all references expandedStringgetRunType()StringgetToolPath(String toolName)Returns path to a tool with given nameVirtualContextgetVirtualContext()FilegetWorkingDirectory()Returns current runner working directory.booleanisVirtualContext()booleanparametersHaveReferencesTo(Collection<String> keys)Finds usages of any of the given keys in all build and runner parameters
-
-
-
Method Detail
-
getId
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 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 String getRunType()
- Returns:
- current runner type of the build
- Since:
- 6.0
-
getName
@NotNull 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 Map<String,String> getConfigParameters()
Returns current runner's configuration parameters with all references expanded- Returns:
- see above
- Since:
- 7.1
-
getRunnerParameters
@NotNull Map<String,String> getRunnerParameters()
Returns unmodifiable map of runner parameters with all references expanded- Returns:
- see above
- Since:
- 6.0
-
addSystemProperty
void addSystemProperty(@NotNull String key, @NotNull String value)Adds build system property ONTO this build runner state ONLY. Creates build parameters withConstants.SYSTEM_PREFIXprefix NOTE:. Modification will only affect current build runner state. Modifications will NOT be available in anther build runner states.- Parameters:
key- property namevalue- property value that may contain references- Since:
- 6.0
-
addEnvironmentVariable
void addEnvironmentVariable(@NotNull String key, @NotNull String value)Adds environment variable ONTO this build runner state ONLY. Creates build parameters withConstants.ENV_PREFIXprefix 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 OSvalue- value- Since:
- 6.0
-
addConfigParameter
void addConfigParameter(@NotNull String key, @NotNull 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 OSvalue- value- Since:
- 7.1
-
addRunnerParameter
void addRunnerParameter(@NotNull String key, @NotNull 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- keyvalue- 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 String getToolPath(@NotNull 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 Collection<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
-
isVirtualContext
boolean isVirtualContext()
- Returns:
- true if the given step will be run under a virtual environment (Docker) and the runner should not expect presence of tools non-bundled with the agent (located on build agent FS).
- Since:
- 2018.1
-
getVirtualContext
@NotNull VirtualContext getVirtualContext()
- Returns:
- current virtual context in the scope of build step
- Since:
- 2019.2
-
-