jetbrains.buildServer
Interface Build

All Known Subinterfaces:
RunningBuild, SBuild, SFinishedBuild, SRunningBuild

public interface Build

Represents an instance of the build ever run or running at the moment. This interface provides a number of methods to work with instance of a TeamCity build on the server side or on any remote client.


Method Summary
 java.lang.String getAgentName()
          Returns agent name where build is running or happened to run if finished.
 long getBuildId()
          Returns build id
 java.lang.String getBuildNumber()
          Returns build number in the user defined format (unresolved parameters in build number will be replaced with '???').
 Status getBuildStatus()
          Returns current build status
 BuildType getBuildType()
          Returns build configuration this build belongs to.
 java.lang.String getBuildTypeExternalId()
          Returns the build type external ID.
 java.lang.String getBuildTypeId()
          Returns build configuration internal id
 java.lang.String getBuildTypeName()
          Returns name of the build configuration this build belongs to.
 CanceledInfo getCanceledInfo()
          Returns info related to interrupted build.
 java.util.List<? extends VcsModification> getChanges(SelectPrevBuildPolicy policy, boolean includeModificationsIfPreviousBuildIsAbsent)
          List of modifications detected in the version control since the previous build (selected according to the specified policy) Ordering: last detected modifications goes first in the list
 UserSet<? extends User> getCommitters(SelectPrevBuildPolicy policy)
          Returns all users who made modifications since the previous build selected according to the specified policy.
 java.util.List<java.lang.String> getCompilationErrorMessages()
          Returns compilation error messages of this build
 java.util.List<? extends VcsModification> getContainingChanges()
          Returns changes in this build.
 long getDuration()
          Returns current build duration in seconds.
 java.util.Date getFinishDate()
          Returns finish timestamp for the build (server time) or null if it hasn't been finished yet.
 java.lang.String getFullName()
           
 java.util.List<java.lang.String> getLogMessages(int startFromIdx, int maxCount)
          Allows to get messages logged for the build
 java.lang.String getProjectExternalId()
          Returns external id of the project this build belongs to.
 java.lang.String getProjectId()
          Returns internal id of the project this build belongs to.
 java.util.Date getStartDate()
          Returns timestamp when the build start command has been sent to an agent (server-time) or remove from queue time if start command has not been sent
 StatusDescriptor getStatusDescriptor()
          Returns status descriptor of the build
 java.util.List<TestInfo> getTestMessages(int startFromIdx, int maxTestsToLoad)
          Retrieves information about tests failed in the build.
 boolean isFinished()
           
 boolean isPersonal()
          Returns if this build has been run to test personal changes
 

Method Detail

getStartDate

@NotNull
java.util.Date getStartDate()
Returns timestamp when the build start command has been sent to an agent (server-time) or remove from queue time if start command has not been sent

Returns:
see above

getAgentName

java.lang.String getAgentName()
Returns agent name where build is running or happened to run if finished.

Returns:
Agent name where build has been started on

getBuildId

long getBuildId()
Returns build id

Returns:
Unique build id

getStatusDescriptor

StatusDescriptor getStatusDescriptor()
Returns status descriptor of the build

Returns:
Descriptor of the current status of the build

getLogMessages

java.util.List<java.lang.String> getLogMessages(int startFromIdx,
                                                int maxCount)
Allows to get messages logged for the build

Parameters:
startFromIdx - index of the first message to load (zero based)
maxCount - messages count limit.
Returns:
list of plain messages

getTestMessages

java.util.List<TestInfo> getTestMessages(int startFromIdx,
                                         int maxTestsToLoad)
Retrieves information about tests failed in the build. Note that for running build currently executing test will be added to the list too.

Parameters:
startFromIdx - index/order number of the first test to load (zero based)
maxTestsToLoad - indicates how many tests to load, -1 to load all
Returns:
list of plain messages

getCompilationErrorMessages

java.util.List<java.lang.String> getCompilationErrorMessages()
Returns compilation error messages of this build

