Class CompositeRunningBuild
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.BaseBuild
-
- jetbrains.buildServer.serverSide.impl.BaseRunningBuild
-
- jetbrains.buildServer.serverSide.impl.CompositeRunningBuild
-
- All Implemented Interfaces:
Build
,RunningBuild
,RunningBuildInfo
,BuildEx
,BuildPromotionOwner
,ParametersSupport
,RunningBuildEx
,SBuild
,SRunningBuild
- Direct Known Subclasses:
SecuredCompositeRunningBuild
public class CompositeRunningBuild extends BaseRunningBuild implements RunningBuildEx
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jetbrains.buildServer.serverSide.impl.BaseRunningBuild
BaseRunningBuild.ArtifactsStats
-
-
Field Summary
Fields Modifier and Type Field Description static String
FAKE_SERVER_AGENT
static String
KEY_ARCHIVE_INTROSPECTION_ENABLED
The name of the build configuration parameter which allows to enable or disable archive introspection for the artifacts of composite builds.-
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 Constructor Description CompositeRunningBuild(BuildPromotionEx buildPromotion, String buildNumber, long buildCounter, String rawTriggeredBy, Date startDate, BuildContext context)
Used for loading theCompositeRunningBuild
from DBCompositeRunningBuild(BuildPromotionEx buildPromotion, String rawTriggeredBy, BuildContext context)
-
Method Summary
All Methods Instance Methods Concrete 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
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 buildprotected boolean
doBuildFinish()
boolean
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!BuildAgentEx
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.ArtifactsUploadLimit
getArtifactsLimit()
BuildConfigurationInfo
getBuildConfiguration()
long
getBuildCounter()
BuildLogEx
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 '???').BuildPromotionInfo
getBuildPromotionInfo()
ShortStatistics
getCachedShortStatistics(boolean calculateIfAbsent)
Return cached short statistics for this build.int
getCompletedPercent()
Map<String,Long>
getCompletedStages()
Reports target build-type's stages (this build being instance of) that have been already completed by this particular buildString
getCurrentPath()
Returns short description of current running step.BuildDependencyGraph
getDependencyGraph()
Long
getDetachFromAgentReceivedTimestamp()
long
getDurationEstimate()
Returns server estimation for this build duration in seconds.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.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.Date
getLastBuildActivityTimestamp()
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.Integer
getQueuedAgentId()
SAgentRestrictor
getQueuedAgentRestrictor()
Returns an agent restrictor this build was queued with (when build configuration was added to queue).String
getRawBuildNumber()
Returns raw build number (i.e.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 sentStatusDescriptor
getStatusDescriptor()
Returns status descriptor of the buildTestRunMuter
getTestRunMuter()
Returns a special service that allows to mute test run if neccessary.long
getTimeSpentSinceLastBuildActivity()
Returns time in seconds spent since last build activity.UserDataStorage
getUserDataStorage()
Use this object to associate some data with the current instance.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
isFinishing()
boolean
isFinishReceived()
boolean
isProbablyHanging()
Returns true if server thinks this build has hung.boolean
isStarted()
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
isStopping()
void
markAsFinished(Date finishDate, boolean failed)
void
markAsFinishedUnexpectedly(String reason)
boolean
markStopping()
void
notifyOnDependencyUpdate()
boolean
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 instancevoid
resetShortStatistics()
boolean
runUnlessFinished(Runnable action)
Executes specified runnable if build is not finished.void
serverShutdown()
void
serverStartup()
void
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
setStartTimes(Date agentStartTime, Date serverStartTime, TimeZone agentTimeZone)
Sets timestamps when command to run build was sent to an agent.void
start(boolean async)
Must be invoked only once when build starts.void
stop(RunningBuildState interruptedState, User user, String comment, boolean reAdd2Queue)
void
stopDependentBuilds(User user, String comment, boolean skipAlreadyInterrupted)
void
stopNoInterrupt()
Stops build on server and on agent without making it interruptedString
toString()
void
updateBuild()
boolean
updateBuildInfo()
Loads build interruption and build finish timestamps from database into the build.-
Methods inherited from class jetbrains.buildServer.serverSide.impl.BaseRunningBuild
addRemoteArtifact, createSettingsDigest, getArtifactsStats, getBuildDescription, getBuildPromotion, getCanceledInfo, 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, getBuildOwnParameters, getBuildProblems, getBuildStartParameters, getBuildStatistics, getBuildStatus, getBuildType, getBuildTypeExternalId, getBuildTypeId, getBuildTypeName, getChanges, getClientStartDate, getClientTimeZone, getCommitters, getCompilationErrorMessages, getContainingChanges, getCustomDataStorage, getCustomDataStorageIdsByPrefix, getDownloadedArtifacts, getDuration, getDurationOnAgent, getFailureReasons, getFileContent, getFirstInternalError, getFirstInternalErrorMessage, getFullName, getFullStatistics, getId, getLabels, getLogMessages, getOwner, getParametersProvider, getPreviousFinished, getProvidedArtifacts, getQueuedDate, getRecentlyFinishedBuild, getRelatedIssues, getRemoteArtifacts, getRemoteArtifactsByType, getRevisions, getSequenceBuild, getSettingsDigestFile, getSettingsDigestFromFile, getStatisticValue, getStatisticValues, getStatus, getTags, getTemporaryCustomDataStorage, getTestMessages, getTriggeredBy, getValueResolver, getValueResolver, getValueResolver, getVariablesProvider, getVcsRootEntries, getWaitReasons, hasBuildFinishParameters, hasBuildProblemOfType, hasTests, initMetrics, isAgentLessBuild, isArtifactsExists, isHasInternalArtifactsOnly, isHasRelatedIssues, isInternalError, isOutdated, isOutOfChangesSequence, isPersonal, isPersonalPatchAvailable, isPinned, isResponsibleNeeded, 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, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.Build
getBuildId, getBuildStatus, getBuildTypeExternalId, getBuildTypeId, getBuildTypeName, getCanceledInfo, getCompilationErrorMessages, getDuration, getFullName, getLogMessages, getTestMessages, 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
getBuildPromotion, getHangingDependency, getRunnersState, 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, getBuildOwnParameters, getBuildStatistics, getBuildType, getChanges, getClientStartDate, getClientTimeZone, getCommitters, getContainingChanges, getCustomDataStorage, getDownloadedArtifacts, getFailureReasons, getFileContent, getFirstInternalError, getFirstInternalErrorMessage, getFullStatistics, getLabels, getOwner, getPreviousFinished, getProvidedArtifacts, getQueuedDate, getRecentlyFinishedBuild, getRelatedIssues, getRemoteArtifacts, getRemoteArtifactsByType, getRevisions, getStatisticValue, getStatisticValues, getTags, getTriggeredBy, getValueResolver, getVcsRootEntries, getWaitReasons, hasBuildProblemOfType, hasTests, isAgentLessBuild, isArtifactsExists, isHasInternalArtifactsOnly, isHasRelatedIssues, isInternalError, isOutdated, isOutOfChangesSequence, isPinned, isResponsibleNeeded, isUsedByOtherBuilds, muteBuildProblems, setBuildComment, setTags, setTags
-
Methods inherited from interface jetbrains.buildServer.serverSide.SRunningBuild
addRemoteArtifact, isInterrupted, setInterrupted, stop
-
-
-
-
Field Detail
-
KEY_ARCHIVE_INTROSPECTION_ENABLED
@NonNls @NotNull public static final String KEY_ARCHIVE_INTROSPECTION_ENABLED
The name of the build configuration parameter which allows to enable or disable archive introspection for the artifacts of composite builds. The default is off (archive introspection disabled).
- See Also:
- Constant Field Values
-
FAKE_SERVER_AGENT
public static final String FAKE_SERVER_AGENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CompositeRunningBuild
public CompositeRunningBuild(@NotNull BuildPromotionEx buildPromotion, @Nullable String rawTriggeredBy, @NotNull BuildContext context)
-
CompositeRunningBuild
public CompositeRunningBuild(@NotNull BuildPromotionEx buildPromotion, @NotNull String buildNumber, long buildCounter, @Nullable String rawTriggeredBy, @NotNull Date startDate, @NotNull BuildContext context)
Used for loading theCompositeRunningBuild
from DB
-
-
Method Detail
-
isStarted
public boolean isStarted()
-
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:
-
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
-
getAgent
@NotNull public 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 classBaseRunningBuild
- Returns:
- agent where this build executed.
-
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)
- Specified by:
buildPatch
in interfaceRunningBuildEx
-
buildPersonalPatch
public void buildPersonalPatch(OutputStream stream, long personalChangeId, @NotNull AgentCheckoutDirRevisionInfo workDirState)
- Specified by:
buildPersonalPatch
in interfaceRunningBuildEx
-
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
-
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
-
getQueuedAgentId
public Integer getQueuedAgentId()
- 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
- Overrides:
getCompletedStages
in classBaseRunningBuild
- 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
@Contract("_, _ -> fail") public void publishArtifact(@NotNull String path, @NotNull byte[] content)
Adds artifact to the build by the specified pathComposite builds don't need any external triggers to publish their artifacts, so this method always throws an
UnsupportedOperationException
.- Specified by:
publishArtifact
in interfaceRunningBuildEx
- Parameters:
path
- path where to store artifactcontent
- artifact content- Throws:
UnsupportedOperationException
- always.- See Also:
RunningBuildEx.publishArtifact(String, byte[])
-
publishArtifact
@Contract("_, _ -> fail") public void publishArtifact(@NotNull String path, @NotNull File srcFile)
Adds artifact to the build by the specified pathComposite builds don't need any external triggers to publish their artifacts, so this method always throws an
UnsupportedOperationException
.- 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:
UnsupportedOperationException
- always.- See Also:
RunningBuildEx.publishArtifact(String, File)
-
publishArtifact
@Contract("_, _ -> fail") public void publishArtifact(@NotNull String path, @NotNull InputStream is)
Adds artifact to the build by the specified pathComposite builds don't need any external triggers to publish their artifacts, so this method always throws an
UnsupportedOperationException
.- Specified by:
publishArtifact
in interfaceRunningBuildEx
- Parameters:
path
- path where to store artifact- Throws:
UnsupportedOperationException
- always.- See Also:
RunningBuildEx.publishArtifact(String, InputStream)
-
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
-
start
public void start(boolean async)
Description copied from interface:RunningBuildEx
Must be invoked only once when build starts.- Specified by:
start
in interfaceRunningBuildEx
-
isStartedOnAgent
public boolean isStartedOnAgent()
Description copied from interface:SBuild
Returns true if this build was started on agent.- Specified by:
isStartedOnAgent
in interfaceSBuild
- Overrides:
isStartedOnAgent
in classBaseBuild
- Returns:
- see above
-
doBuildFinish
protected boolean doBuildFinish()
- Overrides:
doBuildFinish
in classBaseRunningBuild
-
isFinishing
public boolean isFinishing()
-
finishImmediately
public void finishImmediately(@NotNull Date finishDate, boolean failed)
Description copied from interface:RunningBuildEx
For tests only!- Specified by:
finishImmediately
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
- Overrides:
finish
in classBaseRunningBuild
-
finishedOnOtherNode
public void finishedOnOtherNode()
- Specified by:
finishedOnOtherNode
in interfaceRunningBuildEx
- Overrides:
finishedOnOtherNode
in classBaseRunningBuild
-
runUnlessFinished
public boolean runUnlessFinished(@NotNull Runnable action)
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:
action
- runnable- Returns:
- true if runnable was executed
-
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 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
-
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.
-
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
-
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(@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)
-
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
-
stopNoInterrupt
public void stopNoInterrupt()
Stops build on server and on agent without making it interrupted- Specified by:
stopNoInterrupt
in interfaceRunningBuildEx
- See Also:
RunningBuildEx.stopNoInterrupt()
-
stopDependentBuilds
public void stopDependentBuilds(@Nullable User user, @NotNull String comment, boolean skipAlreadyInterrupted)
-
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.
-
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
-
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
-
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
- Overrides:
getServerStartDate
in classBaseBuild
- Returns:
- the timestamp when the build was removed from the queue.
-
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
- Specified by:
getRawBuildNumber
in classBaseBuild
- Returns:
- raw build number which can contain unresolved parameters
-
getBuildCounter
public long getBuildCounter()
- Specified by:
getBuildCounter
in interfaceRunningBuildEx
- Specified by:
getBuildCounter
in classBaseBuild
- 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
-
getArtifactsLimit
@NotNull public ArtifactsUploadLimit getArtifactsLimit()
- Specified by:
getArtifactsLimit
in interfaceRunningBuildEx
-
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
-
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
-
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
-
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
- Overrides:
isDetachedFromAgent
in classBaseBuild
- Returns:
- see above
-
getDetachFromAgentReceivedTimestamp
@Nullable public Long getDetachFromAgentReceivedTimestamp()
- Specified by:
getDetachFromAgentReceivedTimestamp
in interfaceBuildEx
- Specified by:
getDetachFromAgentReceivedTimestamp
in interfaceRunningBuildEx
- Overrides:
getDetachFromAgentReceivedTimestamp
in classBaseBuild
- Returns:
- timestamp when this build was attempted to detach from agent
-
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
-
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
- Overrides:
getStartDate
in classBaseBuild
- 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
-
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
-
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
- Overrides:
getShortStatistics
in classBaseBuild
- Returns:
- short statistics for this build.
-
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().
-
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.
-
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
- Overrides:
getFinishOnAgentDate
in classBaseBuild
- Returns:
- see above
-
getDependencyGraph
@NotNull public BuildDependencyGraph getDependencyGraph()
- Overrides:
getDependencyGraph
in classBaseRunningBuild
-
isStopping
public boolean isStopping()
-
markStopping
public boolean markStopping()
-
notifyOnDependencyUpdate
public void notifyOnDependencyUpdate()
-
resetShortStatistics
public void resetShortStatistics()
-
-