Package jetbrains.buildServer
Interface Build
-
- All Known Subinterfaces:
BuildEx
,FinishedBuildEx
,RunningBuild
,RunningBuildEx
,SBuild
,SFinishedBuild
,SRunningBuild
- All Known Implementing Classes:
BaseBuild
,BaseRunningBuild
,CompositeRunningBuild
,DummyBuild
,FinishedBuildImpl
,MockBuild
,RunningBuildImpl
,RunningBuildWrapper
,SecuredCompositeRunningBuild
,SecuredFinishedBuildImpl
,SecuredRunningBuild
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getAgentName()
Returns agent name where build is running or happened to run if finished.long
getBuildId()
Returns build idString
getBuildNumber()
Returns build number in the user defined format (unresolved parameters in build number will be replaced with '???').Status
getBuildStatus()
Returns current build statusBuildType
getBuildType()
Returns build configuration this build belongs to.String
getBuildTypeExternalId()
Returns the build type external ID.String
getBuildTypeId()
Returns build configuration internal idString
getBuildTypeName()
Returns name of the build configuration this build belongs to.CanceledInfo
getCanceledInfo()
Returns info related to interrupted build.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 listUserSet<? extends User>
getCommitters(SelectPrevBuildPolicy policy)
Returns all users who made modifications since the previous build selected according to the specified policy.List<String>
getCompilationErrorMessages()
Returns compilation error messages of this buildList<? extends VcsModification>
getContainingChanges()
Returns changes in this build.long
getDuration()
Returns current build duration in seconds.Date
getFinishDate()
Returns finish timestamp for the build (server time) ornull
if it hasn't been finished yet.String
getFullName()
List<String>
getLogMessages(int startFromIdx, int maxCount)
Allows to get messages logged for the buildString
getProjectExternalId()
Returns external id of the project this build belongs to.String
getProjectId()
Returns internal id of the project this build belongs to.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 sentStatusDescriptor
getStatusDescriptor()
Returns status descriptor of the buildList<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 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
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
List<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
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
List<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 String getBuildTypeId()
Returns build configuration internal id- Returns:
- ID of the configuration this build belongs to.
-
getBuildTypeExternalId
@NotNull 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 String getBuildTypeName()
Returns name of the build configuration this build belongs to.- Returns:
- name of the build configuration this build belongs to.
-
getFullName
@NotNull String getFullName()
- Returns:
- full name of the build configuration this build belongs to, has form "project_name :: buildconfig_name"
-
getProjectId
@Nullable 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 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
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:SelectPrevBuildPolicy.SINCE_LAST_BUILD
- all modifications made since previous running buildSelectPrevBuildPolicy.SINCE_LAST_SUCCESSFULLY_FINISHED_BUILD
- all modifications made since previous successfully finished build
includeModificationsIfPreviousBuildIsAbsent
- should the method return something if there's no previous build.- Returns:
- list of modifications
-
getContainingChanges
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. afterBuildServerListener.changesLoaded
event for the build) and will only return users with matching VCS usernames set.- Parameters:
policy
- can be one of the two kinds:SelectPrevBuildPolicy.SINCE_LAST_BUILD
- all modifications made since previous running buildSelectPrevBuildPolicy.SINCE_LAST_SUCCESSFULLY_FINISHED_BUILD
- all modifications made since previous successfully finished build
- 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
@NotNull 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 Date getFinishDate()
Returns finish timestamp for the build (server time) ornull
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
-
-