Package jetbrains.buildServer
Class MockBuild
- java.lang.Object
-
- jetbrains.buildServer.MockBuild
-
- All Implemented Interfaces:
Build,RunningBuild,BuildPromotionOwner,ParametersSupport,SBuild,SRunningBuild
public class MockBuild extends Object implements SRunningBuild
-
-
Constructor Summary
Constructors Constructor Description MockBuild()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBuildMessage(BuildMessage1 message)Adds new message from server to the build.voidaddBuildMessages(List<BuildMessage1> messages)Adds new server messages to the build.voidaddBuildProblem(BuildProblemData buildProblem)Adds build problem to the build.voidaddRemoteArtifact(RemoteArtifact artifact)Adds information about remote artifact to this buildBuildProblemDataaddUserBuildProblem(SUser user, String problemDesciption)Adds user provided build problem to the build.DateconvertToAgentTime(Date serverTime)Converts server time to agent time by taking into account agent and server time difference.DateconvertToServerTime(Date clientTime)Converts agent time to server time by taking into account agent and server time difference.voidfinish(Date finishDate)Finalizes all build related activities and finishes the build.SBuildAgentgetAgent()Get build agent this running build is running on.StringgetAgentAccessCode()Returns access code which can be used by agent to access server resources by HTTP.intgetAgentId()StringgetAgentName()Returns agent name where build is running or happened to run if finished.List<SArtifactDependency>getArtifactDependencies()Returns the artifact dependencies of this build.BuildArtifactsgetArtifacts(BuildArtifactsViewMode mode)Returns accessor for build artifacts.FilegetArtifactsDirectory()Returns artifacts directory of this build.BranchgetBranch()CommentgetBuildComment()Returns build comment.StringgetBuildDescription()Returns build description set to this build explicitly or null.Collection<SBuildFeatureDescriptor>getBuildFeaturesOfType(String featureType)Returns collection of enabled and resolved build features of specified type from build settings (resolving is performed at the moment of the method call).longgetBuildId()Returns build idBuildLoggetBuildLog()Returns build log.StringgetBuildNumber()Returns build number in the user defined format (unresolved parameters in build number will be replaced with '???').Map<String,String>getBuildOwnParameters()Returns map of parameters (configuration params, system properties and environment variables) excluding parameters provided by extensions.BuildPromotiongetBuildPromotion()Returns build promotionBuildStatisticsgetBuildStatistics(BuildStatisticsOptions options)Same asSBuild.getFullStatistics()but with more control of data being loaded.StatusgetBuildStatus()Returns current build statusSBuildTypegetBuildType()Returns build configuration this build belongs to.StringgetBuildTypeExternalId()Returns the build type external ID.StringgetBuildTypeId()Returns build configuration internal idStringgetBuildTypeName()Returns name of the build configuration this build belongs to.CanceledInfogetCanceledInfo()Returns info related to interrupted build.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 listDategetClientStartDate()Returns the timestamp when the build was started on the build agent (in agent time)TimeZonegetClientTimeZone()Returns agent machine time zone if it's available on server.UserSet<SUser>getCommitters(SelectPrevBuildPolicy selectPrevBuildPolicy)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 buildintgetCompletedPercent()List<SVcsModification>getContainingChanges()Returns changes in this build.StringgetCurrentPath()Returns short description of current running step.CustomDataStoragegetCustomDataStorage(String key)Returns a data storage which can be used to associate arbitrary data with the build.DownloadedArtifactsgetDownloadedArtifacts()Returns information about artifacts downloaded by this build according to configured artifact dependencies.longgetDuration()Returns current build duration in seconds.longgetDurationEstimate()Returns server estimation for this build duration in seconds.longgetDurationOvertime()Returns how much in seconds this build duration exceeded estimated duration.longgetElapsedTime()Returns elapsed time for this build.longgetEstimationForTimeLeft()Returns server estimation for this build remaining time.List<BuildProblemData>getFailureReasons()Returns build problems that caused build failure or empty list if build is successfulbyte[]getFileContent(String filePath)Get binary content of the single file related to this build.DategetFinishDate()Returns finish timestamp for the build (server time) ornullif it hasn't been finished yet.DategetFinishOnAgentDate()Returns timestamp when the build finished on agent (server time) ornullif it is still running on agent.StringgetFirstInternalError()Returns the first internal error in a build, or null.StringgetFirstInternalErrorMessage()Returns the error message associated with the first internal error, or nullStringgetFullName()BuildStatisticsgetFullStatistics()Calculates full statistics for this build.List<VcsLabel>getLabels()VCS labels which were made by TeamCity for the build.DategetLastBuildActivityTimestamp()List<String>getLogMessages(int skipMessages, int maxCount)Allows to get messages logged for the buildSUsergetOwner()If this build is personal one, returns the owner of this build.ParametersProvidergetParametersProvider()Returns parameters which can be used by value resolver.SFinishedBuildgetPreviousFinished()StringgetProjectExternalId()Returns external id of the project this build belongs to.StringgetProjectId()Returns internal id of the project this build belongs to.DownloadedArtifactsgetProvidedArtifacts()Returns information about provided artifacts, i.e.IntegergetQueuedAgentId()AgentRestrictorgetQueuedAgentRestrictor()Returns an agent restrictor this build was queued with (when build configuration was added to queue).DategetQueuedDate()Returns the date when the build was added to queue.StringgetRawBuildNumber()Returns raw build number (i.e.SFinishedBuildgetRecentlyFinishedBuild()Collection<Issue>getRelatedIssues()Returns the collection of related issues (e.g.List<RemoteArtifacts>getRemoteArtifacts()Returns list of all remote artifacts that were published for this build.RemoteArtifactsgetRemoteArtifactsByType(String type)Returns list of remote artifacts that belong to a specific type.List<BuildRevision>getRevisions()List of all revisions which were used for the build instanceSBuildgetSequenceBuild()If associated build promotion has modification id, returns the sequence build which contains the same changes as this build promotion.DategetServerStartDate()Returns the timestamp when the build was removed from the queue.ShortStatisticsgetShortStatistics()Calculates short statistics for this build.DategetStartDate()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 sentBigDecimalgetStatisticValue(String valueTypeKey)Map<String,BigDecimal>getStatisticValues()StatusDescriptorgetStatusDescriptor()Returns status descriptor of the buildList<String>getTags()Returns list of public tags for this buildList<TestInfo>getTestMessages(int skipTests, int maxTestsToLoad)Retrieves information about tests failed in the build.longgetTimeSpentSinceLastBuildActivity()Returns time in seconds spent since last build activity.TriggeredBygetTriggeredBy()Returns details about how this build was triggered.ValueResolvergetValueResolver()Returns build-aware value resolver to be used to resolve values based on the build's properties.List<VcsRootInstanceEntry>getVcsRootEntries()Returns vcs roots with checkout rules for the build start moment.Map<String,Long>getWaitReasons()Returns wait reasons for this build, while it was in the build queue.booleanhasBuildProblemOfType(String type)Returns true if build has build problem of this typebooleanhasTests()booleanisAgentLessBuild()booleanisArtifactsExists()Returns true if this build has artifacts.booleanisCompositeBuild()Returns true if this build is a composite build.booleanisDetachedFromAgent()Returns true if this build was detached from agent at some point.booleanisFinished()booleanisHasInternalArtifactsOnly()Returns true if this build has only internal (hidden) artifacts.booleanisHasRelatedIssues()Returns whether the build has related issues (e.g.booleanisInternalError()Returns whether this build failed because of internal error (infrastructural error not related to build script).booleanisInterrupted()When processing buildFinished event, returns true if build was finished unexpectedly (for instance, killed)booleanisOutdated()Returns true if this build is outdated.booleanisOutOfChangesSequence()Returns true if there is a build started before but having more recent changes then this build.booleanisPersonal()Returns if this build has been run to test personal changesbooleanisPinned()Returns true if this build is pinnedbooleanisProbablyHanging()Returns true if server thinks this build has hung.booleanisResponsibleNeeded()Always returns false for personal and/or cancelled builds.booleanisStartedOnAgent()Returns true if this build was started on agent.booleanisUsedByOtherBuilds()Returns true if this build is used by other builds, i.e.voidmuteBuildProblems(SUser user, boolean muteIfTrue, String comment)Makes all existing build problems enabled or disabledvoidsetBuildAgent(SBuildAgent buildAgent)voidsetBuildComment(User user, String comment)Sets the comment for the buildvoidsetBuildNumber(String newBuildNumber)Set new value for this build build number instead of current one.voidsetBuildStatus(Status status)Set current status of the running build.voidsetCustomDataStorage(String key, CustomDataStorage storage)voidsetDurationOvertime(long durationOvertime)voidsetInterrupted(RunningBuildState state, User user, String reason)Mark this build as interrupted.voidsetTags(List<String> strings)Sets public tags for this buildvoidsetTags(User user, List<String> strings)Sets public tags for this buildvoidstop(User user, String comment)Stops the build.
-
-
-
Method Detail
-
getBuildId
public long getBuildId()
Description copied from interface:BuildReturns build id- Specified by:
getBuildIdin interfaceBuild- Returns:
- Unique build id
-
getStartDate
@NotNull public Date getStartDate()
Description copied from interface:BuildReturns 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- Specified by:
getStartDatein interfaceBuild- Returns:
- see above
-
getFinishDate
public Date getFinishDate()
Description copied from interface:BuildReturns finish timestamp for the build (server time) ornullif it hasn't been finished yet.- Specified by:
getFinishDatein interfaceBuild- Returns:
- Date/time when the build has been finished,
nullif still running.
-
isPinned
public boolean isPinned()
Description copied from interface:SBuildReturns true if this build is pinned
-
hasTests
public boolean hasTests()
-
getArtifacts
@NotNull public BuildArtifacts getArtifacts(@NotNull BuildArtifactsViewMode mode)
Description copied from interface:SBuildReturns accessor for build artifacts. This accessor checks all necessary permissions for accessing files.- Specified by:
getArtifactsin interfaceSBuild- Parameters:
mode- view mode to see artifacts- Returns:
- build artifacts viewer
-
getRelatedIssues
@NotNull public Collection<Issue> getRelatedIssues()
Description copied from interface:SBuildReturns the collection of related issues (e.g. mentioned in modification's comments, or mentioned in the build's comment).- Specified by:
getRelatedIssuesin interfaceSBuild- Returns:
- related issues
- See Also:
SBuild.isHasRelatedIssues(),SVcsModification.getRelatedIssues()
-
isHasRelatedIssues
public boolean isHasRelatedIssues()
Description copied from interface:SBuildReturns whether the build has related issues (e.g. mentioned in modification's comments, or mentioned in the build's comment).- Specified by:
isHasRelatedIssuesin interfaceSBuild- Returns:
- true if the build has related issues
- See Also:
SBuild.getRelatedIssues(),SVcsModification.isHasRelatedIssues()
-
getBuildOwnParameters
@NotNull public Map<String,String> getBuildOwnParameters()
Description copied from interface:SBuildReturns map of parameters (configuration params, system properties and environment variables) excluding parameters provided by extensions.- Specified by:
getBuildOwnParametersin interfaceSBuild- Returns:
- see above
-
getRawBuildNumber
public String getRawBuildNumber()
Description copied from interface:SBuildReturns raw build number (i.e. build number with unresolved parameters if they exist) in contradistinction toBuild.getBuildNumber()method which will return build number with all unresolved parameters replaced with ???.- Specified by:
getRawBuildNumberin interfaceSBuild- Returns:
- raw build number which can contain unresolved parameters
-
isInternalError
public boolean isInternalError()
Description copied from interface:SBuildReturns whether this build failed because of internal error (infrastructural error not related to build script).- Specified by:
isInternalErrorin interfaceSBuild- Returns:
- true iff the build is error
-
getFirstInternalError
public String getFirstInternalError()
Description copied from interface:SBuildReturns the first internal error in a build, or null.- Specified by:
getFirstInternalErrorin interfaceSBuild- Returns:
- first internal error type
-
getFirstInternalErrorMessage
public String getFirstInternalErrorMessage()
Description copied from interface:SBuildReturns the error message associated with the first internal error, or null- Specified by:
getFirstInternalErrorMessagein interfaceSBuild- Returns:
- first internal error message
-
getBuildTypeId
@NotNull public String getBuildTypeId()
Description copied from interface:BuildReturns build configuration internal id- Specified by:
getBuildTypeIdin interfaceBuild- Returns:
- ID of the configuration this build belongs to.
-
getBuildTypeExternalId
@NotNull public String getBuildTypeExternalId()
Description copied from interface:BuildReturns 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_IDvalue is returned.- Specified by:
getBuildTypeExternalIdin interfaceBuild- Returns:
- build type external ID
-
setBuildNumber
public void setBuildNumber(@NotNull String newBuildNumber)Description copied from interface:SRunningBuildSet new value for this build build number instead of current one. If newBuildNumber has pattern {build.number}, it is replaced with the current build number- Specified by:
setBuildNumberin interfaceSRunningBuild- Parameters:
newBuildNumber- new value for this build build number
-
getTriggeredBy
@NotNull public TriggeredBy getTriggeredBy()
Description copied from interface:SBuildReturns details about how this build was triggered.- Specified by:
getTriggeredByin interfaceSBuild- Returns:
- see above
-
getBuildLog
@NotNull public BuildLog getBuildLog()
Description copied from interface:SBuildReturns build log.- Specified by:
getBuildLogin interfaceSBuild- Returns:
- build log.
-
getShortStatistics
@NotNull public ShortStatistics getShortStatistics()
Description copied from interface:SBuildCalculates 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 useSBuild.getBuildStatistics(jetbrains.buildServer.serverSide.BuildStatisticsOptions)method.- Specified by:
getShortStatisticsin interfaceSBuild- Returns:
- short statistics for this build.
-
getSequenceBuild
public SBuild getSequenceBuild()
Description copied from interface:BuildPromotionOwnerIf associated build promotion has modification id, returns the sequence build which contains the same changes as this build promotion. I.e. returns the first build, which contains all the changes from associated build promotion. If associated build promotion already in changes sequence, returnsBuildPromotion.getAssociatedBuild()- Specified by:
getSequenceBuildin interfaceBuildPromotionOwner- Returns:
- sequence build for the same changes as for associated build promotion, or null if there are no such a build
-
getFullStatistics
@NotNull public BuildStatistics getFullStatistics()
Description copied from interface:SBuildCalculates full statistics for this build. This method can be time consuming, if you do not need some parts of build statistics try to use methodSBuild.getBuildStatistics(BuildStatisticsOptions)instead.- Specified by:
getFullStatisticsin interfaceSBuild- Returns:
- full statistics for this build.
-
getBuildStatistics
@NotNull public BuildStatistics getBuildStatistics(@NotNull BuildStatisticsOptions options)
Description copied from interface:SBuildSame asSBuild.getFullStatistics()but with more control of data being loaded.- Specified by:
getBuildStatisticsin interfaceSBuild- Parameters:
options- options- Returns:
- build statistics according to specified options
-
getArtifactsDirectory
@NotNull public File getArtifactsDirectory()
Description copied from interface:SBuildReturns artifacts directory of this build. Artifacts should be locked with help ofArtifactsGuardfor the period of their processing.- Specified by:
getArtifactsDirectoryin interfaceSBuild- Returns:
- artifacts directory of this build
-
getArtifactDependencies
@NotNull public List<SArtifactDependency> getArtifactDependencies()
Description copied from interface:SBuildReturns the artifact dependencies of this build. Same as getBuildPromotion().getArtifactDependencies().- Specified by:
getArtifactDependenciesin interfaceSBuild- Returns:
- artifact dependencies
-
isArtifactsExists
public boolean isArtifactsExists()
Description copied from interface:SBuildReturns true if this build has artifacts. Internal TeamCity artifacts are ignored.- Specified by:
isArtifactsExistsin interfaceSBuild- Returns:
- true if this build has artifacts
- See Also:
ArtifactsConstants.TEAMCITY_ARTIFACTS_DIR,SBuild.isHasInternalArtifactsOnly()
-
isHasInternalArtifactsOnly
public boolean isHasInternalArtifactsOnly()
Description copied from interface:SBuildReturns true if this build has only internal (hidden) artifacts.- Specified by:
isHasInternalArtifactsOnlyin interfaceSBuild- Returns:
- true if this build has internal artifacts only
- See Also:
SBuild.isArtifactsExists()
-
addRemoteArtifact
public void addRemoteArtifact(@NotNull RemoteArtifact artifact)Description copied from interface:SRunningBuildAdds information about remote artifact to this build- Specified by:
addRemoteArtifactin interfaceSRunningBuild- See Also:
SBuild.getRemoteArtifacts()
-
getRemoteArtifacts
@NotNull public List<RemoteArtifacts> getRemoteArtifacts()
Description copied from interface:SBuildReturns list of all remote artifacts that were published for this build.- Specified by:
getRemoteArtifactsin interfaceSBuild- Returns:
- collection of
RemoteArtifact
-
getRemoteArtifactsByType
@NotNull public RemoteArtifacts getRemoteArtifactsByType(@NotNull String type)
Description copied from interface:SBuildReturns list of remote artifacts that belong to a specific type.- Specified by:
getRemoteArtifactsByTypein interfaceSBuild- Returns:
- collection of
RemoteArtifact
-
getWaitReasons
@NotNull public Map<String,Long> getWaitReasons()
Description copied from interface:SBuildReturns wait reasons for this build, while it was in the build queue. The key of the map is a wait reason description in human friendly form. The value is amount of milliseconds this wait reason was reported for this queued build.- Specified by:
getWaitReasonsin interfaceSBuild- Returns:
- map of a wait reason to amount of time it was reported for the build in milliseconds
-
isResponsibleNeeded
public boolean isResponsibleNeeded()
Description copied from interface:SBuildAlways 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.- Specified by:
isResponsibleNeededin interfaceSBuild- Returns:
- see above.
-
getStatusDescriptor
public StatusDescriptor getStatusDescriptor()
Description copied from interface:BuildReturns status descriptor of the build- Specified by:
getStatusDescriptorin interfaceBuild- Returns:
- Descriptor of the current status of the build
-
getBuildType
public SBuildType getBuildType()
Description copied from interface:SBuildReturns build configuration this build belongs to.- Specified by:
getBuildTypein interfaceBuild- Specified by:
getBuildTypein interfaceSBuild- Returns:
- build configuration descriptor.
-
getDownloadedArtifacts
@NotNull public DownloadedArtifacts getDownloadedArtifacts()
Description copied from interface:SBuildReturns information about artifacts downloaded by this build according to configured artifact dependencies.- Specified by:
getDownloadedArtifactsin interfaceSBuild- Returns:
- information about downloaded artifacts.
-
getProvidedArtifacts
@NotNull public DownloadedArtifacts getProvidedArtifacts()
Description copied from interface:SBuildReturns information about provided artifacts, i.e. artifacts that were downloaded from this build by other builds by artifact dependencies.- Specified by:
getProvidedArtifactsin interfaceSBuild- Returns:
- see above
-
isUsedByOtherBuilds
public boolean isUsedByOtherBuilds()
Description copied from interface:SBuildReturns 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.- Specified by:
isUsedByOtherBuildsin interfaceSBuild- Returns:
- see above
-
getBuildNumber
@NotNull public String getBuildNumber()
Description copied from interface:BuildReturns build number in the user defined format (unresolved parameters in build number will be replaced with '???').- Specified by:
getBuildNumberin interfaceBuild- Returns:
- presentable build number
-
getFullName
@NotNull public String getFullName()
- Specified by:
getFullNamein interfaceBuild- Returns:
- full name of the build configuration this build belongs to, has form "project_name :: buildconfig_name"
-
getProjectId
public String getProjectId()
Description copied from interface:BuildReturns internal id of the project this build belongs to. Same as getBuildType().getProjectId().- Specified by:
getProjectIdin interfaceBuild- Returns:
- internal id of the project this build belongs to. Same as getBuildType().getProjectId().
-
getProjectExternalId
public String getProjectExternalId()
Description copied from interface:BuildReturns external id of the project this build belongs to. Same as getBuildType().getProjectId().- Specified by:
getProjectExternalIdin interfaceBuild- Returns:
- external id of the project this build belongs to. Same as getBuildType().getProjectId().
-
getAgentName
@NotNull public String getAgentName()
Description copied from interface:BuildReturns agent name where build is running or happened to run if finished.- Specified by:
getAgentNamein interfaceBuild- Returns:
- Agent name where build has been started on
-
getBuildTypeName
@NotNull public String getBuildTypeName()
Description copied from interface:BuildReturns name of the build configuration this build belongs to.- Specified by:
getBuildTypeNamein interfaceBuild- Returns:
- name of the build configuration this build belongs to.
-
getContainingChanges
@NotNull public List<SVcsModification> getContainingChanges()
Description copied from interface:BuildReturns changes in this build. Same as getChanges(SelectPrevBuildPolicy.SINCE_LAST_BUILD, false) Ordering: last detected modifications goes first in the list- Specified by:
getContainingChangesin interfaceBuild- Specified by:
getContainingChangesin interfaceSBuild- Returns:
- changes in this build
-
getLogMessages
public List<String> getLogMessages(int skipMessages, int maxCount)
Description copied from interface:BuildAllows to get messages logged for the build- Specified by:
getLogMessagesin interfaceBuild- Parameters:
skipMessages- index of the first message to load (zero based)maxCount- messages count limit.- Returns:
- list of plain messages
-
getTestMessages
public List<TestInfo> getTestMessages(int skipTests, int maxTestsToLoad)
Description copied from interface:BuildRetrieves information about tests failed in the build. Note that for running build currently executing test will be added to the list too.- Specified by:
getTestMessagesin interfaceBuild- Parameters:
skipTests- 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
public List<String> getCompilationErrorMessages()
Description copied from interface:BuildReturns compilation error messages of this build- Specified by:
getCompilationErrorMessagesin interfaceBuild- Returns:
- list of plain messages
-
isPersonal
public boolean isPersonal()
Description copied from interface:BuildReturns if this build has been run to test personal changes- Specified by:
isPersonalin interfaceBuild- Returns:
- true is the build has been started as personal, and its changes were not committed to the VCS
-
getOwner
@Nullable public SUser getOwner()
Description copied from interface:SBuildIf this build is personal one, returns the owner of this build.- Specified by:
getOwnerin interfaceSBuild- Returns:
- null if this build is not personal otherwise owner of this build
- See Also:
Build.isPersonal()
-
getBuildStatus
public Status getBuildStatus()
Description copied from interface:BuildReturns current build status- Specified by:
getBuildStatusin interfaceBuild- Returns:
- Current build status
-
isFinished
public boolean isFinished()
- Specified by:
isFinishedin interfaceBuild- Returns:
- true if the build was finished and was saved to the history
-
setBuildStatus
public void setBuildStatus(Status status)
Description copied from interface:SRunningBuildSet current status of the running build. Useful before build finish to update build status.- Specified by:
setBuildStatusin interfaceSRunningBuild- Parameters:
status- new status of the build
-
getChanges
@NotNull public List<SVcsModification> getChanges(@NotNull SelectPrevBuildPolicy policy, boolean includeModificationsIfPreviousBuildIsAbsent)
Description copied from interface:BuildList 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:
getChangesin interfaceBuild- Specified by:
getChangesin interfaceSBuild- 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
-
getCommitters
public UserSet<SUser> getCommitters(@NotNull SelectPrevBuildPolicy selectPrevBuildPolicy)
Description copied from interface:BuildReturns 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.changesLoadedevent for the build) and will only return users with matching VCS usernames set.- Specified by:
getCommittersin interfaceBuild- Specified by:
getCommittersin interfaceSBuild- Parameters:
selectPrevBuildPolicy- 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
-
isOutOfChangesSequence
public boolean isOutOfChangesSequence()
Description copied from interface:SBuildReturns 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.- Specified by:
isOutOfChangesSequencein interfaceSBuild- Returns:
- see above
-
addBuildMessage
public void addBuildMessage(@NotNull BuildMessage1 message)Description copied from interface:SRunningBuildAdds new message from server to the build.- Specified by:
addBuildMessagein interfaceSRunningBuild
-
getBuildDescription
public String getBuildDescription()
Description copied from interface:SBuildReturns build description set to this build explicitly or null.- Specified by:
getBuildDescriptionin interfaceSBuild- Returns:
- see above
-
getParametersProvider
@NotNull public ParametersProvider getParametersProvider()
Description copied from interface:ParametersSupportReturns parameters which can be used by value resolver. Note that some of the parameters may not have values defined because sometimes values can be calculated on the agent side only.- Specified by:
getParametersProviderin interfaceParametersSupport- Returns:
- parameters
-
getValueResolver
@NotNull public ValueResolver getValueResolver()
Description copied from interface:SBuildReturns build-aware value resolver to be used to resolve values based on the build's properties.- Specified by:
getValueResolverin interfaceParametersSupport- Specified by:
getValueResolverin interfaceSBuild- Returns:
- this build-aware value resolver
-
getAgent
@NotNull public SBuildAgent getAgent()
Description copied from interface:SRunningBuildGet build agent this running build is running on. May be unregistered or even dead agent, but never null.- Specified by:
getAgentin interfaceSBuild- Specified by:
getAgentin interfaceSRunningBuild- Returns:
- see above
-
getAgentId
public int getAgentId()
- Specified by:
getAgentIdin interfaceSRunningBuild- Returns:
- id of the agent where this build is running; returns -1 for agent less builds
-
setBuildAgent
public void setBuildAgent(SBuildAgent buildAgent)
-
getQueuedAgentId
@Nullable public Integer getQueuedAgentId()
- Specified by:
getQueuedAgentIdin interfaceSRunningBuild- Returns:
- agent this build was queued on or null if build was not queued on a specific agent
-
getQueuedAgentRestrictor
@Nullable public AgentRestrictor getQueuedAgentRestrictor()
Description copied from interface:SRunningBuildReturns an agent restrictor this build was queued with (when build configuration was added to queue). Returns null if build was not queued on a specific agent / agent set.- Specified by:
getQueuedAgentRestrictorin interfaceSRunningBuild- Returns:
- see above
-
getCompletedPercent
public int getCompletedPercent()
- Specified by:
getCompletedPercentin interfaceSRunningBuild- Returns:
- completed percentage for the build according to build duration estimated time. or -1 if there is no estimate
-
getClientStartDate
@Nullable public Date getClientStartDate()
Description copied from interface:SBuildReturns the timestamp when the build was started on the build agent (in agent time)- Specified by:
getClientStartDatein interfaceSBuild- Returns:
- the timestamp when the build was started on the build agent (in agent time)
-
isStartedOnAgent
public boolean isStartedOnAgent()
Description copied from interface:SBuildReturns true if this build was started on agent.- Specified by:
isStartedOnAgentin interfaceSBuild- Returns:
- see above
-
convertToServerTime
@NotNull public Date convertToServerTime(@NotNull Date clientTime)
Description copied from interface:SBuildConverts agent time to server time by taking into account agent and server time difference.- Specified by:
convertToServerTimein interfaceSBuild- Parameters:
clientTime- time on agent- Returns:
- server time
-
convertToAgentTime
@NotNull public Date convertToAgentTime(@NotNull Date serverTime)
Description copied from interface:SBuildConverts server time to agent time by taking into account agent and server time difference.- Specified by:
convertToAgentTimein interfaceSBuild- Parameters:
serverTime- server time to convert- Returns:
- agent time
-
getCurrentPath
public String getCurrentPath()
Description copied from interface:SRunningBuildReturns short description of current running step.- Specified by:
getCurrentPathin interfaceSRunningBuild- Returns:
- short description of current running step.
-
getServerStartDate
@NotNull public Date getServerStartDate()
Description copied from interface:SBuildReturns the timestamp when the build was removed from the queue.- Specified by:
getServerStartDatein interfaceSBuild- Returns:
- the timestamp when the build was removed from the queue.
-
isInterrupted
public boolean isInterrupted()
Description copied from interface:SRunningBuildWhen processing buildFinished event, returns true if build was finished unexpectedly (for instance, killed)- Specified by:
isInterruptedin interfaceSRunningBuild- Returns:
- true or false
-
getEstimationForTimeLeft
public long getEstimationForTimeLeft()
Description copied from interface:RunningBuildReturns server estimation for this build remaining time.- Specified by:
getEstimationForTimeLeftin interfaceRunningBuild- Returns:
- estimation for time left to finish the build in seconds or -1 if estimate is not available.
-
getDurationEstimate
public long getDurationEstimate()
Description copied from interface:RunningBuildReturns server estimation for this build duration in seconds.- Specified by:
getDurationEstimatein interfaceRunningBuild- Returns:
- build duration estimation in seconds or -1 if estimate is not available.
-
getDurationOvertime
public long getDurationOvertime()
Description copied from interface:RunningBuildReturns how much in seconds this build duration exceeded estimated duration.- Specified by:
getDurationOvertimein interfaceRunningBuild- Returns:
- how much in seconds this build duration exceeded estimated duration or -1 if estimate is not available.
-
setDurationOvertime
public void setDurationOvertime(long durationOvertime)
-
getElapsedTime
public long getElapsedTime()
Description copied from interface:RunningBuildReturns elapsed time for this build.- Specified by:
getElapsedTimein interfaceRunningBuild- Returns:
- elapsed time for this build in seconds.
-
getCanceledInfo
public CanceledInfo getCanceledInfo()
Description copied from interface:BuildReturns info related to interrupted build. If build is finished, not interrupted, the value is null.- Specified by:
getCanceledInfoin interfaceBuild- Returns:
- info about canceled reason and canceler if build was actually interrupted, null otherwise.
-
getDuration
public long getDuration()
Description copied from interface:BuildReturns 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- Specified by:
getDurationin interfaceBuild- Returns:
- current build duration in seconds
-
setInterrupted
public void setInterrupted(@NotNull RunningBuildState state, User user, String reason)Description copied from interface:SRunningBuildMark this build as interrupted.- Specified by:
setInterruptedin interfaceSRunningBuild- Parameters:
state- running build stateuser- user who initiated interruption or nullreason- reason why interruption initiated or null
-
getAgentAccessCode
public String getAgentAccessCode()
Description copied from interface:SRunningBuildReturns access code which can be used by agent to access server resources by HTTP.- Specified by:
getAgentAccessCodein interfaceSRunningBuild- Returns:
- access code
-
isProbablyHanging
public boolean isProbablyHanging()
Description copied from interface:SRunningBuildReturns true if server thinks this build has hung. The build is considered hung if its estimate is exceeded and there were no messages from this build for some time.- Specified by:
isProbablyHangingin interfaceSRunningBuild- Returns:
- true if build is probably hanging
-
getLastBuildActivityTimestamp
public Date getLastBuildActivityTimestamp()
- Specified by:
getLastBuildActivityTimestampin interfaceSRunningBuild- Returns:
- timestamp of last message received from a build.
-
getTimeSpentSinceLastBuildActivity
public long getTimeSpentSinceLastBuildActivity()
Description copied from interface:SRunningBuildReturns time in seconds spent since last build activity.- Specified by:
getTimeSpentSinceLastBuildActivityin interfaceSRunningBuild- Returns:
- time in seconds
-
getTags
public List<String> getTags()
Description copied from interface:SBuildReturns list of public tags for this build
-
setTags
public void setTags(List<String> strings)
Description copied from interface:SBuildSets public tags for this build
-
setTags
public void setTags(User user, List<String> strings)
Description copied from interface:SBuildSets public tags for this build
-
getFileContent
@NotNull public byte[] getFileContent(String filePath) throws VcsException
Description copied from interface:SBuildGet binary content of the single file related to this build.- Specified by:
getFileContentin interfaceSBuild- 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.
-
stop
public void stop(User user, String comment)
Description copied from interface:SRunningBuildStops the build. If this is a user action, user who performs this action must be specified. If build is stopped without user it will be considered crashed and can be re-added into the queue.- Specified by:
stopin interfaceSRunningBuild- Parameters:
user- user who stopped build or nullcomment- comment for the action or null
-
getRevisions
@NotNull public List<BuildRevision> getRevisions()
Description copied from interface:SBuildList of all revisions which were used for the build instance- Specified by:
getRevisionsin interfaceSBuild- Returns:
- all revisions which were used in this build
-
getLabels
public List<VcsLabel> getLabels()
Description copied from interface:SBuildVCS labels which were made by TeamCity for the build. If label attempt fails VcsLabel status is FAILED and failureReason contains short description of the problem.
-
getQueuedDate
@NotNull public Date getQueuedDate()
Description copied from interface:SBuildReturns the date when the build was added to queue.- Specified by:
getQueuedDatein interfaceSBuild- Returns:
- queued time.
-
getVcsRootEntries
public List<VcsRootInstanceEntry> getVcsRootEntries()
Description copied from interface:SBuildReturns vcs roots with checkout rules for the build start moment.- Specified by:
getVcsRootEntriesin interfaceSBuild- Returns:
- vcs roots with checkout rules for the build start moment.
-
addBuildMessages
public void addBuildMessages(@NotNull List<BuildMessage1> messages)Description copied from interface:SRunningBuildAdds new server messages to the build.- Specified by:
addBuildMessagesin interfaceSRunningBuild- Parameters:
messages- new build messages.
-
getBuildPromotion
@NotNull public BuildPromotion getBuildPromotion()
Description copied from interface:BuildPromotionOwnerReturns build promotion- Specified by:
getBuildPromotionin interfaceBuildPromotionOwner- Returns:
- see above.
-
getBuildComment
public Comment getBuildComment()
Description copied from interface:SBuildReturns build comment.- Specified by:
getBuildCommentin interfaceSBuild- Returns:
- build comment, or null if this build is not commented.
-
setBuildComment
public void setBuildComment(@Nullable User user, @Nullable String comment)Description copied from interface:SBuildSets the comment for the build- Specified by:
setBuildCommentin interfaceSBuild- Parameters:
user- user who sets the commentcomment- text of the comment
-
isOutdated
public boolean isOutdated()
Description copied from interface:SBuildReturns true if this build is outdated. The build is considered outdated if there is a finished non-personal build which contains newer (or same) changes as contained in this build.- Specified by:
isOutdatedin interfaceSBuild- Returns:
- see above
-
getRecentlyFinishedBuild
public SFinishedBuild getRecentlyFinishedBuild()
- Specified by:
getRecentlyFinishedBuildin interfaceSBuild- Returns:
- the build because of which this running build has been marked as outdated (see
SBuild.isOutdated()).
-
isAgentLessBuild
public boolean isAgentLessBuild()
- Specified by:
isAgentLessBuildin interfaceSBuild- Returns:
- true if this build does not require an agent (for now this is true for composite builds only)
-
isDetachedFromAgent
public boolean isDetachedFromAgent()
Description copied from interface:SBuildReturns true if this build was detached from agent at some point.- Specified by:
isDetachedFromAgentin interfaceSBuild- Returns:
- see above
-
getFinishOnAgentDate
@Nullable public Date getFinishOnAgentDate()
Description copied from interface:SBuildReturns timestamp when the build finished on agent (server time) ornullif it is still running on agent.- Specified by:
getFinishOnAgentDatein interfaceSBuild- Returns:
- see above
-
getCustomDataStorage
@NotNull public CustomDataStorage getCustomDataStorage(@NotNull String key)
Description copied from interface:SBuildReturns a data storage which can be used to associate arbitrary data with the build.- Specified by:
getCustomDataStoragein interfaceSBuild- Parameters:
key- a key to access the storage- Returns:
- an existing or newly created storage for the given key
-
setCustomDataStorage
public void setCustomDataStorage(@NotNull String key, CustomDataStorage storage)
-
isCompositeBuild
public boolean isCompositeBuild()
Description copied from interface:SBuildReturns true if this build is a composite build.- Specified by:
isCompositeBuildin interfaceSBuild- Returns:
- see above
-
getClientTimeZone
public TimeZone getClientTimeZone()
Description copied from interface:SBuildReturns agent machine time zone if it's available on server.- Specified by:
getClientTimeZonein interfaceSBuild- Returns:
- Agent time zone or null if the build wasn't started yet.
-
addBuildProblem
public void addBuildProblem(@NotNull BuildProblemData buildProblem)Description copied from interface:SBuildAdds build problem to the build. Currently build problem causes build failure.- Specified by:
addBuildProblemin interfaceSBuild
-
hasBuildProblemOfType
public boolean hasBuildProblemOfType(@NotNull String type)Description copied from interface:SBuildReturns true if build has build problem of this type- Specified by:
hasBuildProblemOfTypein interfaceSBuild- Parameters:
type- build problem type- Returns:
- see above
- See Also:
BuildProblemData
-
getFailureReasons
@NotNull public List<BuildProblemData> getFailureReasons()
Description copied from interface:SBuildReturns build problems that caused build failure or empty list if build is successful- Specified by:
getFailureReasonsin interfaceSBuild- Returns:
- see above
-
muteBuildProblems
public void muteBuildProblems(@NotNull SUser user, boolean muteIfTrue, @NotNull String comment)Description copied from interface:SBuildMakes all existing build problems enabled or disabled- Specified by:
muteBuildProblemsin interfaceSBuild- Parameters:
user- user that will be used in auditmuteIfTrue- pass true to make build successful, false to make existing problems visible againcomment- comment for audit
-
addUserBuildProblem
public BuildProblemData addUserBuildProblem(@NotNull SUser user, @NotNull String problemDesciption)
Description copied from interface:SBuildAdds user provided build problem to the build. Currently build problem causes build failure. Adding user provided problem always overrides previously added one- Specified by:
addUserBuildProblemin interfaceSBuild- Parameters:
user- user that will be used in audit- Returns:
- added build problem
-
getBranch
public Branch getBranch()
-
getPreviousFinished
public SFinishedBuild getPreviousFinished()
- Specified by:
getPreviousFinishedin interfaceSBuild- Returns:
- returns previous finished build (ordered by changes). If this build is personal, this method can return previous personal build, otherwise only regular builds are returned.
-
getStatisticValue
public BigDecimal getStatisticValue(String valueTypeKey)
- Specified by:
getStatisticValuein interfaceSBuild- Parameters:
valueTypeKey- ValueType key to lookup. Eg TimeSpentInQueue, ArtifactsSize, DuplicatorStats 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.
- See Also:
ValueProviderRegistry
-
getStatisticValues
@NotNull public Map<String,BigDecimal> getStatisticValues()
- Specified by:
getStatisticValuesin interfaceSBuild- 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).
-
getBuildFeaturesOfType
@NotNull public Collection<SBuildFeatureDescriptor> getBuildFeaturesOfType(@NotNull String featureType)
Description copied from interface:SBuildReturns collection of enabled and resolved build features of specified type from build settings (resolving is performed at the moment of the method call).- Specified by:
getBuildFeaturesOfTypein interfaceSBuild- Parameters:
featureType- type of the build feature- Returns:
- see above
-
finish
public void finish(@NotNull Date finishDate)Description copied from interface:SRunningBuildFinalizes all build related activities and finishes the build. Build must be finished on agent. Takes no effect for already finished or interrupted builds.- Specified by:
finishin interfaceSRunningBuild- Parameters:
finishDate- finish date
-
-