jetbrains.buildServer.serverSide
Interface SBuild

All Superinterfaces:
Build, BuildPromotionOwner, ParametersSupport
All Known Subinterfaces:
SFinishedBuild, SRunningBuild

public interface SBuild
extends Build, BuildPromotionOwner, ParametersSupport

Server-side instance of a build.


Method Summary
 void addBuildProblem(BuildProblemData buildProblem)
          Adds build problem to the build.
 BuildProblemData addUserBuildProblem(User user, java.lang.String problemDesciption)
          Adds user provided build problem to the build.
 java.util.Date convertToAgentTime(java.util.Date serverTime)
          Converts server time to agent time by taking into account agent and server time difference.
 java.util.Date convertToServerTime(java.util.Date agentTime)
          Converts agent time to server time by taking into account agent and server time difference.
 SBuildAgent getAgent()
           
 java.util.List<SArtifactDependency> getArtifactDependencies()
          Returns the artifact dependencies of this build.
 BuildArtifacts getArtifacts(BuildArtifactsViewMode mode)
          Returns accessor for build artifacts.
 java.io.File getArtifactsDirectory()
          Returns artifacts directory of this build.
 Branch getBranch()
           
 Comment getBuildComment()
          Returns build comment.
 java.lang.String getBuildDescription()
          Returns build description set to this build explicitly or null.
 BuildLog getBuildLog()
          Returns build log.
 java.util.Map<java.lang.String,java.lang.String> getBuildOwnParameters()
          Deprecated. Use ParametersSupport
 BuildStatistics getBuildStatistics(BuildStatisticsOptions options)
          Same as getFullStatistics() but with more control of data being loaded.
 SBuildType getBuildType()
          Returns build configuration this build belongs to.
 java.util.List<SVcsModification> 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
 java.util.Date getClientStartDate()
          Returns the timestamp when the build was started on the build agent (in agent time)
 java.util.TimeZone getClientTimeZone()
          Returns agent machine time zone if it's available on server.
 UserSet<SUser> getCommitters(SelectPrevBuildPolicy policy)
          Returns all users who made modifications since the previous build selected acoording to the speciifed policy.
 java.util.List<SVcsModification> getContainingChanges()
          Returns changes in this build.
 DownloadedArtifacts getDownloadedArtifacts()
          Returns information about artifacts downloaded by this build according to configured artifact dependencies.
 java.util.List<BuildProblemData> getFailureReasons()
          Returns build problems that caused build failure or empty list if build is successful
 byte[] getFileContent(java.lang.String filePath)
          Get binary content of the single file related to this build.
 java.lang.String getFirstInternalError()
          Returns the first internal error in a build, or null.
 java.lang.String getFirstInternalErrorMessage()
          Returns the error message associated with the first internal error, or null
 BuildStatistics getFullStatistics()
          Calculates full statistics for this build.
 java.util.List<VcsLabel> getLabels()
          VCS labels which were made by TeamCity for the build.
 SUser getOwner()
          If this build is personal one, returns the owner of this build.
 SFinishedBuild getPreviousFinished()
           
 DownloadedArtifacts getProvidedArtifacts()
          Returns information about provided artifacts, i.e.
 java.util.Date getQueuedDate()
          Returns the date when the build was added to queue.
 java.lang.String getRawBuildNumber()
          Returns raw build number (i.e.
 java.util.Collection<Issue> getRelatedIssues()
          Returns the collection of related issues (e.g.
 java.util.List<BuildRevision> getRevisions()
          List of all revisions which were used for the build instance
 java.util.Date getServerStartDate()
          Returns the timestamp when the build was removed from the queue.
 ShortStatistics getShortStatistics()
          Calculates short statistics for this build.
 java.math.BigDecimal getStatisticValue(java.lang.String valueTypeKey)
           
 java.util.Map<java.lang.String,java.math.BigDecimal> getStatisticValues()
           
 java.util.List<java.lang.String> getTags()
          Returns list of tags for this build
 TriggeredBy getTriggeredBy()
          Returns details about how this build was triggered.
 ValueResolver getValueResolver()
          Returns build-aware value resolver to be used to resolve values based on the build's properties.
 java.util.List<VcsRootInstanceEntry> getVcsRootEntries()
          Returns vcs roots with checkout rules for the build start moment.
 boolean hasBuildProblemOfType(java.lang.String type)
          Returns true if build has build problem of this type
 boolean isArtifactsExists()
          Returns true if this build has artifacts.
 boolean isHasInternalArtifactsOnly()
          Returns true if this build has only internal (hidden) artifacts.
 boolean isHasRelatedIssues()
          Returns whether the build has related issues (e.g.
 boolean isInternalError()
          Returns whether this build failed because of internal error (infrastructural error not related to build script).
 boolean isOutOfChangesSequence()
          Returns true if there is a build started before but having more recent changes then this build.
 boolean isPinned()
          Returns true if this build is pinned
 boolean isResponsibleNeeded()
          Always returns false for personal and/or cancelled builds.
 boolean isStartedOnAgent()
          Returns true if this build was started on agent.
 boolean isUsedByOtherBuilds()
          Returns true if this build is used by other builds, i.e.
 void muteBuildProblems(User user, boolean muteIfTrue, java.lang.String comment)
          Makes all existing build problems enabled or disabled
 void setBuildComment(User user, java.lang.String comment)
          Sets the comment for the build
 void setTags(java.util.List<java.lang.String> tags)
          Deprecated. Use setTags(User, List)
 void setTags(User user, java.util.List<java.lang.String> tags)
          Sets tags for this build
 
Methods inherited from interface jetbrains.buildServer.Build
getAgentName, getBuildId, getBuildNumber, getBuildStatus, getBuildTypeExternalId, getBuildTypeId, getBuildTypeName, getCanceledInfo, getCompilationErrorMessages, getDuration, getFinishDate, getFullName, getLogMessages, getProjectExternalId, getProjectId, getStartDate, getStatusDescriptor, getTestMessages, isFinished, isPersonal
 
Methods inherited from interface jetbrains.buildServer.serverSide.BuildPromotionOwner
getBuildPromotion, getSequenceBuild
 
Methods inherited from interface jetbrains.buildServer.serverSide.ParametersSupport
getParametersProvider
 

Method Detail

getArtifactsDirectory

@NotNull
java.io.File getArtifactsDirectory()
Returns artifacts directory of this build. Artifacts should be locked with help of ArtifactsGuard for the period of their processing.

Returns:
artifacts directory of this build
Throws:
BuildTypeNotFoundException - if build configuration of the build does not exist anymore

getArtifacts

@NotNull
BuildArtifacts getArtifacts(@NotNull
                                    BuildArtifactsViewMode mode)
Returns accessor for build artifacts. This accessor checks all necessary permissions for accessing files.

Parameters:
mode - view mode to see artifacts
Returns:
build artifacts viewer

getArtifactDependencies

@NotNull
java.util.List<SArtifactDependency> getArtifactDependencies()
Returns the artifact dependencies of this build. Same as getBuildPromotion().getArtifactDependencies().

Returns:
artifact dependencies

isArtifactsExists

boolean isArtifactsExists()
Returns true if this build has artifacts. Internal TeamCity artifacts are ignored.

Returns:
true if this build has artifacts
See Also:
ArtifactsConstants.TEAMCITY_ARTIFACTS_DIR, isHasInternalArtifactsOnly()

isHasInternalArtifactsOnly

boolean isHasInternalArtifactsOnly()
Returns true if this build has only internal (hidden) artifacts.

Returns:
true if this build has internal artifacts only
Since:
7.0
See Also:
isArtifactsExists()

isResponsibleNeeded

boolean isResponsibleNeeded()
Always returns false for personal and/or cancelled builds. Returns true if this build is failed (or failing) and there are no finished successful builds after this build. Returns true even if there is active responsible for the build configuration but the configuration status is failed.

Returns:
see above.

getBuildLog

@NotNull
BuildLog getBuildLog()
Returns build log.

Returns:
build log.

getShortStatistics

@NotNull
ShortStatistics getShortStatistics()
Calculates short statistics for this build. Short statistics provides "isNew" details for failed tests only. If you need information about passed, ignored tests and compilation errors use getBuildStatistics(jetbrains.buildServer.serverSide.BuildStatisticsOptions) method.

Returns:
short statistics for this build.

getFullStatistics

@NotNull
BuildStatistics getFullStatistics()
Calculates full statistics for this build. This method can be time consuming, if you do not need some parts of build statistics try to use method getBuildStatistics(BuildStatisticsOptions) instead.

Returns:
full statistics for this build.

getBuildStatistics

@NotNull
BuildStatistics getBuildStatistics(@NotNull
                                           BuildStatisticsOptions options)
Same as getFullStatistics() but with more control of data being loaded.

Parameters:
options - options
Returns:
build statistics according to specified options

getOwner

@Nullable
SUser getOwner()
If this build is personal one, returns the owner of this build.

Returns:
null if this build is not personal otherwise owner of this build
See Also:
Build.isPersonal()

getTriggeredBy

TriggeredBy getTriggeredBy()
Returns details about how this build was triggered.

Returns:
see above

getBuildType

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

Specified by:
getBuildType in interface Build
Returns:
build configuration descriptor.

getDownloadedArtifacts

@NotNull
DownloadedArtifacts getDownloadedArtifacts()
Returns information about artifacts downloaded by this build according to configured artifact dependencies.

Returns:
information about downloaded artifacts.

getProvidedArtifacts

@NotNull
DownloadedArtifacts getProvidedArtifacts()
Returns information about provided artifacts, i.e. artifacts that were downloaded from this build by other builds by artifact dependencies.

Returns:
see above

isUsedByOtherBuilds

boolean isUsedByOtherBuilds()
Returns true if this build is used by other builds, i.e. there are dependencies by sources on this build or artifacts of this build were downloaded by other builds.

Returns:
see above

getContainingChanges

@NotNull
java.util.List<SVcsModification> getContainingChanges()
Description copied from interface: Build
Returns changes in this build. Same as getChanges(SelectPrevBuildPolicy.SINCE_LAST_BUILD, false) Ordering: last detected modifications goes first in the list

Specified by:
getContainingChanges in interface Build
Returns:
changes in this build

getChanges

@NotNull
java.util.List<SVcsModification> getChanges(SelectPrevBuildPolicy policy,
                                                    boolean includeModificationsIfPreviousBuildIsAbsent)
Description copied from interface: Build
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

Specified by:
getChanges in interface Build
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

getCommitters

UserSet<SUser> getCommitters(SelectPrevBuildPolicy policy)
Description copied from interface: Build
Returns all users who made modifications since the previous build selected acoording to the speciifed policy.

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

isOutOfChangesSequence

boolean isOutOfChangesSequence()
Returns true if there is a build started before but having more recent changes then this build. Such situation can occur if this build was associated with a specific change list before adding to queue at the time when more recent changes were available.

Returns:
see above

getTags

java.util.List<java.lang.String> getTags()
Returns list of tags for this build

Returns:
tags

setTags

void setTags(java.util.List<java.lang.String> tags)
Deprecated. Use setTags(User, List)

Sets tags for this build

Parameters:
tags - tags to set

setTags

void setTags(User user,
             java.util.List<java.lang.String> tags)
Sets tags for this build

Parameters:
user - user who set tags
tags - tags to set
Since:
4.0.1

getFileContent

@NotNull
byte[] getFileContent(java.lang.String filePath)
                      throws VcsException
Get binary content of the single file related to this build.

Parameters:
filePath - - relative file path regarding to the project root, "checkout root" from vcs root should not be included
Returns:
- specified file content, corresponding to the build
Throws:
VcsException - if some problem occurred while getting file content from the source control repository.

getRevisions

java.util.List<BuildRevision> getRevisions()
List of all revisions which were used for the build instance

Returns:
all revisions which were used in this build

getLabels

java.util.List<VcsLabel> getLabels()
VCS labels which were made by TeamCity for the build. If label attempt failes VcsLabel status is FAILED and failureReason contains short description of the problem.

Returns:
VCS labels which were made by TeamCity for the build

getQueuedDate

@NotNull
java.util.Date getQueuedDate()
Returns the date when the build was added to queue.

Returns:
queued time.

getServerStartDate

@NotNull
java.util.Date getServerStartDate()
Returns the timestamp when the build was removed from the queue.

Returns:
the timestamp when the build was removed from the queue.

getVcsRootEntries

java.util.List<VcsRootInstanceEntry> getVcsRootEntries()
Returns vcs roots with checkout rules for the build start moment.

Returns:
vcs roots with checkout rules for the build start moment.

getClientStartDate

@Nullable
java.util.Date getClientStartDate()
Returns the timestamp when the build was started on the build agent (in agent time)

Returns:
the timestamp when the build was started on the build agent (in agent time)

isStartedOnAgent

boolean isStartedOnAgent()
Returns true if this build was started on agent.

Returns:
see above

convertToServerTime

@NotNull
java.util.Date convertToServerTime(@NotNull
                                           java.util.Date agentTime)
Converts agent time to server time by taking into account agent and server time difference.

Parameters:
agentTime - time on agent
Returns:
server time

convertToAgentTime

@NotNull
java.util.Date convertToAgentTime(@NotNull
                                          java.util.Date serverTime)
Converts server time to agent time by taking into account agent and server time difference.

Parameters:
serverTime - server time to convert
Returns:
agent time

getBuildDescription

@Nullable
java.lang.String getBuildDescription()
Returns build description set to this build explicitly or null.

Returns:
see above

getValueResolver

@NotNull
ValueResolver getValueResolver()
Returns build-aware value resolver to be used to resolve values based on the build's properties.

Specified by:
getValueResolver in interface ParametersSupport
Returns:
this build-aware value resolver

getBuildComment

@Nullable
Comment getBuildComment()
Returns build comment.

Returns:
build comment, or null if this build is not commented.

setBuildComment

void setBuildComment(@Nullable
                     User user,
                     @Nullable
                     java.lang.String comment)
Sets the comment for the build

Parameters:
user - user who sets the comment
comment - text of the comment

isPinned

boolean isPinned()
Returns true if this build is pinned

Returns:
true if this build is pinned

getRelatedIssues

@NotNull
java.util.Collection<Issue> getRelatedIssues()
Returns the collection of related issues (e.g. mentioned in modification's comments, or mentioned in the build's comment).

Returns:
related issues
Since:
5.0
See Also:
isHasRelatedIssues(), SVcsModification.getRelatedIssues()

isHasRelatedIssues

boolean isHasRelatedIssues()
Returns whether the build has related issues (e.g. mentioned in modification's comments, or mentioned in the build's comment).

Returns:
true if the build has related issues
Since:
7.0
See Also:
getRelatedIssues(), SVcsModification.isHasRelatedIssues()

getBuildOwnParameters

@NotNull
@Deprecated
java.util.Map<java.lang.String,java.lang.String> getBuildOwnParameters()
Deprecated. Use ParametersSupport

Returns map of parameters (configuration params, system properties and environment variables) excluding parameters provided by extensions.

Returns:
see above
Since:
5.0

getRawBuildNumber

java.lang.String getRawBuildNumber()
Returns raw build number (i.e. build number with unresolved parameters if they exist) in contradistinction to Build.getBuildNumber() method which will return build number with all unresolved parameters replaced with ???.

Returns:
raw build number which can contain unresolved parameters
Since:
5.0

isInternalError

boolean isInternalError()
Returns whether this build failed because of internal error (infrastructural error not related to build script).

Returns:
true iff the build is error
Since:
6.0

getFirstInternalError

@Nullable
java.lang.String getFirstInternalError()
Returns the first internal error in a build, or null.

Returns:
first internal error type
Since:
6.0

getFirstInternalErrorMessage

@Nullable
java.lang.String getFirstInternalErrorMessage()
Returns the error message associated with the first internal error, or null

Returns:
first internal error message
Since:
6.0

getClientTimeZone

@Nullable
java.util.TimeZone getClientTimeZone()
Returns agent machine time zone if it's available on server.

Returns:
Agent time zone or null if the build wasn't started yet.
Since:
7.0

getAgent

@NotNull
SBuildAgent getAgent()
Returns:
agent where this build executed.
Since:
7.0

addBuildProblem

void addBuildProblem(@NotNull
                     BuildProblemData buildProblem)
Adds build problem to the build. Currently build problem causes build failure.

Since:
7.1

hasBuildProblemOfType

boolean hasBuildProblemOfType(@NotNull
                              java.lang.String type)
Returns true if build has build problem of this type

Parameters:
type - build problem type
Returns:
see above
Since:
7.1
See Also:
BuildProblemData

getFailureReasons

@NotNull
java.util.List<BuildProblemData> getFailureReasons()
Returns build problems that caused build failure or empty list if build is successful

Returns:
see above
Since:
7.1

muteBuildProblems

void muteBuildProblems(@NotNull
                       User user,
                       boolean muteIfTrue,
                       @NotNull
                       java.lang.String comment)
Makes all existing build problems enabled or disabled

Parameters:
user - user that will be used in audit
muteIfTrue - pass true to make build successful, false to make existing problems visible again
comment - comment for audit
Since:
7.1

addUserBuildProblem

BuildProblemData addUserBuildProblem(@NotNull
                                     User user,
                                     @NotNull
                                     java.lang.String problemDesciption)
Adds user provided build problem to the build. Currently build problem causes build failure. Adding user provided problem always overrides previously added one

Parameters:
user - user that will be used in audit
Returns:
added build problem
Since:
7.1

getBranch

@Nullable
Branch getBranch()
Returns:
branch associated with this build or null.
Since:
7.1

getPreviousFinished

@Nullable
SFinishedBuild getPreviousFinished()
Returns:
returns previous finished build (ordered by changes).
Since:
7.1

getStatisticValue

@Nullable
java.math.BigDecimal getStatisticValue(java.lang.String valueTypeKey)
Parameters:
valueTypeKey - ValueType key to lookup. Eg TimeSpentInQueue, ArtifactsSize, DuplicatorStatsm CodeCoverageB, CodeCoverageC or any custom build statistic value reported by service message during the build.
Returns:
Value of specified ValueType. Null when specified value wasn't produced during the build (eg no artifacts produced for ArtifactsSize key) or key is invalid.
Since:
8.0
See Also:
ValueProviderRegistry

getStatisticValues

@NotNull
java.util.Map<java.lang.String,java.math.BigDecimal> getStatisticValues()
Returns:
All statistics values associated with this build. Includes all predefined ValueTypes reported for this build and custom metrics reported by service message during the build as well (even when there is no ValueType defined for the metric).
Since:
8.0