jetbrains.buildServer.agent
Interface AgentRunningBuild

All Superinterfaces:
AgentBuildSettings

public interface AgentRunningBuild
extends AgentBuildSettings

Represents running build on the agent side


Method Summary
 void addSharedConfigParameter(java.lang.String key, java.lang.String value)
          Adds build wide configuration parameter.
 void addSharedEnvironmentVariable(java.lang.String key, java.lang.String value)
          Adds build wide environment variable.
 void addSharedSystemProperty(java.lang.String key, java.lang.String value)
          Adds build wide system property.
 java.lang.String getArtifactsPaths()
          Returns artifacts paths specified for build.
 java.util.Collection<AgentBuildFeature> getBuildFeatures()
           
 java.util.Collection<AgentBuildFeature> getBuildFeaturesOfType(java.lang.String type)
           
 java.lang.String getBuildNumber()
          Returns current build number.
 BuildParametersMap getBuildParameters()
          Deprecated. use BuildRunnerContext.getBuildParameters()} returns build parameters of currently selected build runner
 java.io.File getCheckoutDirectory()
          Returns checkout directory: directory where checkout is performed
 boolean getFailBuildOnExitCode()
          Property is defined by build configuration settings to define the way build runner should process build process exit code.
 BuildInterruptReason getInterruptReason()
          Use this method to check if build is interrupted.
 BuildParametersMap getMandatoryBuildParameters()
          Deprecated. use config parameters from BuildAgentConfiguration or jetbrains.buildServer.agent.BuildContext This method returns the same as getRunnerParameters()
 ResolvedParameters getResolvedParameters()
          Deprecated. use BuildRunnerContext.getRunnerParameters() returns runner parameters of currently selected build runner
 java.util.Map<java.lang.String,java.lang.String> getRunnerParameters()
          Deprecated. use BuildRunnerContext.getRunnerParameters()} returns runner parameters of currently selected build runner
 java.lang.String getRunType()
          Deprecated. use BuildRunnerContext.getRunType() returns runner parameters of currently selected build runner
 BuildParametersMap getSharedBuildParameters()
          Returns build parameters.
 java.util.Map<java.lang.String,java.lang.String> getSharedConfigParameters()
          Returns configuration parameters of this build If you have BuildRunnerContext, consider using BuildRunnerContext.getConfigParameters()
 ValueResolver getSharedParametersResolver()
          Creates value resolver for parameters resolution in strings.
 UnresolvedParameters getUnresolvedParameters()
          Deprecated. use BuildRunnerContext, returns parameters of currently selected build runner.
 java.io.File getWorkingDirectory()
          Deprecated. use BuildRunnerContext.getWorkingDirectory() this method returns working directory of first build runner.
 boolean isBuildFailingOnServer()
          Make synchronous call to the build server and check if the build is failing there
 boolean isInAlwaysExecutingStage()
           
 void stopBuild(java.lang.String reason)
          Terminates execution of the build at the current build stage.
 
Methods inherited from interface jetbrains.buildServer.agent.AgentBuildSettings
getAccessCode, getAccessUser, getAgentConfiguration, getAgentTempDirectory, getArtifactDependencies, getBuildCurrentVersion, getBuildId, getBuildLogger, getBuildPreviousVersion, getBuildTempDirectory, getBuildTypeId, getBuildTypeName, getBuildTypeOptionValue, getDefaultCheckoutDirectory, getExecutionTimeoutMinutes, getPersonalVcsChanges, getProjectName, getVcsChanges, getVcsRootEntries, isCheckoutOnAgent, isCheckoutOnServer, isCleanBuild, isCustomCheckoutDirectory, isPersonal, isPersonalPatchAvailable
 

Method Detail

getMandatoryBuildParameters

@NotNull
@Deprecated
BuildParametersMap getMandatoryBuildParameters()
Deprecated. use config parameters from BuildAgentConfiguration or jetbrains.buildServer.agent.BuildContext This method returns the same as getRunnerParameters()

Returns subset of build parameters with all references expanded Only BuildParameterPolicy.MANDATORY build parameters are returned.

Returns:
see above

getCheckoutDirectory

@NotNull
java.io.File getCheckoutDirectory()
Returns checkout directory: directory where checkout is performed

Returns:
see above

getWorkingDirectory

@NotNull
@Deprecated
java.io.File getWorkingDirectory()
Deprecated. use BuildRunnerContext.getWorkingDirectory() this method returns working directory of first build runner.

Returns build working directory: working directory where build runner started

Returns:
see above

getArtifactsPaths

@Nullable
java.lang.String getArtifactsPaths()
Returns artifacts paths specified for build. This value is always resolved in runtime

Returns:
artifacts paths

getFailBuildOnExitCode

boolean getFailBuildOnExitCode()
Property is defined by build configuration settings to define the way build runner should process build process exit code.

Returns:
true if build runner is expected to fail build if build process returned non-zero exit code

getResolvedParameters

@NotNull
@Deprecated
ResolvedParameters getResolvedParameters()
Deprecated. use BuildRunnerContext.getRunnerParameters() returns runner parameters of currently selected build runner

Returns:
resolved parameters
Since:
5.1

getRunType

@NotNull
@Deprecated
java.lang.String getRunType()
Deprecated. use BuildRunnerContext.getRunType() returns runner parameters of currently selected build runner