Returns:
list of plain messages

getBuildType

@Nullable
BuildType getBuildType()
Returns build configuration this build belongs to.

Returns:
build configuration descriptor.

getBuildTypeId

@NotNull
java.lang.String getBuildTypeId()
Returns build configuration internal id

Returns:
ID of the configuration this build belongs to.

getBuildTypeExternalId

@NotNull
java.lang.String getBuildTypeExternalId()
Returns the build type external ID.

If the external identifier does not exist (this might happen for a running build if the build type was deleted, and a new build type with same external id was created), a BuildPromotion#NOT_EXISTING_BUILD_TYPE_ID value is returned.

Returns:
build type external ID
Since:
8.0

getBuildTypeName

@NotNull
java.lang.String getBuildTypeName()
Returns name of the build configuration this build belongs to.

Returns:
name of the build configuration this build belongs to.

getFullName

@NotNull
java.lang.String getFullName()
Returns:
full name of the build configuration this build belongs to, has form "project_name :: buildconfig_name"

getProjectId

@Nullable
java.lang.String getProjectId()
Returns internal id of the project this build belongs to. Same as getBuildType().getProjectId().

Returns:
internal id of the project this build belongs to. Same as getBuildType().getProjectId().

getProjectExternalId

@Nullable
java.lang.String getProjectExternalId()
Returns external id of the project this build belongs to. Same as getBuildType().getProjectId().

Returns:
external id of the project this build belongs to. Same as getBuildType().getProjectId().
Since:
8.0

getChanges

java.util.List<? extends VcsModification> getChanges(SelectPrevBuildPolicy policy,
                                                     boolean includeModificationsIfPreviousBuildIsAbsent)
List of modifications detected in the version control since the previous build (selected according to the specified policy) Ordering: last detected modifications goes first in the list

Parameters:
policy - can be one of the two kinds:
includeModificationsIfPreviousBuildIsAbsent - should the method return something if there's no previous build.
Returns:
list of modifications

getContainingChanges

java.util.List<? extends VcsModification> getContainingChanges()
Returns changes in this build. Same as getChanges(SelectPrevBuildPolicy.SINCE_LAST_BUILD, false) Ordering: last detected modifications goes first in the list

Returns:
changes in this build

isPersonal

boolean isPersonal()
Returns if this build has been run to test personal changes

Returns:
true is the build has been started as personal, and its changes were not committed to the VCS

getBuildStatus

Status getBuildStatus()
Returns current build status

Returns:
Current build status

isFinished

boolean isFinished()
Returns:
true if the build was finished and was saved to the history

getCommitters

UserSet<? extends User> getCommitters(SelectPrevBuildPolicy policy)
Returns all users who made modifications since the previous build selected according to the specified policy. Will provide results only after changes are collected for a build (i.e. after BuildServerListener.changesLoaded event for the build) and will only return users with matching VCS usernames set.

Parameters:
policy - can be one of the two kinds:
Returns:
committers in this build according to selection policy. If the build is personal, the set contains the only user who started the build

getBuildNumber

java.lang.String getBuildNumber()
Returns build number in the user defined format (unresolved parameters in build number will be replaced with '???').

Returns:
presentable build number

getFinishDate

@Nullable
java.util.Date getFinishDate()
Returns finish timestamp for the build (server time) or null if it hasn't been finished yet.

Returns:
Date/time when the build has been finished, null if still running.

getCanceledInfo

CanceledInfo getCanceledInfo()
Returns info related to interrupted build. If build is finished, not interrupted, the value is null.

Returns:
info about canceled reason and canceler if build was actually interrupted, null otherwise.

getDuration

long getDuration()
Returns current build duration in seconds. The build duration is calculated as follows: - if build has been started on an agent (run command was successfully sent) then duration is calculated as finish time - start on agent time - otherwise duration is calculated as finish time - remove from queue time

Returns:
current build duration in seconds