Class RunningBuildImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.BaseBuild
-
- jetbrains.buildServer.serverSide.impl.BaseRunningBuild
-
- jetbrains.buildServer.serverSide.impl.RunningBuildImpl
-
- All Implemented Interfaces:
Build,RunningBuild,RunningBuildInfo,BuildEx,BuildPromotionOwner,ParametersSupport,RunningBuildEx,SBuild,SRunningBuild
- Direct Known Subclasses:
SecuredRunningBuild
public class RunningBuildImpl extends BaseRunningBuild implements RunningBuildEx
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jetbrains.buildServer.serverSide.impl.BaseRunningBuild
BaseRunningBuild.ArtifactsStats
-
-
Field Summary
-
Fields inherited from class jetbrains.buildServer.serverSide.impl.BaseRunningBuild
myLastUpdateTimestamp, myStatusText, OLD_UNEXPECTED_FINISH
-
Fields inherited from class jetbrains.buildServer.serverSide.impl.BaseBuild
myBuildId, myContext, myStatsCallCounter, REMOTE_ARTIFACTS_PREFIX
-
Fields inherited from interface jetbrains.buildServer.serverSide.RunningBuildEx
DEPENDENCIES_SKIP_ENABLED
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRunningBuildImpl(BuildPromotionEx buildPromotion, RunningBuildData runningBuildData, BuildContext context)Used for loading the build from DB.protectedRunningBuildImpl(BuildPromotionEx buildPromotion, SAgentRestrictor queuedAgentRestrictor, String rawTriggeredBy, int agentId, int agentTypeId, BuildContext context)
-
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.voidbuildPatch(OutputStream stream, FullCheckoutFlag fullCheckoutFlag, boolean personalChanges, AgentCheckoutDirRevisionInfo workDirState)voidbuildPersonalPatch(OutputStream stream, long personalChangeId, AgentCheckoutDirRevisionInfo workDirState)voidclearCachedEstimate()voidcloseBuildLog()Closes the build log's root block, flushes messages and closes the build logBuildAgentExcomputeAgentlessBuildAgent()booleancomputeProbablyHanging(long currentTime)AgentBuildcreateAgentBuild()Creates structure containing all of the parameters which should be sent to an agentvoiddetachedFromAgent()Should be called when the build has been detached from the agent and agent can start some other buildprotected booleandoBuildFinish()voidfinish(Date finishDate)Finalizes all build related activities and finishes the build.voidfinishedOnOtherNode()voidfinishImmediately(Date finishDate, boolean failed)For tests only!BuildAgentExgetAgent()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.ArtifactsUploadLimitgetArtifactsLimit()BuildConfigurationInfogetBuildConfiguration()longgetBuildCounter()BuildLogExgetBuildLog()Returns build log.BuildLogExgetBuildLogIfInitialized()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.BuildPromotionInfogetBuildPromotionInfo()ShortStatisticsgetCachedShortStatistics(boolean calculateIfAbsent)Return cached short statistics for this build.intgetCompletedPercent()intgetCompletedPercent(long currentTime)StringgetCurrentPath()Returns short description of current running step.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.longgetElapsedTime(long currentTime)longgetEstimatedDurationExceededTime(long currentTime)longgetEstimationForTimeLeft()Returns server estimation for this build remaining time.longgetEstimationForTimeLeft(long currentTime)DategetFinishDate()Returns finish timestamp for the build (server time) ornullif it hasn't been finished yet.DategetLastBuildActivityTimestamp()StringgetProgressText()StringgetProjectExternalId()Returns external id of the project this build belongs to.StringgetProjectId()Returns internal id of the project this build belongs to.IntegergetQueuedAgentId()SAgentRestrictorgetQueuedAgentRestrictor()Returns an agent restrictor this build was queued with (when build configuration was added to queue).StringgetRawBuildNumber()Returns raw build number (i.e.Map<String,Boolean>getRunnersState()StatusDescriptorgetStatusDescriptor()Returns status descriptor of the buildList<TestInfo>getTestMessages(int skipTests, int maxTestsToLoad)Retrieves information about tests failed in the build.TestRunMutergetTestRunMuter()Returns a special service that allows to mute test run if neccessary.longgetTimeSpentSinceLastBuildActivity()Returns time in seconds spent since last build activity.UserDataStoragegetUserDataStorage()Use this object to associate some data with the current instance.protected voidinitialize(boolean newBuild)booleanisCompositeBuild()Returns true if this build is a composite build.booleanisFinished()booleanisFinishReceived()booleanisProbablyHanging()Returns true if server thinks this build has hung.booleanisStarting()Returns true if the build is trying to start on an agent and runBuild() command has not finished yetvoidmarkAsFinished(Date finishDate, boolean failed)voidmarkAsFinishedUnexpectedly(String reason)voidmuteBuildProblems(boolean muteIfTrue)Makes all existing build problems enabled or disabledbooleanoccupiesAgent()voidprepareArtifactDependencies()Resolves artifact dependencies by replacing "latest" rules with actual build ids.voidpublishArtifact(String path, byte[] content)Adds artifact to the build by the specified pathvoidpublishArtifact(String path, File srcFile)Adds artifact to the build by the specified pathvoidpublishArtifact(String path, File srcFile, PublishArtifactProgressListener progressListener)Adds artifact to the build from the specified file allowing to trace progressvoidpublishArtifact(String path, InputStream is)Adds artifact to the build by the specified pathvoidpublishArtifact(String path, InputStream source, PublishArtifactProgressListener progressListener)Adds artifact to the build from the specified stream allowing to trace progressvoidresetAgentCache()Resets internal cache of agent instancebooleanrunUnlessFinished(Runnable action)Executes specified runnable if build is not finished.voidserverShutdown()voidserverStartup()voidsetBuildNumber(String newBuildNumber)Set new value for this build build number instead of current one.voidsetBuildStatus(Status status)Set current status of the running build.voidsetStartTimes(Date agentStartTime, Date serverStartTime, TimeZone agentTimeZone)Sets timestamps when command to run build was sent to an agent.voidstart(boolean async)Must be invoked only once when build starts.voidstop(RunningBuildState interruptedState, User user, String comment, boolean reAdd2Queue)voidstopNoInterrupt()Stops build on server and on agent without making it interruptedStringtoString()voidupdateBuild()booleanupdateBuildInfo()Loads build interruption and build finish timestamps from database into the build.-
Methods inherited from class jetbrains.buildServer.serverSide.impl.BaseRunningBuild
addRemoteArtifact, createSettingsDigest, finish, getArtifactsStats, getBuildDescription, getBuildPromotion, getCanceledInfo, getCompletedStages, getDependencyGraph, getHangingDependency, getLastUpdateDelayMsecs, getRunningState, getStatisticValuesCollection, initCurrentStatisticValues, isInterrupted, loadCancelledInfoFromDB, logFinalMessages, notifyOnBuildProblemsChanged, resolveArtifactDependencies, setCanceledInfo, setCustomStatusText, setInterrupted, skipBuildChainBuilds, startBuildFailureChecker, stop, stopBuildFailureChecker, updateBuildIfLastUpdateExpired, updateBuildStatisticValues, writeFinishProperties, writeSettingsDigestFile
-
Methods inherited from class jetbrains.buildServer.serverSide.impl.BaseBuild
addBuildProblem, addUserBuildProblem, buildProblemsChanged, convertToAgentTime, convertToServerTime, createShortStatistics, deleteBuildProblem, doGetBuildFinishParameters, doGetBuildStartParameters, getArtifactDependencies, getArtifacts, getArtifactsDirectory, getAuditLogFactory, getAuditLogProvider, getBranch, getBuildComment, getBuildContext, getBuildFeaturesOfType, getBuildFinishParameters, getBuildId, getBuildNumberParameters, getBuildNumberWithoutRefs, getBuildProblems, getBuildStartParameters, getBuildStatistics, getBuildStatus, getBuildType, getBuildTypeExternalId, getBuildTypeId, getBuildTypeName, getChanges, getClientStartDate, getClientTimeZone, getCommitters, getCompilationErrorMessages, getContainingChanges, getCustomDataStorage, getCustomDataStorageIdsByPrefix, getDetachFromAgentReceivedTimestamp, getDownloadedArtifacts, getDuration, getDurationOnAgent, getFailureReasons, getFileContent, getFinishOnAgentDate, getFirstInternalError, getFirstInternalErrorMessage, getFullName, getFullStatistics, getId, getLabels, getLogMessages, getOwner, getParametersProvider, getPreviousFinished, getProvidedArtifacts, getQueuedDate, getRecentlyFinishedBuild, getRelatedIssues, getRemoteArtifacts, getRemoteArtifactsByType, getRevisions, getSequenceBuild, getServerStartDate, getSettingsDigestFile, getSettingsDigestFromFile, getShortStatistics, getStartDate, getStatisticValue, getStatisticValues, getStatus, getTags, getTemporaryCustomDataStorage, getTriggeredBy, getValueResolver, getValueResolver, getValueResolver, getVariablesProvider, getVcsRootEntries, getWaitReasons, hasBuildFinishParameters, hasBuildProblemOfType, hasTests, initMetrics, isAgentLessBuild, isArtifactsExists, isDetachedFromAgent, isHasInternalArtifactsOnly, isHasRelatedIssues, isInternalError, isOutdated, isOutOfChangesSequence, isPersonal, isPersonalPatchAvailable, isPinned, isResponsibleNeeded, isStartedOnAgent, isTimedOut, isUsedByOtherBuilds, muteBuildProblems, now, nowDate, preloadFailedTests, publishStatisticValue, resetBuildFinalParameters, setBuildComment, setBuildStartTimes, setTags, setTags, updateExternalArtifactsInfoOnAccess
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.Build
getBuildId, getBuildStatus, getBuildTypeExternalId, getBuildTypeId, getBuildTypeName, getCanceledInfo, getCompilationErrorMessages, getDuration, getFullName, getLogMessages, getStartDate, isPersonal
-
Methods inherited from interface jetbrains.buildServer.serverSide.BuildPromotionOwner
getSequenceBuild
-
Methods inherited from interface jetbrains.buildServer.serverSide.ParametersSupport
getParametersProvider
-
Methods inherited from interface jetbrains.buildServer.serverSide.RunningBuildEx
finish, getBuildPromotion, getCompletedStages, getDetachFromAgentReceivedTimestamp, getHangingDependency, getStatisticValuesCollection, getTemporaryCustomDataStorage, setCustomStatusText, skipBuildChainBuilds, startBuildFailureChecker, stopBuildFailureChecker, updateBuildIfLastUpdateExpired, updateBuildStatisticValues, updateExternalArtifactsInfoOnAccess, writeSettingsDigestFile
-
Methods inherited from interface jetbrains.buildServer.serverSide.SBuild
addBuildProblem, addUserBuildProblem, convertToAgentTime, convertToServerTime, getArtifactDependencies, getArtifacts, getArtifactsDirectory, getBranch, getBuildComment, getBuildDescription, getBuildFeaturesOfType, getBuildStatistics, getBuildType, getChanges, getClientStartDate, getClientTimeZone, getCommitters, getContainingChanges, getCustomDataStorage, getDownloadedArtifacts, getFailureReasons, getFileContent, getFinishOnAgentDate, getFirstInternalError, getFirstInternalErrorMessage, getFullStatistics, getLabels, getOwner, getPreviousFinished, getProvidedArtifacts, getQueuedDate, getRecentlyFinishedBuild, getRelatedIssues, getRemoteArtifacts, getRemoteArtifactsByType, getRevisions, getServerStartDate, getShortStatistics, getStatisticValue, getStatisticValues, getTags, getTriggeredBy, getValueResolver, getVcsRootEntries, getWaitReasons, hasBuildProblemOfType, hasTests, isAgentLessBuild, isArtifactsExists, isDetachedFromAgent, isHasInternalArtifactsOnly, isHasRelatedIssues, isInternalError, isOutdated, isOutOfChangesSequence, isPinned, isResponsibleNeeded, isStartedOnAgent, isUsedByOtherBuilds, muteBuildProblems, setBuildComment, setTags, setTags
-
Methods inherited from interface jetbrains.buildServer.serverSide.SRunningBuild
addRemoteArtifact, isInterrupted, setInterrupted, stop
-
-
-
-
Constructor Detail
-
RunningBuildImpl
protected RunningBuildImpl(@NotNull BuildPromotionEx buildPromotion, @Nullable SAgentRestrictor queuedAgentRestrictor, String rawTriggeredBy, int agentId, int agentTypeId, @NotNull BuildContext context)- Throws:
IllegalArgumentException- ifbuildPromotionis a composite one.
-
RunningBuildImpl
protected RunningBuildImpl(@NotNull BuildPromotionEx buildPromotion, RunningBuildData runningBuildData, @NotNull BuildContext context)Used for loading the build from DB.- Throws:
IllegalArgumentException- ifbuildPromotionis a composite one.
-
-
Method Detail
-
initialize
protected void initialize(boolean newBuild)
-
prepareArtifactDependencies
public void prepareArtifactDependencies()
Description copied from interface:RunningBuildExResolves artifact dependencies by replacing "latest" rules with actual build ids.- Specified by:
prepareArtifactDependenciesin interfaceRunningBuildEx
-
getBuildConfiguration
@Nullable public BuildConfigurationInfo getBuildConfiguration()
- Specified by:
getBuildConfigurationin interfaceRunningBuildInfo- Returns:
- the corresponding build configuration or null if the configuration has been concurrently deleted
-
getAgent
@NotNull public BuildAgentEx 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 interfaceRunningBuildInfo- Specified by:
getAgentin interfaceSBuild- Specified by:
getAgentin interfaceSRunningBuild- Specified by:
getAgentin classBaseRunningBuild- Returns:
- agent where this build executed.
-
computeAgentlessBuildAgent
@NotNull public BuildAgentEx computeAgentlessBuildAgent()
-
getQueuedAgentRestrictor
@Nullable public SAgentRestrictor getQueuedAgentRestrictor()
Description copied from interface:RunningBuildExReturns 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 interfaceRunningBuildEx- Specified by:
getQueuedAgentRestrictorin interfaceSRunningBuild- Returns:
- see above
-
getQueuedAgentId
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
-
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.
-
addBuildMessage
public void addBuildMessage(@NotNull BuildMessage1 message)Description copied from interface:RunningBuildExAdds new message from server to the build.- Specified by:
addBuildMessagein interfaceRunningBuildEx- Specified by:
addBuildMessagein interfaceSRunningBuild
-
getProgressText
@NotNull public String getProgressText()
- Specified by:
getProgressTextin interfaceRunningBuildEx- Returns:
- current progress text calculated for the build; this text is used in build status line
-
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.
-
getFinishDate
@Nullable 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.
-
doBuildFinish
protected boolean doBuildFinish()
- Overrides:
doBuildFinishin classBaseRunningBuild
-
finishedOnOtherNode
public void finishedOnOtherNode()
- Specified by:
finishedOnOtherNodein interfaceRunningBuildEx- Overrides:
finishedOnOtherNodein classBaseRunningBuild
-
runUnlessFinished
public boolean runUnlessFinished(@NotNull Runnable action)Description copied from interface:RunningBuildExExecutes specified runnable if build is not finished. Build won't finish until runnable completes.- Specified by:
runUnlessFinishedin interfaceRunningBuildEx- Parameters:
action- runnable- Returns:
- true if runnable was executed
-
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
-
getCachedShortStatistics
@Nullable public ShortStatistics getCachedShortStatistics(boolean calculateIfAbsent)
Description copied from interface:BuildExReturn cached short statistics for this build.- Specified by:
getCachedShortStatisticsin 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
-
updateBuild
public void updateBuild()
- Specified by:
updateBuildin interfaceRunningBuildEx
-
updateBuildInfo
public boolean updateBuildInfo()
Description copied from interface:RunningBuildExLoads build interruption and build finish timestamps from database into the build. Returns true if running build exists in DB and false otherwise.- Specified by:
updateBuildInfoin interfaceRunningBuildEx
-
clearCachedEstimate
@TestOnly public void clearCachedEstimate()
-
getProjectId
@Nullable 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
@Nullable 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
-
setStartTimes
public void setStartTimes(@NotNull Date agentStartTime, @NotNull Date serverStartTime, @NotNull TimeZone agentTimeZone)Description copied from interface:RunningBuildExSets timestamps when command to run build was sent to an agent.- Specified by:
setStartTimesin interfaceRunningBuildEx- Parameters:
agentStartTime- agent timestampserverStartTime- server timestamp
-
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
-
getCompletedPercent
public int getCompletedPercent(long currentTime)
-
getEstimationForTimeLeft
public long getEstimationForTimeLeft()
Description copied from interface:RunningBuildReturns server estimation for this build remaining time.- Specified by:
getEstimationForTimeLeftin interfaceRunningBuild- Specified by:
getEstimationForTimeLeftin 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:
getBuildPromotionInfoin interfaceRunningBuildInfo- Returns:
- Returns build promotion, associated with this running build
-
occupiesAgent
public boolean occupiesAgent()
- Specified by:
occupiesAgentin interfaceRunningBuildInfo- Returns:
- true if the build executes on the agent.
-
getEstimationForTimeLeft
public long getEstimationForTimeLeft(long currentTime)
-
isFinishReceived
public boolean isFinishReceived()
- Specified by:
isFinishReceivedin interfaceRunningBuildEx- Returns:
- true if build finished was received by the server.
-
publishArtifact
public final void publishArtifact(@NotNull String path, @NotNull byte[] content) throws IOExceptionDescription copied from interface:RunningBuildExAdds artifact to the build by the specified path- Specified by:
publishArtifactin interfaceRunningBuildEx- Parameters:
path- path where to store artifactcontent- artifact content- Throws:
IOException
-
publishArtifact
public final void publishArtifact(@NotNull String path, @NotNull File srcFile) throws IOExceptionDescription copied from interface:RunningBuildExAdds artifact to the build by the specified path- Specified by:
publishArtifactin 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 final void publishArtifact(@NotNull String path, @NotNull File srcFile, @Nullable PublishArtifactProgressListener progressListener) throws IOExceptionDescription copied from interface:RunningBuildExAdds artifact to the build from the specified file allowing to trace progress- Specified by:
publishArtifactin 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- Throws:
IOException
-
publishArtifact
public final void publishArtifact(@NotNull String path, @NotNull InputStream is) throws IOExceptionDescription copied from interface:RunningBuildExAdds artifact to the build by the specified path- Specified by:
publishArtifactin interfaceRunningBuildEx- Parameters:
path- path where to store artifact- Throws:
IOException
-
publishArtifact
public final void publishArtifact(@NotNull String path, @NotNull InputStream source, @Nullable PublishArtifactProgressListener progressListener) throws IOExceptionDescription copied from interface:RunningBuildExAdds artifact to the build from the specified stream allowing to trace progress- Specified by:
publishArtifactin interfaceRunningBuildEx- Parameters:
path- path where to store artifactprogressListener- PublishArtifactProgressListener to track progress- Throws:
IOException
-
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.
-
getEstimatedDurationExceededTime
public long getEstimatedDurationExceededTime(long currentTime)
-
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.
-
getElapsedTime
public long getElapsedTime(long currentTime)
-
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
-
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
-
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- Overrides:
getTestMessagesin classBaseBuild- 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
-
isFinished
public boolean isFinished()
- Specified by:
isFinishedin interfaceBuild- Returns:
- true if the build was finished and was saved to the history
-
getBuildLog
@NotNull public BuildLogEx getBuildLog()
Description copied from interface:SBuildReturns build log.- Specified by:
getBuildLogin interfaceBuildEx- Specified by:
getBuildLogin interfaceRunningBuildEx- Specified by:
getBuildLogin interfaceSBuild- Returns:
- build log.
-
getBuildLogIfInitialized
@Nullable public BuildLogEx getBuildLogIfInitialized()
- Specified by:
getBuildLogIfInitializedin interfaceRunningBuildEx
-
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
-
createAgentBuild
@NotNull public AgentBuild createAgentBuild() throws BuildTypeNotFoundException
Description copied from interface:RunningBuildExCreates structure containing all of the parameters which should be sent to an agent- Specified by:
createAgentBuildin interfaceRunningBuildEx- Returns:
- Throws:
BuildTypeNotFoundException
-
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- Specified by:
getRawBuildNumberin classBaseBuild- Returns:
- raw build number which can contain unresolved parameters
-
getBuildCounter
public long getBuildCounter()
- Specified by:
getBuildCounterin interfaceRunningBuildEx- Specified by:
getBuildCounterin classBaseBuild- Returns:
- value of build counter when this build started
-
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
-
computeProbablyHanging
public boolean computeProbablyHanging(long currentTime)
-
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
-
start
public void start(boolean async)
Description copied from interface:RunningBuildExMust be invoked only once when build starts.- Specified by:
startin interfaceRunningBuildEx
-
isStarting
public boolean isStarting()
Description copied from interface:RunningBuildExReturns true if the build is trying to start on an agent and runBuild() command has not finished yet- Specified by:
isStartingin interfaceRunningBuildEx- Returns:
-
stop
public void stop(@NotNull RunningBuildState interruptedState, @Nullable User user, @NotNull String comment, boolean reAdd2Queue)- Specified by:
stopin 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)
-
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
-
stopNoInterrupt
public final void stopNoInterrupt()
Description copied from interface:RunningBuildExStops build on server and on agent without making it interrupted- Specified by:
stopNoInterruptin interfaceRunningBuildEx
-
buildPatch
public void buildPatch(OutputStream stream, @NotNull FullCheckoutFlag fullCheckoutFlag, boolean personalChanges, @NotNull AgentCheckoutDirRevisionInfo workDirState) throws IOException
- Specified by:
buildPatchin interfaceRunningBuildEx- Throws:
IOException
-
buildPersonalPatch
public void buildPersonalPatch(OutputStream stream, long personalChangeId, @NotNull AgentCheckoutDirRevisionInfo workDirState) throws IOException
- Specified by:
buildPersonalPatchin interfaceRunningBuildEx- Throws:
IOException
-
getAgentId
public int getAgentId()
- Specified by:
getAgentIdin interfaceSRunningBuild- Returns:
- id of the agent where this build is running; returns -1 for agent less builds
-
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- Overrides:
getBuildOwnParametersin classBaseBuild- Returns:
- set of build parameters known on the server-side for the build.
-
getTestRunMuter
@NotNull public TestRunMuter getTestRunMuter()
Description copied from interface:RunningBuildExReturns a special service that allows to mute test run if neccessary.- Specified by:
getTestRunMuterin interfaceRunningBuildEx- Returns:
- an instance of the test run muter.
-
getUserDataStorage
@NotNull public UserDataStorage getUserDataStorage()
Description copied from interface:RunningBuildExUse 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:
getUserDataStoragein interfaceRunningBuildEx- Returns:
- user data holder
-
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
-
muteBuildProblems
public void muteBuildProblems(boolean muteIfTrue)
Description copied from interface:BuildExMakes all existing build problems enabled or disabled- Specified by:
muteBuildProblemsin interfaceBuildEx- Overrides:
muteBuildProblemsin classBaseBuild- Parameters:
muteIfTrue- pass true to make build successful, false to make existing problems visible again
-
markAsFinished
public void markAsFinished(@NotNull Date finishDate, boolean failed)- Specified by:
markAsFinishedin interfaceRunningBuildEx
-
markAsFinishedUnexpectedly
public void markAsFinishedUnexpectedly(@NotNull String reason)- Specified by:
markAsFinishedUnexpectedlyin interfaceRunningBuildEx
-
finishImmediately
public void finishImmediately(@NotNull Date finishDate, boolean failed)Description copied from interface:RunningBuildExFor tests only!- Specified by:
finishImmediatelyin interfaceRunningBuildEx
-
resetAgentCache
public void resetAgentCache()
Description copied from interface:RunningBuildExResets internal cache of agent instance- Specified by:
resetAgentCachein interfaceRunningBuildEx
-
serverStartup
public void serverStartup()
- Specified by:
serverStartupin interfaceRunningBuildEx
-
serverShutdown
public void serverShutdown()
- Specified by:
serverShutdownin interfaceRunningBuildEx
-
isCompositeBuild
public boolean isCompositeBuild()
Description copied from interface:SBuildReturns true if this build is a composite build.- Specified by:
isCompositeBuildin interfaceSBuild- Returns:
- see above
-
closeBuildLog
public void closeBuildLog()
Description copied from interface:RunningBuildExCloses the build log's root block, flushes messages and closes the build log- Specified by:
closeBuildLogin interfaceRunningBuildEx
-
getArtifactsLimit
@NotNull public ArtifactsUploadLimit getArtifactsLimit()
- Specified by:
getArtifactsLimitin interfaceRunningBuildEx
-
getRunnersState
@NotNull public Map<String,Boolean> getRunnersState() throws BuildTypeNotFoundException
- Specified by:
getRunnersStatein interfaceRunningBuildEx- Throws:
BuildTypeNotFoundException
-
detachedFromAgent
public void detachedFromAgent()
Description copied from interface:RunningBuildExShould be called when the build has been detached from the agent and agent can start some other build- Specified by:
detachedFromAgentin interfaceRunningBuildEx
-
-