Package jetbrains.buildServer.agent
Interface AgentRunningBuild
-
- All Superinterfaces:
AgentBuildSettings
,Loggable
- All Known Subinterfaces:
AgentRunningBuildEx
- All Known Implementing Classes:
AgentRunningBuildImpl
public interface AgentRunningBuild extends AgentBuildSettings, Loggable
Represents running build on the agent side
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addSharedConfigParameter(String key, String value)
Adds build wide configuration parameter.void
addSharedEnvironmentVariable(String key, String value)
Adds build wide environment variable.void
addSharedSystemProperty(String key, String value)
Adds build wide system property.String
getArtifactsPaths()
Returns artifacts paths specified for build.Map<String,String>
getArtifactStorageSettings()
Collection<AgentBuildFeature>
getBuildFeatures()
Collection<AgentBuildFeature>
getBuildFeaturesOfType(String type)
String
getBuildNumber()
Returns current build number.BuildParametersMap
getBuildParameters()
Deprecated.useBuildRunnerContext.getBuildParameters()
} returns build parameters of currently selected build runnerFile
getCheckoutDirectory()
Returns checkout directory: directory where checkout is performedAgentCheckoutMode
getEffectiveCheckoutMode()
Get checkout mode that is used for this build.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.NodeIdHolder
getNodeIdHolder()
PasswordReplacer
getPasswordReplacer()
Map<String,String>
getRunnerParameters()
Deprecated.useBuildRunnerContext.getRunnerParameters()
} returns runner parameters of currently selected build runnerBuildParametersMap
getSharedBuildParameters()
Returns build parameters.Map<String,String>
getSharedConfigParameters()
Returns configuration parameters of this build If you haveBuildRunnerContext
, consider usingBuildRunnerContext.getConfigParameters()
ValueResolver
getSharedParametersResolver()
Creates value resolver for parameters resolution in strings.File
getWorkingDirectory()
Deprecated.useBuildRunnerContext.getWorkingDirectory()
this method returns working directory of first build runner.void
interruptBuild(String comment, boolean reQueue)
Interrupt and cancel running build.boolean
isBuildFailingOnServer()
Make synchronous call to the build server and check if the build is failing thereboolean
isInAlwaysExecutingStage()
void
stopBuild(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, getBuildRunners, getBuildTempDirectory, getBuildTypeExternalId, getBuildTypeId, getBuildTypeName, getBuildTypeOptionValue, getCheckoutType, getDefaultCheckoutDirectory, getExecutionTimeoutMinutes, getPersonalVcsChanges, getProjectName, getVcsChanges, getVcsRootEntries, getVcsSettingsHashForCheckoutMode, isCheckoutOnAgent, isCheckoutOnServer, isCleanBuild, isCustomCheckoutDirectory, isPersonal, isPersonalPatchAvailable
-
-
-
-
Method Detail
-
getCheckoutDirectory
@NotNull File getCheckoutDirectory()
Returns checkout directory: directory where checkout is performed- Returns:
- see above
-
getEffectiveCheckoutMode
@Nullable AgentCheckoutMode getEffectiveCheckoutMode()
Get checkout mode that is used for this build. Returns null if checkout mode was not calculated yet. This method differs from theAgentBuildSettings.getCheckoutType()
as it resolvesAgentBuild.CheckoutType.AUTO
to the server or agent-side checkout.
-
getWorkingDirectory
@NotNull @Deprecated File getWorkingDirectory()
Deprecated.useBuildRunnerContext.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 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
-
getBuildParameters
@NotNull @Deprecated BuildParametersMap getBuildParameters()
Deprecated.useBuildRunnerContext.getBuildParameters()
} returns build parameters of currently selected build runnerReturns build parameters with all references expanded- Returns:
- see above
- Since:
- 5.1
-
getRunnerParameters
@NotNull @Deprecated Map<String,String> getRunnerParameters()
Deprecated.useBuildRunnerContext.getRunnerParameters()
} returns runner parameters of currently selected build runnerReturns unmodifiable map of runner parameters with all references expanded- Returns:
- see above
- Since:
- 5.1
-
getBuildNumber
@NotNull 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 Map<String,String> getSharedConfigParameters()
Returns configuration parameters of this build If you haveBuildRunnerContext
, consider usingBuildRunnerContext.getConfigParameters()
- Returns:
- unmodifiable configuration parameters map
- Since:
- 6.0
- See Also:
BuildRunnerContext.getConfigParameters()
-
addSharedConfigParameter
void addSharedConfigParameter(@NotNull String key, @NotNull String value)
Adds build wide configuration parameter. Modifications will be available in all build runner states. If you haveBuildRunnerContext
, consider usingBuildRunnerContext.addConfigParameter(String, String)
*- Parameters:
key
- namevalue
- value- Since:
- 6.0
- See Also:
BuildRunnerContext.addConfigParameter(String, String)
-
addSharedSystemProperty
void addSharedSystemProperty(@NotNull String key, @NotNull String value)
Adds build wide system property. Creates build parameters withConstants.SYSTEM_PREFIX
prefix Modifications will be available in all build runner states. If you haveBuildRunnerContext
, consider usingBuildRunnerContext.addSystemProperty(String, String)
- Parameters:
key
- property namevalue
- property value- Since:
- 6.0
- See Also:
BuildRunnerContext.addSystemProperty(String, String)
-
addSharedEnvironmentVariable
void addSharedEnvironmentVariable(@NotNull String key, @NotNull String value)
Adds build wide environment variable. Creates build parameters withConstants.ENV_PREFIX
prefix Note, on Windows machines environment size can be limited. Modifications will be available in all build runner states. If you haveBuildRunnerContext
, consider usingBuildRunnerContext.addEnvironmentVariable(String, String)
- Parameters:
key
- name may be case sensitive or not depending on OSvalue
- 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 haveBuildRunnerContext
, consider usingBuildRunnerContext.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 Collection<AgentBuildFeature> getBuildFeatures()
- Returns:
- collection of enabled build features for the build
- Since:
- 7.0
-
getBuildFeaturesOfType
@NotNull Collection<AgentBuildFeature> getBuildFeaturesOfType(@NotNull String type)
- Parameters:
type
- type to filter features- Returns:
- collection of enabled build features for the build
- Since:
- 7.0
-
stopBuild
void stopBuild(@NotNull String reason)
Terminates execution of the build at the current build stage. Build will be stopped with error and given reason. Build will not be marked as canceled.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
-
interruptBuild
void interruptBuild(@NotNull String comment, boolean reQueue)
Interrupt and cancel running build.- Parameters:
comment
- will be used as a canceling comment for the buildreQueue
- if true, build should be re-queued on the server side- Since:
- 2019.1
-
isBuildFailingOnServer
boolean isBuildFailingOnServer() throws 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:
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
-
getPasswordReplacer
@NotNull PasswordReplacer getPasswordReplacer()
- Returns:
- instance of PasswordReplacer which can be used to replace passwords known to current build in different logs or files
- Since:
- 2017.1
-
getArtifactStorageSettings
@NotNull Map<String,String> getArtifactStorageSettings()
- Returns:
- artifact storage settings if there are any available for this build
- Since:
- 2017.1
-
getNodeIdHolder
@NotNull NodeIdHolder getNodeIdHolder()
- Returns:
- information about the current node id associated with this build, can be used to set a proper NodeId cookie to HTTP requests to TeamCity server to ensure the request is landed on a specified node
- Since:
- 2022.06
-
-