Class BaseRunningBuild
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.BaseBuild
-
- jetbrains.buildServer.serverSide.impl.BaseRunningBuild
-
- All Implemented Interfaces:
Build
,RunningBuild
,RunningBuildInfo
,BuildEx
,BuildPromotionOwner
,ParametersSupport
,RunningBuildEx
,SBuild
,SRunningBuild
- Direct Known Subclasses:
CompositeRunningBuild
,RunningBuildImpl
public abstract class BaseRunningBuild extends BaseBuild implements RunningBuildEx
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BaseRunningBuild.ArtifactsStats
-
Field Summary
Fields Modifier and Type Field Description protected Date
myLastUpdateTimestamp
protected String
myStatusText
static String
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 protected
BaseRunningBuild(long buildId, String rawTriggeredBy, BuildPromotionEx buildPromotion, BuildContext context)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addRemoteArtifact(RemoteArtifact artifact)
Adds information about remote artifact to this buildprotected void
createSettingsDigest()
protected boolean
doBuildFinish()
boolean
finish()
The method completes the build finishing procedure and should not be called directly in the majority of cases.void
finishedOnOtherNode()
abstract BuildAgentEx
getAgent()
Get build agent this running build is running on.BaseRunningBuild.ArtifactsStats
getArtifactsStats()
String
getBuildDescription()
Returns build description set to this build explicitly or null.BuildPromotionEx
getBuildPromotion()
Returns build promotionCanceledInfo
getCanceledInfo()
Returns info related to interrupted build.Map<String,Long>
getCompletedStages()
Reports target build-type's stages (this build being instance of) that have been already completed by this particular buildprotected BuildDependencyGraph
getDependencyGraph()
RunningBuildEx
getHangingDependency()
long
getLastUpdateDelayMsecs()
protected RunningBuildState
getRunningState()
StatisticValuesCollection
getStatisticValuesCollection()
protected void
initCurrentStatisticValues()
boolean
isInterrupted()
When processing buildFinished event, returns true if build was finished unexpectedly (for instance, killed)protected void
loadCancelledInfoFromDB(DBFunctions dbf)
protected void
logFinalMessages()
protected void
notifyOnBuildProblemsChanged(List<BuildProblemData> before, List<BuildProblemData> after)
void
resolveArtifactDependencies(BiConsumer<SArtifactDependency,Throwable> failedDepsConsumer)
protected void
setCanceledInfo(CanceledInfo canceledInfo)
void
setCustomStatusText(String text)
Sets the custom build status text.void
setInterrupted(RunningBuildState state, User user, String reason)
Mark this build as interrupted.void
skipBuildChainBuilds(List<String> externalIdsOrTags, String cancelComment)
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
startBuildFailureChecker()
Initialize periodical build failue checker processvoid
stop(User user, String comment)
Stops the build.void
stopBuildFailureChecker()
Stop periodical failure checker processvoid
updateBuildIfLastUpdateExpired(int expirationTimeSeconds)
Performs update of the build data but only if some time has passed since the last update.void
updateBuildStatisticValues()
Loads statistic values reported for the build from database and sends events on every new loaded valueprotected void
writeFinishProperties()
void
writeSettingsDigestFile()
Writes the value of theBuildAttributes.SETTINGS_DIGEST
to a file under the build artifacts directory.-
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, getBuildCounter, getBuildFeaturesOfType, getBuildFinishParameters, getBuildId, getBuildNumberParameters, getBuildNumberWithoutRefs, getBuildOwnParameters, 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, getRawBuildNumber, getRecentlyFinishedBuild, getRelatedIssues, getRemoteArtifacts, getRemoteArtifactsByType, getRevisions, getSequenceBuild, getServerStartDate, getSettingsDigestFile, getSettingsDigestFromFile, getShortStatistics, getStartDate, getStatisticValue, getStatisticValues, getStatus, getTags, getTemporaryCustomDataStorage, getTestMessages, 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, 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, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.Build
getAgentName, getBuildId, getBuildNumber, getBuildStatus, getBuildTypeExternalId, getBuildTypeId, getBuildTypeName, getCompilationErrorMessages, getDuration, getFinishDate, getFullName, getLogMessages, getProjectExternalId, getProjectId, getStartDate, getStatusDescriptor, getTestMessages, isFinished, isPersonal
-
Methods inherited from interface jetbrains.buildServer.serverSide.BuildEx
getBuildLog, getCachedShortStatistics
-
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.RunningBuildEx
addBuildMessage, buildPatch, buildPersonalPatch, closeBuildLog, createAgentBuild, detachedFromAgent, finishImmediately, getArtifactsLimit, getBuildCounter, getBuildLog, getBuildLogIfInitialized, getDetachFromAgentReceivedTimestamp, getProgressText, getQueuedAgentRestrictor, getRunnersState, getTemporaryCustomDataStorage, getTestRunMuter, getUserDataStorage, isFinishReceived, isStarting, markAsFinished, markAsFinishedUnexpectedly, prepareArtifactDependencies, publishArtifact, publishArtifact, publishArtifact, publishArtifact, publishArtifact, resetAgentCache, runUnlessFinished, serverShutdown, serverStartup, setStartTimes, start, stop, stopNoInterrupt, updateBuild, updateBuildInfo, updateExternalArtifactsInfoOnAccess
-
Methods inherited from interface jetbrains.buildServer.serverSide.buildDistribution.RunningBuildInfo
getBuildConfiguration, getBuildPromotionInfo, getEstimationForTimeLeft, occupiesAgent
-
Methods inherited from interface jetbrains.buildServer.serverSide.SBuild
addBuildProblem, addUserBuildProblem, convertToAgentTime, convertToServerTime, getArtifactDependencies, getArtifacts, getArtifactsDirectory, getBranch, getBuildComment, 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, finish, getAgentAccessCode, getAgentId, getCompletedPercent, getCurrentPath, getLastBuildActivityTimestamp, getQueuedAgentId, getTimeSpentSinceLastBuildActivity, isProbablyHanging, setBuildNumber, setBuildStatus
-
-
-
-
Field Detail
-
OLD_UNEXPECTED_FINISH
public static final String OLD_UNEXPECTED_FINISH
- See Also:
- Constant Field Values
-
myStatusText
protected volatile String myStatusText
-
myLastUpdateTimestamp
protected volatile Date myLastUpdateTimestamp
-
-
Constructor Detail
-
BaseRunningBuild
protected BaseRunningBuild(long buildId, String rawTriggeredBy, @NotNull BuildPromotionEx buildPromotion, @NotNull BuildContext context)
-
-
Method Detail
-
createSettingsDigest
protected void createSettingsDigest()
-
writeSettingsDigestFile
public void writeSettingsDigestFile()
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
-
skipBuildChainBuilds
public void skipBuildChainBuilds(@NotNull List<String> externalIdsOrTags, @NotNull String cancelComment)
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.cancelComment
- comment to use when canceling queued builds
-
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()
-
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
-
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.
-
setCanceledInfo
protected void setCanceledInfo(CanceledInfo canceledInfo)
-
getBuildDescription
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
-
setCustomStatusText
public void setCustomStatusText(@Nullable 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
-
getRunningState
protected RunningBuildState getRunningState()
-
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
-
resolveArtifactDependencies
public void resolveArtifactDependencies(@NotNull BiConsumer<SArtifactDependency,Throwable> failedDepsConsumer)
-
setInterrupted
public final 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
-
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
-
notifyOnBuildProblemsChanged
protected void notifyOnBuildProblemsChanged(@NotNull List<BuildProblemData> before, @NotNull List<BuildProblemData> after)
- Specified by:
notifyOnBuildProblemsChanged
in classBaseBuild
-
logFinalMessages
protected void logFinalMessages()
-
getAgent
@NotNull public abstract BuildAgentEx 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
- Specified by:
getAgent
in classBaseBuild
- Returns:
- agent where this build executed.
-
getDependencyGraph
@NotNull protected BuildDependencyGraph getDependencyGraph()
-
getHangingDependency
@Nullable public RunningBuildEx getHangingDependency()
- Specified by:
getHangingDependency
in interfaceRunningBuildEx
- Returns:
- Traverses through running snapshot dependencies of this build and returns the first one which is probably hanging.
-
getArtifactsStats
@NotNull public final BaseRunningBuild.ArtifactsStats getArtifactsStats()
-
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
-
writeFinishProperties
protected void writeFinishProperties()
-
getStatisticValuesCollection
@NotNull public StatisticValuesCollection getStatisticValuesCollection()
- Specified by:
getStatisticValuesCollection
in interfaceRunningBuildEx
-
doBuildFinish
protected boolean doBuildFinish()
-
finishedOnOtherNode
public void finishedOnOtherNode()
- Specified by:
finishedOnOtherNode
in interfaceRunningBuildEx
-
initCurrentStatisticValues
protected void initCurrentStatisticValues()
-
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
-
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
-
getLastUpdateDelayMsecs
public long getLastUpdateDelayMsecs()
-
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
-
loadCancelledInfoFromDB
protected void loadCancelledInfoFromDB(DBFunctions dbf)
-
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
- Specified by:
getBuildPromotion
in classBaseBuild
- Returns:
- see above.
-
-