Package jetbrains.buildServer.serverSide
Interface RunningBuildEx
-
- All Superinterfaces:
Build
,BuildPromotionOwner
,ParametersSupport
,RunningBuild
,RunningBuildInfo
,SBuild
,SRunningBuild
- All Known Implementing Classes:
BaseRunningBuild
,CompositeRunningBuild
,RunningBuildImpl
,RunningBuildWrapper
,SecuredCompositeRunningBuild
,SecuredRunningBuild
public interface RunningBuildEx extends SRunningBuild, RunningBuildInfo
- Author:
- Sergey.Anchipolevsky Date: 18.06.2007
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEPENDENCIES_SKIP_ENABLED
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addBuildMessage(BuildMessage1 message)
Adds new message from server to the build.void
buildPatch(OutputStream stream, FullCheckoutFlag fullCheckoutFlag, boolean personalChanges, AgentCheckoutDirRevisionInfo workDirState)
void
buildPersonalPatch(OutputStream stream, long personalChangeId, AgentCheckoutDirRevisionInfo workDirState)
void
closeBuildLog()
Closes the build log's root block, flushes messages and closes the build logAgentBuild
createAgentBuild()
Creates structure containing all of the parameters which should be sent to an agentvoid
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
finishedOnOtherNode()
void
finishImmediately(Date finishDate, boolean failed)
For tests only!ArtifactsUploadLimit
getArtifactsLimit()
long
getBuildCounter()
BuildLogEx
getBuildLog()
Returns build log.BuildLogEx
getBuildLogIfInitialized()
BuildPromotionEx
getBuildPromotion()
Returns build promotionMap<String,Long>
getCompletedStages()
Reports target build-type's stages (this build being instance of) that have been already completed by this particular buildLong
getDetachFromAgentReceivedTimestamp()
RunningBuildEx
getHangingDependency()
String
getProgressText()
SAgentRestrictor
getQueuedAgentRestrictor()
Returns an agent restrictor this build was queued with (when build configuration was added to queue).default Map<String,Boolean>
getRunnersState()
StatisticValuesCollection
getStatisticValuesCollection()
CustomDataStorage
getTemporaryCustomDataStorage()
TestRunMuter
getTestRunMuter()
Returns a special service that allows to mute test run if neccessary.UserDataStorage
getUserDataStorage()
Use this object to associate some data with the current instance.boolean
isFinishReceived()
boolean
isStarting()
Returns true if the build is trying to start on an agent and runBuild() command has not finished yetvoid
markAsFinished(Date finishDate, boolean failed)
void
markAsFinishedUnexpectedly(String reason)
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
setCustomStatusText(String text)
Sets the custom build status text.void
setStartTimes(Date agentStartTime, Date serverStartTime, TimeZone agentTimeZone)
Sets timestamps when command to run build was sent to an agent.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
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.-
Methods inherited from interface jetbrains.buildServer.Build
getAgentName, getBuildId, getBuildNumber, getBuildStatus, getBuildTypeExternalId, getBuildTypeId, getBuildTypeName, getCanceledInfo, getCompilationErrorMessages, getDuration, getFinishDate, getFullName, getLogMessages, getProjectExternalId, getProjectId, getStartDate, getStatusDescriptor, getTestMessages, isFinished, isPersonal
-
Methods inherited from interface jetbrains.buildServer.serverSide.BuildPromotionOwner
getSequenceBuild
-
Methods inherited from interface jetbrains.buildServer.serverSide.ParametersSupport
getParametersProvider
-
Methods inherited from interface jetbrains.buildServer.RunningBuild
getDurationEstimate, getDurationOvertime, getElapsedTime, getEstimationForTimeLeft
-
Methods inherited from interface jetbrains.buildServer.serverSide.buildDistribution.RunningBuildInfo
getAgent, getBuildConfiguration, getBuildPromotionInfo, getEstimationForTimeLeft, occupiesAgent
-
Methods inherited from interface jetbrains.buildServer.serverSide.SBuild
addBuildProblem, addUserBuildProblem, convertToAgentTime, convertToServerTime, getArtifactDependencies, getArtifacts, getArtifactsDirectory, getBranch, getBuildComment, getBuildDescription, getBuildFeaturesOfType, getBuildOwnParameters, getBuildStatistics, getBuildType, getChanges, getClientStartDate, getClientTimeZone, getCommitters, getContainingChanges, getCustomDataStorage, getDownloadedArtifacts, getFailureReasons, getFileContent, getFinishOnAgentDate, getFirstInternalError, getFirstInternalErrorMessage, getFullStatistics, getLabels, getOwner, getPreviousFinished, getProvidedArtifacts, getQueuedDate, getRawBuildNumber, getRecentlyFinishedBuild, getRelatedIssues, getRemoteArtifacts, getRemoteArtifactsByType, getRevisions, getServerStartDate, getShortStatistics, getStatisticValue, getStatisticValues, getTags, getTriggeredBy, getValueResolver, getVcsRootEntries, getWaitReasons, hasBuildProblemOfType, hasTests, isAgentLessBuild, isArtifactsExists, isCompositeBuild, isDetachedFromAgent, isHasInternalArtifactsOnly, isHasRelatedIssues, isInternalError, isOutdated, isOutOfChangesSequence, isPinned, isResponsibleNeeded, isStartedOnAgent, isUsedByOtherBuilds, muteBuildProblems, setBuildComment, setTags, setTags
-
Methods inherited from interface jetbrains.buildServer.serverSide.SRunningBuild
addBuildMessages, addRemoteArtifact, finish, getAgent, getAgentAccessCode, getAgentId, getCompletedPercent, getCurrentPath, getLastBuildActivityTimestamp, getQueuedAgentId, getTimeSpentSinceLastBuildActivity, isInterrupted, isProbablyHanging, setBuildNumber, setBuildStatus, setInterrupted, stop
-
-
-
-
Field Detail
-
DEPENDENCIES_SKIP_ENABLED
static final String DEPENDENCIES_SKIP_ENABLED
- See Also:
- Constant Field Values
-
-
Method Detail
-
buildPatch
void buildPatch(OutputStream stream, @NotNull FullCheckoutFlag fullCheckoutFlag, boolean personalChanges, @NotNull AgentCheckoutDirRevisionInfo workDirState) throws IOException
- Throws:
IOException
-
buildPersonalPatch
void buildPersonalPatch(OutputStream stream, long personalChangeId, @NotNull AgentCheckoutDirRevisionInfo workDirState) throws IOException
- Throws:
IOException
-
setStartTimes
void setStartTimes(@NotNull Date agentStartTime, @NotNull Date serverStartTime, @NotNull TimeZone agentTimeZone)
Sets timestamps when command to run build was sent to an agent.- Parameters:
agentStartTime
- agent timestampserverStartTime
- server timestamp
-
updateBuild
void updateBuild()
-
updateBuildIfLastUpdateExpired
void updateBuildIfLastUpdateExpired(int expirationTimeSeconds)
Performs update of the build data but only if some time has passed since the last update.- Parameters:
expirationTimeSeconds
- time threshold since the last update in seconds
-
updateBuildInfo
boolean updateBuildInfo()
Loads build interruption and build finish timestamps from database into the build. Returns true if running build exists in DB and false otherwise.
-
updateBuildStatisticValues
void updateBuildStatisticValues()
Loads statistic values reported for the build from database and sends events on every new loaded value
-
updateExternalArtifactsInfoOnAccess
void updateExternalArtifactsInfoOnAccess()
-
addBuildMessage
void addBuildMessage(@NotNull BuildMessage1 message)
Adds new message from server to the build.- Specified by:
addBuildMessage
in interfaceSRunningBuild
-
setCustomStatusText
void setCustomStatusText(@NotNull String text)
Sets the custom build status text.- Parameters:
text
- new build status text. Supports "{build.status.text}" placeholder to be substituted with the default text- Since:
- 2018.1
-
getBuildPromotion
@NotNull BuildPromotionEx getBuildPromotion()
Description copied from interface:BuildPromotionOwner
Returns build promotion- Specified by:
getBuildPromotion
in interfaceBuildPromotionOwner
- Returns:
- see above.
-
start
void start(boolean async)
Must be invoked only once when build starts.
-
finish
boolean finish()
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.
-
finishImmediately
void finishImmediately(@NotNull Date finishDate, boolean failed)
For tests only!
-
finishedOnOtherNode
void finishedOnOtherNode()
-
runUnlessFinished
boolean runUnlessFinished(Runnable runnable)
Executes specified runnable if build is not finished. Build won't finish until runnable completes.- Parameters:
runnable
- runnable- Returns:
- true if runnable was executed
-
createAgentBuild
@NotNull AgentBuild createAgentBuild()
Creates structure containing all of the parameters which should be sent to an agent- Returns:
-
getTestRunMuter
TestRunMuter getTestRunMuter()
Returns a special service that allows to mute test run if neccessary.- Returns:
- an instance of the test run muter.
-
getQueuedAgentRestrictor
@Nullable SAgentRestrictor getQueuedAgentRestrictor()
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 interfaceSRunningBuild
- Returns:
- see above
- Since:
- 7.0
-
getUserDataStorage
@NotNull UserDataStorage getUserDataStorage()
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.- Returns:
- user data holder
- Since:
- 7.0
-
getCompletedStages
@NotNull Map<String,Long> getCompletedStages()
Reports target build-type's stages (this build being instance of) that have been already completed by this particular build- Returns:
- mapping from stage-names to respective durations
-
isFinishReceived
boolean isFinishReceived()
- Returns:
- true if build finished was received by the server.
-
markAsFinished
void markAsFinished(@NotNull Date finishDate, boolean failed)
-
markAsFinishedUnexpectedly
void markAsFinishedUnexpectedly(@NotNull String reason)
-
publishArtifact
void publishArtifact(@NotNull String path, @NotNull byte[] content) throws IOException
Adds artifact to the build by the specified path- Parameters:
path
- path where to store artifactcontent
- artifact content- Throws:
IOException
- Since:
- 10.0
-
publishArtifact
void publishArtifact(@NotNull String path, @NotNull File srcFile) throws IOException
Adds artifact to the build by the specified path- Parameters:
path
- path where to store artifactsrcFile
- file containing artifact content; note that after the publishing srcFile can be removed- Throws:
IOException
- Since:
- 10.0
-
publishArtifact
void publishArtifact(@NotNull String path, @NotNull InputStream is, @Nullable PublishArtifactProgressListener progressListener) throws IOException
Adds artifact to the build from the specified stream allowing to trace progress- Parameters:
path
- path where to store artifactInputStream
- input stream with artifact content; note that this method does not close input streamprogressListener
- PublishArtifactProgressListener to track progress- Throws:
IOException
-
publishArtifact
void publishArtifact(@NotNull String path, @NotNull File srcFile, @Nullable PublishArtifactProgressListener progressListener) throws IOException
Adds artifact to the build from the specified file allowing to trace progress- 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
void publishArtifact(@NotNull String path, @NotNull InputStream is) throws IOException
Adds artifact to the build by the specified path- Parameters:
path
- path where to store artifactInputStream
- input stream with artifact content; note that this method does not close input stream- Throws:
IOException
- Since:
- 10.0
-
getBuildCounter
long getBuildCounter()
- Returns:
- value of build counter when this build started
-
getProgressText
@NotNull String getProgressText()
- Returns:
- current progress text calculated for the build; this text is used in build status line
- Since:
- 10.0
-
stopNoInterrupt
void stopNoInterrupt()
Stops build on server and on agent without making it interrupted
-
stop
void stop(@NotNull RunningBuildState interruptedState, @Nullable User user, @NotNull String comment, boolean reAdd2Queue) throws AccessDeniedException
- 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)- Throws:
AccessDeniedException
- Since:
- 2019.1
-
getArtifactsLimit
@NotNull ArtifactsUploadLimit getArtifactsLimit()
-
resetAgentCache
void resetAgentCache()
Resets internal cache of agent instance
-
serverStartup
void serverStartup()
-
serverShutdown
void serverShutdown()
-
startBuildFailureChecker
void startBuildFailureChecker()
Initialize periodical build failue checker process- Since:
- 2019.1.2
-
stopBuildFailureChecker
void stopBuildFailureChecker()
Stop periodical failure checker process- Since:
- 2020.1
-
getHangingDependency
@Nullable RunningBuildEx getHangingDependency()
- Returns:
- Traverses through running snapshot dependencies of this build and returns the first found one which is probably hanging.
- Since:
- 2017.2
-
closeBuildLog
void closeBuildLog()
Closes the build log's root block, flushes messages and closes the build log- Since:
- 2018.2
-
getRunnersState
@NotNull default Map<String,Boolean> getRunnersState() throws BuildTypeNotFoundException
- Throws:
BuildTypeNotFoundException
-
detachedFromAgent
void detachedFromAgent()
Should be called when the build has been detached from the agent and agent can start some other build- Since:
- 2020.2
-
getDetachFromAgentReceivedTimestamp
@Nullable Long getDetachFromAgentReceivedTimestamp()
- Returns:
- timestamp when this build was attempted to detach from agent
- Since:
- 2020.2
-
getStatisticValuesCollection
@NotNull StatisticValuesCollection getStatisticValuesCollection()
-
writeSettingsDigestFile
void writeSettingsDigestFile() throws IllegalStateException
Writes the value of theBuildAttributes.SETTINGS_DIGEST
to a file under the build artifacts directory.- Throws:
IllegalStateException
- if attribute is not set to the build
-
prepareArtifactDependencies
void prepareArtifactDependencies()
Resolves artifact dependencies by replacing "latest" rules with actual build ids.
-
isStarting
boolean isStarting()
Returns true if the build is trying to start on an agent and runBuild() command has not finished yet- Returns:
-
getTemporaryCustomDataStorage
@NotNull CustomDataStorage getTemporaryCustomDataStorage()
- Returns:
- a temporary custom data storage which exists only while the build is running and is disposed once the build is finished
- Since:
- 2022.04
-
getBuildLog
@NotNull BuildLogEx getBuildLog()
Description copied from interface:SBuild
Returns build log.- Specified by:
getBuildLog
in interfaceSBuild
- Returns:
- build log.
-
getBuildLogIfInitialized
@Nullable BuildLogEx getBuildLogIfInitialized()
-
skipBuildChainBuilds
void skipBuildChainBuilds(@NotNull List<String> externalIdsOrTags, @NotNull 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.- 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- Since:
- 2024.12
-
-