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 classBaseRunningBuild.ArtifactsStats
-
Field Summary
Fields Modifier and Type Field Description protected DatemyLastUpdateTimestampprotected StringmyStatusTextstatic StringOLD_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 protectedBaseRunningBuild(long buildId, String rawTriggeredBy, BuildPromotionEx buildPromotion, BuildContext context)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddRemoteArtifact(RemoteArtifact artifact)Adds information about remote artifact to this buildprotected voidcreateSettingsDigest()protected booleandoBuildFinish()booleanfinish()The method completes the build finishing procedure and should not be called directly in the majority of cases.voidfinishedOnOtherNode()abstract BuildAgentExgetAgent()Get build agent this running build is running on.BaseRunningBuild.ArtifactsStatsgetArtifactsStats()StringgetBuildDescription()Returns build description set to this build explicitly or null.BuildPromotionExgetBuildPromotion()Returns build promotionCanceledInfogetCanceledInfo()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 BuildDependencyGraphgetDependencyGraph()RunningBuildExgetHangingDependency()longgetLastUpdateDelayMsecs()protected RunningBuildStategetRunningState()StatisticValuesCollectiongetStatisticValuesCollection()protected voidinitCurrentStatisticValues()booleanisInterrupted()When processing buildFinished event, returns true if build was finished unexpectedly (for instance, killed)protected voidloadCancelledInfoFromDB(DBFunctions dbf)protected voidlogFinalMessages()protected voidnotifyOnBuildProblemsChanged(List<BuildProblemData> before, List<BuildProblemData> after)voidresolveArtifactDependencies(BiConsumer<SArtifactDependency,Throwable> failedDepsConsumer)protected voidsetCanceledInfo(CanceledInfo canceledInfo)voidsetCustomStatusText(String text)Sets the custom build status text.voidsetInterrupted(RunningBuildState state, User user, String reason)Mark this build as interrupted.voidskipBuildChainBuilds(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.voidstartBuildFailureChecker()Initialize periodical build failue checker processvoidstop(User user, String comment)Stops the build.voidstopBuildFailureChecker()Stop periodical failure checker processvoidupdateBuildIfLastUpdateExpired(int expirationTimeSeconds)Performs update of the build data but only if some time has passed since the last update.voidupdateBuildStatisticValues()Loads statistic values reported for the build from database and sends events on every new loaded valueprotected voidwriteFinishProperties()voidwriteSettingsDigestFile()Writes the value of theBuildAttributes.SETTINGS_DIGESTto 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:RunningBuildExWrites the value of theBuildAttributes.SETTINGS_DIGESTto a file under the build artifacts directory.- Specified by:
writeSettingsDigestFilein interfaceRunningBuildEx
-
skipBuildChainBuilds
public void skipBuildChainBuilds(@NotNull List<String> externalIdsOrTags, @NotNull String cancelComment)Description copied from interface:RunningBuildExThis 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:
skipBuildChainBuildsin 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:SRunningBuildAdds information about remote artifact to this build- Specified by:
addRemoteArtifactin interfaceSRunningBuild- See Also:
SBuild.getRemoteArtifacts()
-
isInterrupted
public boolean isInterrupted()
Description copied from interface:SRunningBuildWhen processing buildFinished event, returns true if build was finished unexpectedly (for instance, killed)- Specified by:
isInterruptedin interfaceSRunningBuild- Returns:
- true or false
-
getCanceledInfo
public CanceledInfo getCanceledInfo()
Description copied from interface:BuildReturns info related to interrupted build. If build is finished, not interrupted, the value is null.- Specified by:
getCanceledInfoin interfaceBuild- Returns:
- info about canceled reason and canceler if build was actually interrupted, null otherwise.
-
setCanceledInfo
protected void setCanceledInfo(CanceledInfo canceledInfo)
-
getBuildDescription
public String getBuildDescription()
Description copied from interface:SBuildReturns build description set to this build explicitly or null.- Specified by:
getBuildDescriptionin interfaceSBuild- Returns:
- see above
-
setCustomStatusText
public void setCustomStatusText(@Nullable String text)Description copied from interface:RunningBuildExSets the custom build status text.- Specified by:
setCustomStatusTextin 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:RunningBuildExInitialize periodical build failue checker process- Specified by:
startBuildFailureCheckerin interfaceRunningBuildEx
-
stopBuildFailureChecker
public void stopBuildFailureChecker()
Description copied from interface:RunningBuildExStop periodical failure checker process- Specified by:
stopBuildFailureCheckerin 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:SRunningBuildMark this build as interrupted.- Specified by:
setInterruptedin interfaceSRunningBuild- Parameters:
state- running build stateuser- user who initiated interruption or nullreason- reason why interruption initiated or null
-
stop
public void stop(@Nullable User user, @Nullable String comment)Description copied from interface:SRunningBuildStops the build. If this is a user action, user who performs this action must be specified. If build is stopped without user it will be considered crashed and can be re-added into the queue.- Specified by:
stopin interfaceSRunningBuild- Parameters:
user- user who stopped build or nullcomment- comment for the action or null
-
notifyOnBuildProblemsChanged
protected void notifyOnBuildProblemsChanged(@NotNull List<BuildProblemData> before, @NotNull List<BuildProblemData> after)- Specified by:
notifyOnBuildProblemsChangedin classBaseBuild
-
logFinalMessages
protected void logFinalMessages()
-
getAgent
@NotNull public abstract 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 classBaseBuild- Returns:
- agent where this build executed.
-
getDependencyGraph
@NotNull protected BuildDependencyGraph getDependencyGraph()
-
getHangingDependency
@Nullable public RunningBuildEx getHangingDependency()
- Specified by:
getHangingDependencyin 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:RunningBuildExThe 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:
finishin interfaceRunningBuildEx
-
writeFinishProperties
protected void writeFinishProperties()
-
getStatisticValuesCollection
@NotNull public StatisticValuesCollection getStatisticValuesCollection()
- Specified by:
getStatisticValuesCollectionin interfaceRunningBuildEx
-
doBuildFinish
protected boolean doBuildFinish()
-
finishedOnOtherNode
public void finishedOnOtherNode()
- Specified by:
finishedOnOtherNodein interfaceRunningBuildEx
-
initCurrentStatisticValues
protected void initCurrentStatisticValues()
-
updateBuildStatisticValues
public void updateBuildStatisticValues()
Description copied from interface:RunningBuildExLoads statistic values reported for the build from database and sends events on every new loaded value- Specified by:
updateBuildStatisticValuesin interfaceRunningBuildEx
-
updateBuildIfLastUpdateExpired
public void updateBuildIfLastUpdateExpired(int expirationTimeSeconds)
Description copied from interface:RunningBuildExPerforms update of the build data but only if some time has passed since the last update.- Specified by:
updateBuildIfLastUpdateExpiredin 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:RunningBuildExReports target build-type's stages (this build being instance of) that have been already completed by this particular build- Specified by:
getCompletedStagesin interfaceRunningBuildEx- Returns:
- mapping from stage-names to respective durations
-
loadCancelledInfoFromDB
protected void loadCancelledInfoFromDB(DBFunctions dbf)
-
getBuildPromotion
@NotNull public BuildPromotionEx getBuildPromotion()
Description copied from interface:BuildPromotionOwnerReturns build promotion- Specified by:
getBuildPromotionin interfaceBuildEx- Specified by:
getBuildPromotionin interfaceBuildPromotionOwner- Specified by:
getBuildPromotionin interfaceRunningBuildEx- Specified by:
getBuildPromotionin classBaseBuild- Returns:
- see above.
-
-