Class RunningBuildWrapper
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.RunningBuildWrapper
-
- All Implemented Interfaces:
Build
,RunningBuild
,RunningBuildInfo
,BuildEx
,BuildPromotionOwner
,ParametersSupport
,RunningBuildEx
,SBuild
,SRunningBuild
public class RunningBuildWrapper extends Object implements RunningBuildEx, BuildEx
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.serverSide.RunningBuildEx
DEPENDENCIES_SKIP_ENABLED
-
-
Constructor Summary
Constructors Constructor Description RunningBuildWrapper(FinishedBuildEx finishedBuild)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addBuildMessage(BuildMessage1 message)
Adds new message from server to the build.void
addBuildMessages(List<BuildMessage1> messages)
Adds new server messages to the build.void
addBuildProblem(BuildProblemData buildProblem)
Adds build problem to the build.void
addRemoteArtifact(RemoteArtifact artifact)
Adds information about remote artifact to this buildBuildProblemData
addUserBuildProblem(SUser user, String problemDescription)
Adds user provided build problem to the build.void
buildPatch(OutputStream stream, FullCheckoutFlag fullCheckoutFlag, boolean personalChanges, AgentCheckoutDirRevisionInfo workDirState)
void
buildPersonalPatch(OutputStream stream, long personalChangeId, AgentCheckoutDirRevisionInfo workDirState)
void
buildProblemsChanged(List<BuildProblemData> before, List<BuildProblemData> after)
Called when build problems are changed (added, deleted or muted)void
closeBuildLog()
Closes the build log's root block, flushes messages and closes the build logDate
convertToAgentTime(Date serverTime)
Converts server time to agent time by taking into account agent and server time difference.Date
convertToServerTime(Date agentTime)
Converts agent time to server time by taking into account agent and server time difference.AgentBuild
createAgentBuild()
Creates structure containing all of the parameters which should be sent to an agentvoid
deleteBuildProblem(SUser user, String identity, String comment)
Deletes build problem Deleting build problem may change build status to SUCCESSvoid
detachedFromAgent()
Should be called when the build has been detached from the agent and agent can start some other buildboolean
finish()
The method completes the build finishing procedure and should not be called directly in the majority of cases.void
finish(Date finishDate)
Finalizes all build related activities and finishes the build.void
finishedOnOtherNode()
void
finishImmediately(Date finishDate, boolean failed)
For tests only!SBuildAgent
getAgent()
Get build agent this running build is running on.String
getAgentAccessCode()
Returns access code which can be used by agent to access server resources by HTTP.int
getAgentId()
String
getAgentName()
Returns agent name where build is running or happened to run if finished.List<SArtifactDependency>
getArtifactDependencies()
Returns the artifact dependencies of this build.BuildArtifacts
getArtifacts(BuildArtifactsViewMode mode)
Returns accessor for build artifacts.File
getArtifactsDirectory()
Returns artifacts directory of this build.ArtifactsUploadLimit
getArtifactsLimit()
Branch
getBranch()
Comment
getBuildComment()
Returns build comment.BuildConfigurationInfo
getBuildConfiguration()
long
getBuildCounter()
String
getBuildDescription()
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).long
getBuildId()
Returns build idBuildLogEx
getBuildLog()
Returns build log.BuildLogEx
getBuildLogIfInitialized()
String
getBuildNumber()
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.List<BuildProblem>
getBuildProblems()
Returns all build problems for this promotion with extended information about muting This method can perform rather slow as it reloads build problems from database and fills mute info from audit (reads database as well) If you don't need mute info try usingSBuild.getFailureReasons()
BuildPromotionEx
getBuildPromotion()
Returns build promotionBuildPromotionInfo
getBuildPromotionInfo()
BuildStatistics
getBuildStatistics(BuildStatisticsOptions options)
Same asSBuild.getFullStatistics()
but with more control of data being loaded.Status
getBuildStatus()
Returns current build statusSBuildType
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.ShortStatistics
getCachedShortStatistics(boolean calculateIfAbsent)
Return cached short statistics for this build.CanceledInfo
getCanceledInfo()
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 listDate
getClientStartDate()
Returns the timestamp when the build was started on the build agent (in agent time)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 according to the specified policy.List<String>
getCompilationErrorMessages()
Returns compilation error messages of this buildint
getCompletedPercent()
Map<String,Long>
getCompletedStages()
Reports target build-type's stages (this build being instance of) that have been already completed by this particular buildList<SVcsModification>
getContainingChanges()
Returns changes in this build.String
getCurrentPath()
Returns short description of current running step.CustomDataStorage
getCustomDataStorage(String key)
Returns a data storage which can be used to associate arbitrary data with the build.Long
getDetachFromAgentReceivedTimestamp()
DownloadedArtifacts
getDownloadedArtifacts()
Returns information about artifacts downloaded by this build according to configured artifact dependencies.long
getDuration()
Returns current build duration in seconds.long
getDurationEstimate()
Returns server estimation for this build duration in seconds.long
getDurationOnAgent()
long
getDurationOvertime()
Returns how much in seconds this build duration exceeded estimated duration.long
getElapsedTime()
Returns elapsed time for this build.long
getEstimationForTimeLeft()
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.Date
getFinishDate()
Returns finish timestamp for the build (server time) ornull
if it hasn't been finished yet.Date
getFinishOnAgentDate()
Returns timestamp when the build finished on agent (server time) ornull
if it is still running on agent.String
getFirstInternalError()
Returns the first internal error in a build, or null.String
getFirstInternalErrorMessage()
Returns the error message associated with the first internal error, or nullString
getFullName()
BuildStatistics
getFullStatistics()
Calculates full statistics for this build.RunningBuildEx
getHangingDependency()
List<VcsLabel>
getLabels()
VCS labels which were made by TeamCity for the build.Date
getLastBuildActivityTimestamp()
List<String>
getLogMessages(int startFromIdx, int maxCount)
Allows to get messages logged for the buildSUser
getOwner()
If this build is personal one, returns the owner of this build.ParametersProvider
getParametersProvider()
Returns parameters which can be used by value resolver.SFinishedBuild
getPreviousFinished()
String
getProgressText()
String
getProjectExternalId()
Returns external id of the project this build belongs to.String
getProjectId()
Returns internal id of the project this build belongs to.DownloadedArtifacts
getProvidedArtifacts()
Returns information about provided artifacts, i.e.Integer
getQueuedAgentId()
Deprecated.SAgentRestrictor
getQueuedAgentRestrictor()
Returns an agent restrictor this build was queued with (when build configuration was added to queue).Date
getQueuedDate()
Returns the date when the build was added to queue.String
getRawBuildNumber()
Returns raw build number (i.e.SFinishedBuild
getRecentlyFinishedBuild()
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.RemoteArtifacts
getRemoteArtifactsByType(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 instanceMap<String,Boolean>
getRunnersState()
SBuild
getSequenceBuild()
If associated build promotion has modification id, returns the sequence build which contains the same changes as this build promotion.Date
getServerStartDate()
Returns the timestamp when the build was removed from the queue.ShortStatistics
getShortStatistics()
Calculates short statistics for this build.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 sentBigDecimal
getStatisticValue(String valueTypeKey)
Map<String,BigDecimal>
getStatisticValues()
StatisticValuesCollection
getStatisticValuesCollection()
StatusDescriptor
getStatusDescriptor()
Returns status descriptor of the buildList<String>
getTags()
Returns list of public tags for this buildCustomDataStorage
getTemporaryCustomDataStorage()
List<TestInfo>
getTestMessages(int startFromIdx, int maxTestsToLoad)
Retrieves information about tests failed in the build.TestRunMuter
getTestRunMuter()
Returns a special service that allows to mute test run if neccessary.long
getTimeSpentSinceLastBuildActivity()
Returns time in seconds spent since last build activity.TriggeredBy
getTriggeredBy()
Returns details about how this build was triggered.UserDataStorage
getUserDataStorage()
Use this object to associate some data with the current instance.ValueResolver
getValueResolver()
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.boolean
hasBuildProblemOfType(String type)
Returns true if build has build problem of this typeboolean
hasTests()
boolean
isAgentLessBuild()
boolean
isArtifactsExists()
Returns true if this build has artifacts.boolean
isCompositeBuild()
Returns true if this build is a composite build.boolean
isDetachedFromAgent()
Returns true if this build was detached from agent at some point.boolean
isFinished()
boolean
isFinishReceived()
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
isInterrupted()
When processing buildFinished event, returns true if build was finished unexpectedly (for instance, killed)boolean
isOutdated()
Returns true if this build is outdated.boolean
isOutOfChangesSequence()
Returns true if there is a build started before but having more recent changes then this build.boolean
isPersonal()
Returns if this build has been run to test personal changesboolean
isPinned()
Returns true if this build is pinnedboolean
isProbablyHanging()
Returns true if server thinks this build has hung.boolean
isResponsibleNeeded()
Always returns false for personal and/or cancelled builds.boolean
isStartedOnAgent()
Returns true if this build was started on agent.boolean
isStarting()
Returns true if the build is trying to start on an agent and runBuild() command has not finished yetboolean
isTimedOut()
boolean
isUsedByOtherBuilds()
Returns true if this build is used by other builds, i.e.void
markAsFinished(Date finishDate, boolean failed)
void
markAsFinishedUnexpectedly(String reason)
void
muteBuildProblems(boolean muteIfTrue)
Makes all existing build problems enabled or disabledvoid
muteBuildProblems(SUser user, boolean muteIfTrue, String comment)
Makes all existing build problems enabled or disabledboolean
occupiesAgent()
void
prepareArtifactDependencies()
Resolves artifact dependencies by replacing "latest" rules with actual build ids.void
publishArtifact(String path, byte[] content)
Adds artifact to the build by the specified pathvoid
publishArtifact(String path, File srcFile)
Adds artifact to the build by the specified pathvoid
publishArtifact(String path, File srcFile, PublishArtifactProgressListener progressListener)
Adds artifact to the build from the specified file allowing to trace progressvoid
publishArtifact(String path, InputStream is)
Adds artifact to the build by the specified pathvoid
publishArtifact(String path, InputStream is, PublishArtifactProgressListener progressListener)
Adds artifact to the build from the specified stream allowing to trace progressvoid
resetAgentCache()
Resets internal cache of agent instanceboolean
runUnlessFinished(Runnable runnable)
Executes specified runnable if build is not finished.void
serverShutdown()
void
serverStartup()
void
setBuildComment(User user, String comment)
Sets the comment for the buildvoid
setBuildNumber(String newBuildNumber)
Set new value for this build build number instead of current one.void
setBuildStatus(Status status)
Set current status of the running build.void
setCustomStatusText(String text)
Sets the custom build status text.void
setInterrupted(RunningBuildState state, User user, String reason)
Mark this build as interrupted.void
setStartTimes(Date agentStartTime, Date serverStartTime, TimeZone agentTimeZone)
Sets timestamps when command to run build was sent to an agent.void
setTags(List<String> tags)
Sets public tags for this buildvoid
setTags(User user, List<String> tags)
Deprecated.void
skipBuildChainBuilds(List<String> externalIdsOrTags, String comment)
This call looks for builds tagged with 'tags' in all build chains this running build belongs to, and cancels/removes such builds from the queue.void
start(boolean async)
Must be invoked only once when build starts.void
startBuildFailureChecker()
Initialize periodical build failue checker processvoid
stop(RunningBuildState interruptedState, User user, String comment, boolean reAdd2Queue)
void
stop(User user, String comment)
Stops the build.void
stopBuildFailureChecker()
Stop periodical failure checker processvoid
stopNoInterrupt()
Stops build on server and on agent without making it interruptedvoid
updateBuild()
void
updateBuildIfLastUpdateExpired(int expirationTimeSeconds)
Performs update of the build data but only if some time has passed since the last update.boolean
updateBuildInfo()
Loads build interruption and build finish timestamps from database into the build.void
updateBuildStatisticValues()
Loads statistic values reported for the build from database and sends events on every new loaded valuevoid
updateExternalArtifactsInfoOnAccess()
void
writeSettingsDigestFile()
Writes the value of theBuildAttributes.SETTINGS_DIGEST
to a file under the build artifacts directory.
-
-
-
Constructor Detail
-
RunningBuildWrapper
public RunningBuildWrapper(@NotNull FinishedBuildEx finishedBuild)
-
-
Method Detail
-
getCurrentPath
public String getCurrentPath()
Description copied from interface:SRunningBuild
Returns short description of current running step.- Specified by:
getCurrentPath
in interfaceSRunningBuild
- Returns:
- short description of current running step.
-
getBuildConfiguration
@Nullable public BuildConfigurationInfo getBuildConfiguration()
- Specified by:
getBuildConfiguration
in interfaceRunningBuildInfo
- Returns:
- the corresponding build configuration or null if the configuration has been concurrently deleted
-
hasTests
public boolean hasTests()
-
getAgent
@NotNull public SBuildAgent getAgent()
Description copied from interface:SRunningBuild
Get build agent this running build is running on. May be unregistered or even dead agent, but never null.- Specified by:
getAgent
in interfaceRunningBuildInfo
- Specified by:
getAgent
in interfaceSBuild
- Specified by:
getAgent
in interfaceSRunningBuild
- Returns:
- see above
-
getAgentId
public int getAgentId()
- Specified by:
getAgentId
in interfaceSRunningBuild
- Returns:
- id of the agent where this build is running; returns -1 for agent less builds
-
buildPatch
public void buildPatch(OutputStream stream, @NotNull FullCheckoutFlag fullCheckoutFlag, boolean personalChanges, @NotNull AgentCheckoutDirRevisionInfo workDirState) throws IOException
- Specified by:
buildPatch
in interfaceRunningBuildEx
- Throws:
IOException
-
buildPersonalPatch
public void buildPersonalPatch(OutputStream stream, long personalChangeId, @NotNull AgentCheckoutDirRevisionInfo workDirState) throws IOException
- Specified by:
buildPersonalPatch
in interfaceRunningBuildEx
- Throws:
IOException
-
setStartTimes
public void setStartTimes(@NotNull Date agentStartTime, @NotNull Date serverStartTime, @NotNull TimeZone agentTimeZone)
Description copied from interface:RunningBuildEx
Sets timestamps when command to run build was sent to an agent.- Specified by:
setStartTimes
in interfaceRunningBuildEx
- Parameters:
agentStartTime
- agent timestampserverStartTime
- server timestamp
-
updateBuild
public void updateBuild()
- Specified by:
updateBuild
in interfaceRunningBuildEx
-
updateBuildIfLastUpdateExpired
public void updateBuildIfLastUpdateExpired(int expirationTimeSeconds)
Description copied from interface:RunningBuildEx
Performs update of the build data but only if some time has passed since the last update.- Specified by:
updateBuildIfLastUpdateExpired
in interfaceRunningBuildEx
- Parameters:
expirationTimeSeconds
- time threshold since the last update in seconds
-
updateBuildInfo
public boolean updateBuildInfo()
Description copied from interface:RunningBuildEx
Loads build interruption and build finish timestamps from database into the build. Returns true if running build exists in DB and false otherwise.- Specified by:
updateBuildInfo
in interfaceRunningBuildEx
-
updateBuildStatisticValues
public void updateBuildStatisticValues()
Description copied from interface:RunningBuildEx
Loads statistic values reported for the build from database and sends events on every new loaded value- Specified by:
updateBuildStatisticValues
in interfaceRunningBuildEx
-
updateExternalArtifactsInfoOnAccess
public void updateExternalArtifactsInfoOnAccess()
- Specified by:
updateExternalArtifactsInfoOnAccess
in interfaceRunningBuildEx
-
getQueuedAgentId
@Deprecated @Nullable public Integer getQueuedAgentId()
Deprecated.- Specified by:
getQueuedAgentId
in interfaceSRunningBuild
- Returns:
- agent this build was queued on or null if build was not queued on a specific agent
-
getQueuedAgentRestrictor
@Nullable public SAgentRestrictor getQueuedAgentRestrictor()
Description copied from interface:RunningBuildEx
Returns 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:
getQueuedAgentRestrictor
in interfaceRunningBuildEx
- Specified by:
getQueuedAgentRestrictor
in interfaceSRunningBuild
- Returns:
- see above
-
getUserDataStorage
@NotNull public UserDataStorage getUserDataStorage()
Description copied from interface:RunningBuildEx
Use this object to associate some data with the current instance. Stored data is not persisted and is not copied to another instance of the given object.- Specified by:
getUserDataStorage
in interfaceRunningBuildEx
- Returns:
- user data holder
-
getCompletedStages
@NotNull public Map<String,Long> getCompletedStages()
Description copied from interface:RunningBuildEx
Reports target build-type's stages (this build being instance of) that have been already completed by this particular build- Specified by:
getCompletedStages
in interfaceRunningBuildEx
- Returns:
- mapping from stage-names to respective durations
-
isFinishReceived
public boolean isFinishReceived()
- Specified by:
isFinishReceived
in interfaceRunningBuildEx
- Returns:
- true if build finished was received by the server.
-
markAsFinished
public void markAsFinished(@NotNull Date finishDate, boolean failed)
- Specified by:
markAsFinished
in interfaceRunningBuildEx
-
markAsFinishedUnexpectedly
public void markAsFinishedUnexpectedly(@NotNull String reason)
- Specified by:
markAsFinishedUnexpectedly
in interfaceRunningBuildEx
-
publishArtifact
public void publishArtifact(@NotNull String path, @NotNull byte[] content) throws IOException
Description copied from interface:RunningBuildEx
Adds artifact to the build by the specified path- Specified by:
publishArtifact
in interfaceRunningBuildEx
- Parameters:
path
- path where to store artifactcontent
- artifact content- Throws:
IOException
-
publishArtifact
public void publishArtifact(@NotNull String path, @NotNull File srcFile) throws IOException
Description copied from interface:RunningBuildEx
Adds artifact to the build by the specified path- Specified by:
publishArtifact
in interfaceRunningBuildEx
- Parameters:
path
- path where to store artifactsrcFile
- file containing artifact content; note that after the publishing srcFile can be removed- Throws:
IOException
-
publishArtifact
public void publishArtifact(@NotNull String path, @NotNull File srcFile, @Nullable PublishArtifactProgressListener progressListener)
Description copied from interface:RunningBuildEx
Adds artifact to the build from the specified file allowing to trace progress- Specified by:
publishArtifact
in interfaceRunningBuildEx
- Parameters:
path
- path where to store artifactsrcFile
- file containing artifact content; note that after the publishing srcFile can be removedprogressListener
- PublishArtifactProgressListener to track progress
-
publishArtifact
public void publishArtifact(@NotNull String path, @NotNull InputStream is, @Nullable PublishArtifactProgressListener progressListener)
Description copied from interface:RunningBuildEx
Adds artifact to the build from the specified stream allowing to trace progress- Specified by:
publishArtifact
in interfaceRunningBuildEx
- Parameters:
path
- path where to store artifactprogressListener
- PublishArtifactProgressListener to track progress
-
publishArtifact
public void publishArtifact(@NotNull String path, @NotNull InputStream is) throws IOException
Description copied from interface:RunningBuildEx
Adds artifact to the build by the specified path- Specified by:
publishArtifact
in interfaceRunningBuildEx
- Parameters:
path
- path where to store artifact- Throws:
IOException
-
getBuildCounter
public long getBuildCounter()
- Specified by:
getBuildCounter
in interfaceRunningBuildEx
- Returns:
- value of build counter when this build started
-
getProgressText
@NotNull public String getProgressText()
- Specified by:
getProgressText
in interfaceRunningBuildEx
- Returns:
- current progress text calculated for the build; this text is used in build status line
-
stopNoInterrupt
public void stopNoInterrupt()
Description copied from interface:RunningBuildEx
Stops build on server and on agent without making it interrupted- Specified by:
stopNoInterrupt
in interfaceRunningBuildEx
-
getArtifactsLimit
@NotNull public ArtifactsUploadLimit getArtifactsLimit()
- Specified by:
getArtifactsLimit
in interfaceRunningBuildEx
-
addRemoteArtifact
public void addRemoteArtifact(@NotNull RemoteArtifact artifact)
Description copied from interface:SRunningBuild
Adds information about remote artifact to this build- Specified by:
addRemoteArtifact
in interfaceSRunningBuild
- See Also:
SBuild.getRemoteArtifacts()
-
getRemoteArtifacts
@NotNull public List<RemoteArtifacts> getRemoteArtifacts()
Description copied from interface:SBuild
Returns list of all remote artifacts that were published for this build.- Specified by:
getRemoteArtifacts
in interfaceSBuild
- Returns:
- collection of
RemoteArtifact
-
getRemoteArtifactsByType
@NotNull public RemoteArtifacts getRemoteArtifactsByType(@NotNull String type)
Description copied from interface:SBuild
Returns list of remote artifacts that belong to a specific type.- Specified by:
getRemoteArtifactsByType
in interfaceSBuild
- Returns:
- collection of
RemoteArtifact
-
getWaitReasons
@NotNull public Map<String,Long> getWaitReasons()
Description copied from interface:SBuild
Returns 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:
getWaitReasons
in interfaceSBuild
- Returns:
- map of a wait reason to amount of time it was reported for the build in milliseconds
-
resetAgentCache
public void resetAgentCache()
Description copied from interface:RunningBuildEx
Resets internal cache of agent instance- Specified by:
resetAgentCache
in interfaceRunningBuildEx
-
serverStartup
public void serverStartup()
- Specified by:
serverStartup
in interfaceRunningBuildEx
-
serverShutdown
public void serverShutdown()
- Specified by:
serverShutdown
in interfaceRunningBuildEx
-
isCompositeBuild
public boolean isCompositeBuild()
Description copied from interface:SBuild
Returns true if this build is a composite build.- Specified by:
isCompositeBuild
in interfaceSBuild
- Returns:
- see above
-
getHangingDependency
@Nullable public RunningBuildEx getHangingDependency()
- Specified by:
getHangingDependency
in interfaceRunningBuildEx
- Returns:
- Traverses through running snapshot dependencies of this build and returns the first found one which is probably hanging.
-
closeBuildLog
public void closeBuildLog()
Description copied from interface:RunningBuildEx
Closes the build log's root block, flushes messages and closes the build log- Specified by:
closeBuildLog
in interfaceRunningBuildEx
-
getRunnersState
@NotNull public Map<String,Boolean> getRunnersState()
- Specified by:
getRunnersState
in interfaceRunningBuildEx
-
detachedFromAgent
public void detachedFromAgent()
Description copied from interface:RunningBuildEx
Should be called when the build has been detached from the agent and agent can start some other build- Specified by:
detachedFromAgent
in interfaceRunningBuildEx
-
getDetachFromAgentReceivedTimestamp
@Nullable public Long getDetachFromAgentReceivedTimestamp()
- Specified by:
getDetachFromAgentReceivedTimestamp
in interfaceBuildEx
- Specified by:
getDetachFromAgentReceivedTimestamp
in interfaceRunningBuildEx
- Returns:
- timestamp when this build was attempted to detach from agent
-
getStatisticValuesCollection
@NotNull public StatisticValuesCollection getStatisticValuesCollection()
- Specified by:
getStatisticValuesCollection
in interfaceRunningBuildEx
-
writeSettingsDigestFile
public void writeSettingsDigestFile() throws IllegalStateException
Description copied from interface:RunningBuildEx
Writes the value of theBuildAttributes.SETTINGS_DIGEST
to a file under the build artifacts directory.- Specified by:
writeSettingsDigestFile
in interfaceRunningBuildEx
- Throws:
IllegalStateException
- if attribute is not set to the build
-
prepareArtifactDependencies
public void prepareArtifactDependencies()
Description copied from interface:RunningBuildEx
Resolves artifact dependencies by replacing "latest" rules with actual build ids.- Specified by:
prepareArtifactDependencies
in interfaceRunningBuildEx
-
isStarting
public boolean isStarting()
Description copied from interface:RunningBuildEx
Returns true if the build is trying to start on an agent and runBuild() command has not finished yet- Specified by:
isStarting
in interfaceRunningBuildEx
- Returns:
-
getTemporaryCustomDataStorage
@NotNull public CustomDataStorage getTemporaryCustomDataStorage()
- Specified by:
getTemporaryCustomDataStorage
in interfaceRunningBuildEx
- Returns:
- a temporary custom data storage which exists only while the build is running and is disposed once the build is finished
-
isInterrupted
public boolean isInterrupted()
Description copied from interface:SRunningBuild
When processing buildFinished event, returns true if build was finished unexpectedly (for instance, killed)- Specified by:
isInterrupted
in interfaceSRunningBuild
- Returns:
- true or false
-
getCompletedPercent
public int getCompletedPercent()
- Specified by:
getCompletedPercent
in interfaceSRunningBuild
- Returns:
- completed percentage for the build according to build duration estimated time. or -1 if there is no estimate
-
addBuildMessages
public void addBuildMessages(@NotNull List<BuildMessage1> messages)
Description copied from interface:SRunningBuild
Adds new server messages to the build.- Specified by:
addBuildMessages
in interfaceSRunningBuild
- Parameters:
messages
- new build messages.
-
addBuildMessage
public void addBuildMessage(@NotNull BuildMessage1 message)
Description copied from interface:RunningBuildEx
Adds new message from server to the build.- Specified by:
addBuildMessage
in interfaceRunningBuildEx
- Specified by:
addBuildMessage
in interfaceSRunningBuild
-
setBuildNumber
public void setBuildNumber(@NotNull String newBuildNumber)
Description copied from interface:SRunningBuild
Set 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:
setBuildNumber
in interfaceSRunningBuild
- Parameters:
newBuildNumber
- new value for this build build number
-
setBuildStatus
public void setBuildStatus(Status status)
Description copied from interface:SRunningBuild
Set current status of the running build. Useful before build finish to update build status.- Specified by:
setBuildStatus
in interfaceSRunningBuild
- Parameters:
status
- new status of the build
-
setInterrupted
public void setInterrupted(@NotNull RunningBuildState state, @Nullable User user, @Nullable String reason)
Description copied from interface:SRunningBuild
Mark this build as interrupted.- Specified by:
setInterrupted
in 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:SRunningBuild
Returns access code which can be used by agent to access server resources by HTTP.- Specified by:
getAgentAccessCode
in interfaceSRunningBuild
- Returns:
- access code
-
isProbablyHanging
public boolean isProbablyHanging()
Description copied from interface:SRunningBuild
Returns 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:
isProbablyHanging
in interfaceSRunningBuild
- Returns:
- true if build is probably hanging
-
getLastBuildActivityTimestamp
public Date getLastBuildActivityTimestamp()
- Specified by:
getLastBuildActivityTimestamp
in interfaceSRunningBuild
- Returns:
- timestamp of last message received from a build.
-
getTimeSpentSinceLastBuildActivity
public long getTimeSpentSinceLastBuildActivity()
Description copied from interface:SRunningBuild
Returns time in seconds spent since last build activity.- Specified by:
getTimeSpentSinceLastBuildActivity
in interfaceSRunningBuild
- Returns:
- time in seconds
-
stop
public void stop(@Nullable User user, @Nullable String comment)
Description copied from interface:SRunningBuild
Stops 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:
stop
in interfaceSRunningBuild
- Parameters:
user
- user who stopped build or nullcomment
- comment for the action or null
-
stop
public void stop(@NotNull RunningBuildState interruptedState, @Nullable User user, @NotNull String comment, boolean reAdd2Queue)
- Specified by:
stop
in interfaceRunningBuildEx
- Parameters:
interruptedState
- how to interrupt the build, should have interrupted statususer
- optional user who stops the buildcomment
- comment for build interruptionreAdd2Queue
- if true, the build will be re-added to queue with the same build promotion (to the end of the queue)
-
getArtifactsDirectory
@NotNull public File getArtifactsDirectory()
Description copied from interface:SBuild
Returns artifacts directory of this build. Artifacts should be locked with help ofArtifactsGuard
for the period of their processing.- Specified by:
getArtifactsDirectory
in interfaceSBuild
- Returns:
- artifacts directory of this build
-
getArtifacts
@NotNull public BuildArtifacts getArtifacts(@NotNull BuildArtifactsViewMode mode)
Description copied from interface:SBuild
Returns accessor for build artifacts. This accessor checks all necessary permissions for accessing files.- Specified by:
getArtifacts
in interfaceSBuild
- Parameters:
mode
- view mode to see artifacts- Returns:
- build artifacts viewer
-
getArtifactDependencies
@NotNull public List<SArtifactDependency> getArtifactDependencies()
Description copied from interface:SBuild
Returns the artifact dependencies of this build. Same as getBuildPromotion().getArtifactDependencies().- Specified by:
getArtifactDependencies
in interfaceSBuild
- Returns:
- artifact dependencies
-
isArtifactsExists
public boolean isArtifactsExists()
Description copied from interface:SBuild
Returns true if this build has artifacts. Internal TeamCity artifacts are ignored.- Specified by:
isArtifactsExists
in interfaceSBuild
- Returns:
- true if this build has artifacts
- See Also:
ArtifactsConstants.TEAMCITY_ARTIFACTS_DIR
,SBuild.isHasInternalArtifactsOnly()
-
isHasInternalArtifactsOnly
public boolean isHasInternalArtifactsOnly()
Description copied from interface:SBuild
Returns true if this build has only internal (hidden) artifacts.- Specified by:
isHasInternalArtifactsOnly
in interfaceSBuild
- Returns:
- true if this build has internal artifacts only
- See Also:
SBuild.isArtifactsExists()
-
isResponsibleNeeded
public boolean isResponsibleNeeded()
Description copied from interface:SBuild
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.- Specified by:
isResponsibleNeeded
in interfaceSBuild
- Returns:
- see above.
-
getBuildLog
@NotNull public BuildLogEx getBuildLog()
Description copied from interface:SBuild
Returns build log.- Specified by:
getBuildLog
in interfaceBuildEx
- Specified by:
getBuildLog
in interfaceRunningBuildEx
- Specified by:
getBuildLog
in interfaceSBuild
- Returns:
- build log.
-
getBuildLogIfInitialized
@Nullable public BuildLogEx getBuildLogIfInitialized()
- Specified by:
getBuildLogIfInitialized
in interfaceRunningBuildEx
-
skipBuildChainBuilds
public void skipBuildChainBuilds(@NotNull List<String> externalIdsOrTags, @Nullable String comment)
Description copied from interface:RunningBuildEx
This call looks for builds tagged with 'tags' in all build chains this running build belongs to, and cancels/removes such builds from the queue.- Specified by:
skipBuildChainBuilds
in interfaceRunningBuildEx
- Parameters:
externalIdsOrTags
- array of tags for builds which should be skipped in the build chain. A tag could be either a build configuration external ID, or a tag specified via a special tag parameter on a build configuration.comment
- comment to use when canceling queued builds
-
getShortStatistics
@NotNull public ShortStatistics getShortStatistics()
Description copied from interface:SBuild
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 useSBuild.getBuildStatistics(jetbrains.buildServer.serverSide.BuildStatisticsOptions)
method.- Specified by:
getShortStatistics
in interfaceSBuild
- Returns:
- short statistics for this build.
-
getFullStatistics
@NotNull public BuildStatistics getFullStatistics()
Description copied from interface:SBuild
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 methodSBuild.getBuildStatistics(BuildStatisticsOptions)
instead.- Specified by:
getFullStatistics
in interfaceSBuild
- Returns:
- full statistics for this build.
-
getBuildStatistics
@NotNull public BuildStatistics getBuildStatistics(@NotNull BuildStatisticsOptions options)
Description copied from interface:SBuild
Same asSBuild.getFullStatistics()
but with more control of data being loaded.- Specified by:
getBuildStatistics
in interfaceSBuild
- Parameters:
options
- options- Returns:
- build statistics according to specified options
-
getOwner
@Nullable public SUser getOwner()
Description copied from interface:SBuild
If this build is personal one, returns the owner of this build.- Specified by:
getOwner
in interfaceSBuild
- Returns:
- null if this build is not personal otherwise owner of this build
- See Also:
Build.isPersonal()
-
getTriggeredBy
@NotNull public TriggeredBy getTriggeredBy()
Description copied from interface:SBuild
Returns details about how this build was triggered.- Specified by:
getTriggeredBy
in interfaceSBuild
- Returns:
- see above
-
getBuildType
@Nullable public SBuildType getBuildType()
Description copied from interface:SBuild
Returns build configuration this build belongs to.- Specified by:
getBuildType
in interfaceBuild
- Specified by:
getBuildType
in interfaceSBuild
- Returns:
- build configuration descriptor.
-
getDownloadedArtifacts
@NotNull public DownloadedArtifacts getDownloadedArtifacts()
Description copied from interface:SBuild
Returns information about artifacts downloaded by this build according to configured artifact dependencies.- Specified by:
getDownloadedArtifacts
in interfaceSBuild
- Returns:
- information about downloaded artifacts.
-
getProvidedArtifacts
@NotNull public DownloadedArtifacts getProvidedArtifacts()
Description copied from interface:SBuild
Returns information about provided artifacts, i.e. artifacts that were downloaded from this build by other builds by artifact dependencies.- Specified by:
getProvidedArtifacts
in interfaceSBuild
- Returns:
- see above
-
isUsedByOtherBuilds
public boolean isUsedByOtherBuilds()
Description copied from interface:SBuild
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.- Specified by:
isUsedByOtherBuilds
in interfaceSBuild
- Returns:
- see above
-
getContainingChanges
@NotNull public 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 interfaceBuild
- Specified by:
getContainingChanges
in interfaceSBuild
- Returns:
- changes in this build
-
getChanges
@NotNull public List<SVcsModification> getChanges(@NotNull 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 interfaceBuild
- Specified by:
getChanges
in 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 policy)
Description copied from interface:Build
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.- Specified by:
getCommitters
in interfaceBuild
- Specified by:
getCommitters
in 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
- 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:SBuild
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.- Specified by:
isOutOfChangesSequence
in interfaceSBuild
- Returns:
- see above
-
getTags
public List<String> getTags()
Description copied from interface:SBuild
Returns list of public tags for this build
-
setTags
public void setTags(List<String> tags)
Description copied from interface:SBuild
Sets public tags for this build
-
setTags
@Deprecated public void setTags(User user, List<String> tags)
Deprecated.Description copied from interface:SBuild
Sets public tags for this build
-
getFileContent
@NotNull public byte[] getFileContent(String filePath) throws VcsException
Description copied from interface:SBuild
Get binary content of the single file related to this build.- Specified by:
getFileContent
in 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.
-
getRevisions
public List<BuildRevision> getRevisions()
Description copied from interface:SBuild
List of all revisions which were used for the build instance- Specified by:
getRevisions
in interfaceSBuild
- Returns:
- all revisions which were used in this build
-
getLabels
public List<VcsLabel> getLabels()
Description copied from interface:SBuild
VCS 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:SBuild
Returns the date when the build was added to queue.- Specified by:
getQueuedDate
in interfaceSBuild
- Returns:
- queued time.
-
getServerStartDate
@NotNull public Date getServerStartDate()
Description copied from interface:SBuild
Returns the timestamp when the build was removed from the queue.- Specified by:
getServerStartDate
in interfaceSBuild
- Returns:
- the timestamp when the build was removed from the queue.
-
getVcsRootEntries
public List<VcsRootInstanceEntry> getVcsRootEntries()
Description copied from interface:SBuild
Returns vcs roots with checkout rules for the build start moment.- Specified by:
getVcsRootEntries
in interfaceSBuild
- Returns:
- vcs roots with checkout rules for the build start moment.
-
getClientStartDate
@Nullable public Date getClientStartDate()
Description copied from interface:SBuild
Returns the timestamp when the build was started on the build agent (in agent time)- Specified by:
getClientStartDate
in interfaceSBuild
- Returns:
- the timestamp when the build was started on the build agent (in agent time)
-
isStartedOnAgent
public boolean isStartedOnAgent()
Description copied from interface:SBuild
Returns true if this build was started on agent.- Specified by:
isStartedOnAgent
in interfaceSBuild
- Returns:
- see above
-
convertToServerTime
@NotNull public Date convertToServerTime(@NotNull Date agentTime)
Description copied from interface:SBuild
Converts agent time to server time by taking into account agent and server time difference.- Specified by:
convertToServerTime
in interfaceSBuild
- Parameters:
agentTime
- time on agent- Returns:
- server time
-
convertToAgentTime
@NotNull public Date convertToAgentTime(@NotNull Date serverTime)
Description copied from interface:SBuild
Converts server time to agent time by taking into account agent and server time difference.- Specified by:
convertToAgentTime
in interfaceSBuild
- Parameters:
serverTime
- server time to convert- Returns:
- agent time
-
getBuildDescription
@Nullable public String getBuildDescription()
Description copied from interface:SBuild
Returns build description set to this build explicitly or null.- Specified by:
getBuildDescription
in interfaceSBuild
- Returns:
- see above
-
getValueResolver
@NotNull public ValueResolver getValueResolver()
Description copied from interface:SBuild
Returns build-aware value resolver to be used to resolve values based on the build's properties.- Specified by:
getValueResolver
in interfaceParametersSupport
- Specified by:
getValueResolver
in interfaceSBuild
- Returns:
- this build-aware value resolver
-
getBuildComment
@Nullable public Comment getBuildComment()
Description copied from interface:SBuild
Returns build comment.- Specified by:
getBuildComment
in 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:SBuild
Sets the comment for the build- Specified by:
setBuildComment
in interfaceSBuild
- Parameters:
user
- user who sets the commentcomment
- text of the comment
-
isPinned
public boolean isPinned()
Description copied from interface:SBuild
Returns true if this build is pinned
-
getRelatedIssues
@NotNull public Collection<Issue> getRelatedIssues()
Description copied from interface:SBuild
Returns the collection of related issues (e.g. mentioned in modification's comments, or mentioned in the build's comment).- Specified by:
getRelatedIssues
in interfaceSBuild
- Returns:
- related issues
- See Also:
SBuild.isHasRelatedIssues()
,SVcsModification.getRelatedIssues()
-
isHasRelatedIssues
public boolean isHasRelatedIssues()
Description copied from interface:SBuild
Returns whether the build has related issues (e.g. mentioned in modification's comments, or mentioned in the build's comment).- Specified by:
isHasRelatedIssues
in 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:SBuild
Returns map of parameters (configuration params, system properties and environment variables) excluding parameters provided by extensions.- Specified by:
getBuildOwnParameters
in interfaceSBuild
- Returns:
- see above
-
getRawBuildNumber
public String getRawBuildNumber()
Description copied from interface:SBuild
Returns 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:
getRawBuildNumber
in interfaceSBuild
- Returns:
- raw build number which can contain unresolved parameters
-
isInternalError
public boolean isInternalError()
Description copied from interface:SBuild
Returns whether this build failed because of internal error (infrastructural error not related to build script).- Specified by:
isInternalError
in interfaceSBuild
- Returns:
- true iff the build is error
-
getFirstInternalError
@Nullable public String getFirstInternalError()
Description copied from interface:SBuild
Returns the first internal error in a build, or null.- Specified by:
getFirstInternalError
in interfaceSBuild
- Returns:
- first internal error type
-
getFirstInternalErrorMessage
@Nullable public String getFirstInternalErrorMessage()
Description copied from interface:SBuild
Returns the error message associated with the first internal error, or null- Specified by:
getFirstInternalErrorMessage
in interfaceSBuild
- Returns:
- first internal error message
-
getClientTimeZone
@Nullable public TimeZone getClientTimeZone()
Description copied from interface:SBuild
Returns agent machine time zone if it's available on server.- Specified by:
getClientTimeZone
in 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:SBuild
Adds build problem to the build. Currently build problem causes build failure.- Specified by:
addBuildProblem
in interfaceSBuild
-
hasBuildProblemOfType
public boolean hasBuildProblemOfType(@NotNull String type)
Description copied from interface:SBuild
Returns true if build has build problem of this type- Specified by:
hasBuildProblemOfType
in interfaceSBuild
- Parameters:
type
- build problem type- Returns:
- see above
- See Also:
BuildProblemData
-
getFailureReasons
@NotNull public List<BuildProblemData> getFailureReasons()
Description copied from interface:SBuild
Returns build problems that caused build failure or empty list if build is successful- Specified by:
getFailureReasons
in interfaceSBuild
- Returns:
- see above
-
muteBuildProblems
public void muteBuildProblems(@NotNull SUser user, boolean muteIfTrue, @NotNull String comment)
Description copied from interface:SBuild
Makes all existing build problems enabled or disabled- Specified by:
muteBuildProblems
in 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 problemDescription)
Description copied from interface:SBuild
Adds user provided build problem to the build. Currently build problem causes build failure. Adding user provided problem always overrides previously added one- Specified by:
addUserBuildProblem
in interfaceSBuild
- Parameters:
user
- user that will be used in audit- Returns:
- added build problem
-
getBranch
@Nullable public Branch getBranch()
-
getPreviousFinished
@Nullable public SFinishedBuild getPreviousFinished()
- Specified by:
getPreviousFinished
in 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
@Nullable public BigDecimal getStatisticValue(String valueTypeKey)
- Specified by:
getStatisticValue
in 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:
getStatisticValues
in 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:SBuild
Returns 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:
getBuildFeaturesOfType
in interfaceSBuild
- Parameters:
featureType
- type of the build feature- Returns:
- see above
-
isOutdated
public boolean isOutdated()
Description copied from interface:SBuild
Returns 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:
isOutdated
in interfaceSBuild
- Returns:
- see above
-
getRecentlyFinishedBuild
@Nullable public SFinishedBuild getRecentlyFinishedBuild()
- Specified by:
getRecentlyFinishedBuild
in interfaceSBuild
- Returns:
- the build because of which this running build has been marked as outdated (see
SBuild.isOutdated()
).
-
isAgentLessBuild
public boolean isAgentLessBuild()
- Specified by:
isAgentLessBuild
in 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:SBuild
Returns true if this build was detached from agent at some point.- Specified by:
isDetachedFromAgent
in interfaceSBuild
- Returns:
- see above
-
getFinishOnAgentDate
@Nullable public Date getFinishOnAgentDate()
Description copied from interface:SBuild
Returns timestamp when the build finished on agent (server time) ornull
if it is still running on agent.- Specified by:
getFinishOnAgentDate
in interfaceSBuild
- Returns:
- see above
-
getCustomDataStorage
@NotNull public CustomDataStorage getCustomDataStorage(@NotNull String key)
Description copied from interface:SBuild
Returns a data storage which can be used to associate arbitrary data with the build.- Specified by:
getCustomDataStorage
in interfaceSBuild
- Parameters:
key
- a key to access the storage- Returns:
- an existing or newly created storage for the given key
-
getStartDate
@NotNull public Date getStartDate()
Description copied from interface:Build
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- Specified by:
getStartDate
in interfaceBuild
- Returns:
- see above
-
getAgentName
public String getAgentName()
Description copied from interface:Build
Returns agent name where build is running or happened to run if finished.- Specified by:
getAgentName
in interfaceBuild
- Returns:
- Agent name where build has been started on
-
getBuildId
public long getBuildId()
Description copied from interface:Build
Returns build id- Specified by:
getBuildId
in interfaceBuild
- Returns:
- Unique build id
-
getStatusDescriptor
public StatusDescriptor getStatusDescriptor()
Description copied from interface:Build
Returns status descriptor of the build- Specified by:
getStatusDescriptor
in interfaceBuild
- Returns:
- Descriptor of the current status of the build
-
getLogMessages
public List<String> getLogMessages(int startFromIdx, int maxCount)
Description copied from interface:Build
Allows to get messages logged for the build- Specified by:
getLogMessages
in interfaceBuild
- Parameters:
startFromIdx
- index of the first message to load (zero based)maxCount
- messages count limit.- Returns:
- list of plain messages
-
getTestMessages
public List<TestInfo> getTestMessages(int startFromIdx, int maxTestsToLoad)
Description copied from interface:Build
Retrieves information about tests failed in the build. Note that for running build currently executing test will be added to the list too.- Specified by:
getTestMessages
in interfaceBuild
- 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
public List<String> getCompilationErrorMessages()
Description copied from interface:Build
Returns compilation error messages of this build- Specified by:
getCompilationErrorMessages
in interfaceBuild
- Returns:
- list of plain messages
-
getBuildTypeId
@NotNull public String getBuildTypeId()
Description copied from interface:Build
Returns build configuration internal id- Specified by:
getBuildTypeId
in interfaceBuild
- Returns:
- ID of the configuration this build belongs to.
-
getBuildTypeExternalId
@NotNull public String getBuildTypeExternalId()
Description copied from interface:Build
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.- Specified by:
getBuildTypeExternalId
in interfaceBuild
- Returns:
- build type external ID
-
getBuildTypeName
@NotNull public String getBuildTypeName()
Description copied from interface:Build
Returns name of the build configuration this build belongs to.- Specified by:
getBuildTypeName
in interfaceBuild
- Returns:
- name of the build configuration this build belongs to.
-
getFullName
@NotNull public String getFullName()
- Specified by:
getFullName
in interfaceBuild
- Returns:
- full name of the build configuration this build belongs to, has form "project_name :: buildconfig_name"
-
getProjectId
@Nullable public String getProjectId()
Description copied from interface:Build
Returns internal id of the project this build belongs to. Same as getBuildType().getProjectId().- Specified by:
getProjectId
in interfaceBuild
- Returns:
- internal id of the project this build belongs to. Same as getBuildType().getProjectId().
-
getProjectExternalId
@Nullable public String getProjectExternalId()
Description copied from interface:Build
Returns external id of the project this build belongs to. Same as getBuildType().getProjectId().- Specified by:
getProjectExternalId
in interfaceBuild
- Returns:
- external id of the project this build belongs to. Same as getBuildType().getProjectId().
-
isPersonal
public boolean isPersonal()
Description copied from interface:Build
Returns if this build has been run to test personal changes- Specified by:
isPersonal
in interfaceBuild
- Returns:
- true is the build has been started as personal, and its changes were not committed to the VCS
-
getBuildStatus
public Status getBuildStatus()
Description copied from interface:Build
Returns current build status- Specified by:
getBuildStatus
in interfaceBuild
- Returns:
- Current build status
-
isFinished
public boolean isFinished()
- Specified by:
isFinished
in interfaceBuild
- Returns:
- true if the build was finished and was saved to the history
-
getBuildNumber
@NotNull public String getBuildNumber()
Description copied from interface:Build
Returns build number in the user defined format (unresolved parameters in build number will be replaced with '???').- Specified by:
getBuildNumber
in interfaceBuild
- Returns:
- presentable build number
-
getFinishDate
@Nullable public Date getFinishDate()
Description copied from interface:Build
Returns finish timestamp for the build (server time) ornull
if it hasn't been finished yet.- Specified by:
getFinishDate
in interfaceBuild
- Returns:
- Date/time when the build has been finished,
null
if still running.
-
getCanceledInfo
public CanceledInfo getCanceledInfo()
Description copied from interface:Build
Returns info related to interrupted build. If build is finished, not interrupted, the value is null.- Specified by:
getCanceledInfo
in interfaceBuild
- Returns:
- info about canceled reason and canceler if build was actually interrupted, null otherwise.
-
getDuration
public long getDuration()
Description copied from interface:Build
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- Specified by:
getDuration
in interfaceBuild
- Returns:
- current build duration in seconds
-
getBuildPromotion
@NotNull public BuildPromotionEx getBuildPromotion()
Description copied from interface:BuildPromotionOwner
Returns build promotion- Specified by:
getBuildPromotion
in interfaceBuildEx
- Specified by:
getBuildPromotion
in interfaceBuildPromotionOwner
- Specified by:
getBuildPromotion
in interfaceRunningBuildEx
- Returns:
- see above.
-
getBuildProblems
@NotNull public List<BuildProblem> getBuildProblems()
Description copied from interface:BuildEx
Returns all build problems for this promotion with extended information about muting This method can perform rather slow as it reloads build problems from database and fills mute info from audit (reads database as well) If you don't need mute info try usingSBuild.getFailureReasons()
- Specified by:
getBuildProblems
in interfaceBuildEx
- Returns:
- see above
-
deleteBuildProblem
public void deleteBuildProblem(@NotNull SUser user, @NotNull String identity, @Nullable String comment)
Description copied from interface:BuildEx
Deletes build problem Deleting build problem may change build status to SUCCESS- Specified by:
deleteBuildProblem
in interfaceBuildEx
- Parameters:
user
- user that will be used in auditidentity
- identiry of build problem to be removedcomment
- comment for audit
-
muteBuildProblems
public void muteBuildProblems(boolean muteIfTrue)
Description copied from interface:BuildEx
Makes all existing build problems enabled or disabled- Specified by:
muteBuildProblems
in interfaceBuildEx
- Parameters:
muteIfTrue
- pass true to make build successful, false to make existing problems visible again
-
buildProblemsChanged
public void buildProblemsChanged(@NotNull List<BuildProblemData> before, @NotNull List<BuildProblemData> after)
Description copied from interface:BuildEx
Called when build problems are changed (added, deleted or muted)- Specified by:
buildProblemsChanged
in interfaceBuildEx
- Parameters:
before
- problems before changeafter
- problems after change
-
getCachedShortStatistics
@Nullable public ShortStatistics getCachedShortStatistics(boolean calculateIfAbsent)
Description copied from interface:BuildEx
Return cached short statistics for this build.- Specified by:
getCachedShortStatistics
in interfaceBuildEx
- Parameters:
calculateIfAbsent
- if true, then statistics is calculated if it is not cached yet, if false and there is no statistics in cache, then null is returned- Returns:
- see above
-
isTimedOut
public boolean isTimedOut()
- Specified by:
isTimedOut
in interfaceBuildEx
- Returns:
- true if this build finished by timeout
-
getDurationOnAgent
public long getDurationOnAgent()
- Specified by:
getDurationOnAgent
in interfaceBuildEx
- Returns:
- build duration in seconds on agent or 0 if the build wasn't running on agent
-
start
public void start(boolean async)
Description copied from interface:RunningBuildEx
Must be invoked only once when build starts.- Specified by:
start
in interfaceRunningBuildEx
-
finish
public boolean finish()
Description copied from interface:RunningBuildEx
The method completes the build finishing procedure and should not be called directly in the majority of cases. InsteadSRunningBuild.finish(Date)
method should be used to finish the build.- Specified by:
finish
in interfaceRunningBuildEx
-
finishImmediately
public void finishImmediately(@NotNull Date finishDate, boolean failed)
Description copied from interface:RunningBuildEx
For tests only!- Specified by:
finishImmediately
in interfaceRunningBuildEx
-
finishedOnOtherNode
public void finishedOnOtherNode()
- Specified by:
finishedOnOtherNode
in interfaceRunningBuildEx
-
runUnlessFinished
public boolean runUnlessFinished(Runnable runnable)
Description copied from interface:RunningBuildEx
Executes specified runnable if build is not finished. Build won't finish until runnable completes.- Specified by:
runUnlessFinished
in interfaceRunningBuildEx
- Parameters:
runnable
- runnable- Returns:
- true if runnable was executed
-
createAgentBuild
@NotNull public AgentBuild createAgentBuild()
Description copied from interface:RunningBuildEx
Creates structure containing all of the parameters which should be sent to an agent- Specified by:
createAgentBuild
in interfaceRunningBuildEx
- Returns:
-
getTestRunMuter
public TestRunMuter getTestRunMuter()
Description copied from interface:RunningBuildEx
Returns a special service that allows to mute test run if neccessary.- Specified by:
getTestRunMuter
in interfaceRunningBuildEx
- Returns:
- an instance of the test run muter.
-
getSequenceBuild
@Nullable public SBuild getSequenceBuild()
Description copied from interface:BuildPromotionOwner
If 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:
getSequenceBuild
in interfaceBuildPromotionOwner
- Returns:
- sequence build for the same changes as for associated build promotion, or null if there are no such a build
-
getParametersProvider
@NotNull public ParametersProvider getParametersProvider()
Description copied from interface:ParametersSupport
Returns 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:
getParametersProvider
in interfaceParametersSupport
- Returns:
- parameters
-
getEstimationForTimeLeft
public long getEstimationForTimeLeft()
Description copied from interface:RunningBuild
Returns server estimation for this build remaining time.- Specified by:
getEstimationForTimeLeft
in interfaceRunningBuild
- Specified by:
getEstimationForTimeLeft
in interfaceRunningBuildInfo
- Returns:
- estimation for time left to finish the build in seconds or -1 if estimate is not available.
-
getBuildPromotionInfo
@NotNull public BuildPromotionInfo getBuildPromotionInfo()
- Specified by:
getBuildPromotionInfo
in interfaceRunningBuildInfo
- Returns:
- Returns build promotion, associated with this running build
-
occupiesAgent
public boolean occupiesAgent()
- Specified by:
occupiesAgent
in interfaceRunningBuildInfo
- Returns:
- true if the build executes on the agent.
-
getDurationEstimate
public long getDurationEstimate()
Description copied from interface:RunningBuild
Returns server estimation for this build duration in seconds.- Specified by:
getDurationEstimate
in interfaceRunningBuild
- Returns:
- build duration estimation in seconds or -1 if estimate is not available.
-
getDurationOvertime
public long getDurationOvertime()
Description copied from interface:RunningBuild
Returns how much in seconds this build duration exceeded estimated duration.- Specified by:
getDurationOvertime
in interfaceRunningBuild
- Returns:
- how much in seconds this build duration exceeded estimated duration or -1 if estimate is not available.
-
getElapsedTime
public long getElapsedTime()
Description copied from interface:RunningBuild
Returns elapsed time for this build.- Specified by:
getElapsedTime
in interfaceRunningBuild
- Returns:
- elapsed time for this build in seconds.
-
setCustomStatusText
public void setCustomStatusText(@NotNull String text)
Description copied from interface:RunningBuildEx
Sets the custom build status text.- Specified by:
setCustomStatusText
in interfaceRunningBuildEx
- Parameters:
text
- new build status text. Supports "{build.status.text}" placeholder to be substituted with the default text
-
startBuildFailureChecker
public void startBuildFailureChecker()
Description copied from interface:RunningBuildEx
Initialize periodical build failue checker process- Specified by:
startBuildFailureChecker
in interfaceRunningBuildEx
-
stopBuildFailureChecker
public void stopBuildFailureChecker()
Description copied from interface:RunningBuildEx
Stop periodical failure checker process- Specified by:
stopBuildFailureChecker
in interfaceRunningBuildEx
-
finish
public void finish(@NotNull Date finishDate)
Description copied from interface:SRunningBuild
Finalizes 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:
finish
in interfaceSRunningBuild
- Parameters:
finishDate
- finish date
-
-