Returns:
runner type of the build
Since:
5.1

getUnresolvedParameters

@NotNull
@Deprecated
UnresolvedParameters getUnresolvedParameters()
Deprecated. use BuildRunnerContext, returns parameters of currently selected build runner.

Returns:
unresolved parameters of the build. Note, values may contain some unresolved TeamCity references.
Since:
5.1

getBuildParameters

@NotNull
@Deprecated
BuildParametersMap getBuildParameters()
Deprecated. use BuildRunnerContext.getBuildParameters()} returns build parameters of currently selected build runner

Returns build parameters with all references expanded

Returns:
see above
Since:
5.1

getRunnerParameters

@NotNull
@Deprecated
java.util.Map<java.lang.String,java.lang.String> getRunnerParameters()
Deprecated. use BuildRunnerContext.getRunnerParameters()} returns runner parameters of currently selected build runner

Returns unmodifiable map of runner parameters with all references expanded

Returns:
see above
Since:
5.1

getBuildNumber

@NotNull
java.lang.String getBuildNumber()
Returns current build number. Note that during the build, build number may change (i.e. build script can emit ##teamcity[buildNumber ''] service message. Because of this, it is safer to read build number before build is finished (when build process is not working anymore).

Returns:
current build number
Since:
5.1.1

getSharedConfigParameters

@NotNull
java.util.Map<java.lang.String,java.lang.String> getSharedConfigParameters()
Returns configuration parameters of this build If you have BuildRunnerContext, consider using BuildRunnerContext.getConfigParameters()

Returns:
unmodifiable configuration parameters map
Since:
6.0
See Also:
BuildRunnerContext.getConfigParameters()

addSharedConfigParameter

void addSharedConfigParameter(@NotNull
                              java.lang.String key,
                              @NotNull
                              java.lang.String value)
Adds build wide configuration parameter. Modifications will be available in all build runner states. If you have BuildRunnerContext, consider using BuildRunnerContext.addConfigParameter(String, String)*

Parameters:
key - name
value - value
Since:
6.0
See Also:
BuildRunnerContext.addConfigParameter(String, String)

addSharedSystemProperty

void addSharedSystemProperty(@NotNull
                             java.lang.String key,
                             @NotNull
                             java.lang.String value)
Adds build wide system property. Creates build parameters with Constants.SYSTEM_PREFIX prefix

Modifications will be available in all build runner states.

If you have BuildRunnerContext, consider using BuildRunnerContext.addSystemProperty(String, String)

Parameters:
key - property name
value - property value
Since:
6.0
See Also:
BuildRunnerContext.addSystemProperty(String, String)

addSharedEnvironmentVariable

void addSharedEnvironmentVariable(@NotNull
                                  java.lang.String key,
                                  @NotNull
                                  java.lang.String value)
Adds build wide environment variable. Creates build parameters with Constants.ENV_PREFIX prefix

Note, on Windows machines environment size can be limited.

Modifications will be available in all build runner states.

If you have BuildRunnerContext, consider using BuildRunnerContext.addEnvironmentVariable(String, String)

Parameters:
key - name may be case sensitive or not depending on OS
value - value environment variable value
Since:
6.0
See Also:
BuildRunnerContext.addEnvironmentVariable(String, String)

getSharedBuildParameters

@NotNull
BuildParametersMap getSharedBuildParameters()
Returns build parameters. Some of values may not be fully resolved. If you have BuildRunnerContext, consider using BuildRunnerContext.getBuildParameters()

Returns:
build-wide build parameters
Since:
6.0
See Also:
BuildRunnerContext.getBuildParameters()

getSharedParametersResolver

@NotNull
ValueResolver getSharedParametersResolver()
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

getBuildFeatures

@NotNull
java.util.Collection<AgentBuildFeature> getBuildFeatures()
Returns:
collection of enabled build features for the build
Since:
7.0

getBuildFeaturesOfType

@NotNull
java.util.Collection<AgentBuildFeature> getBuildFeaturesOfType(@NotNull
                                                                       java.lang.String type)
Parameters:
type - type to filter features
Returns:
collection of enabled build features for the build
Since:
7.0

stopBuild

void stopBuild(@NotNull
               java.lang.String reason)
Terminates execution of the build at the current build stage. Build will be stopped with error and given reason. AgentLifeCycleListener.beforeBuildInterrupted(AgentRunningBuild, BuildInterruptReason) event will be fired.

Parameters:
reason - build stop reason
Since:
7.1

getInterruptReason

@Nullable
BuildInterruptReason getInterruptReason()
Use this method to check if build is interrupted.

Returns:
current build interrupt reason or null if build is not interrupted
Since:
7.1

isBuildFailingOnServer

boolean isBuildFailingOnServer()
                               throws java.lang.InterruptedException
Make synchronous call to the build server and check if the build is failing there

Returns:
true if the build is failing on server
Throws:
java.lang.InterruptedException - if the request cannot be completed (for instance, the build is no longer present on the server)
Since:
8.0

isInAlwaysExecutingStage

boolean isInAlwaysExecutingStage()
Returns:
true if the currently executing build stage is "Always executing stage"
See Also:
ServerProvidedProperties.BUILD_STEP_EXECUTION_MODE_ALWAYS