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 protected
RunningBuildImpl(BuildPromotionEx buildPromotion, RunningBuildData runningBuildData, BuildContext context)
Used for loading the build from DB.protected
RunningBuildImpl(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 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
clearCachedEstimate()
void
closeBuildLog()
Closes the build log's root block, flushes messages and closes the build logBuildAgentEx
computeAgentlessBuildAgent()
boolean
computeProbablyHanging(long currentTime)
AgentBuild
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()
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 '???').Map<String,String>
getBuildOwnParameters()
Returns map of parameters (configuration params, system properties and environment variables) excluding parameters provided by extensions.BuildPromotionInfo
getBuildPromotionInfo()
ShortStatistics
getCachedShortStatistics(boolean calculateIfAbsent)
Return cached short statistics for this build.int
getCompletedPercent()
int
getCompletedPercent(long currentTime)
String
getCurrentPath()
Returns short description of current running step.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
getElapsedTime(long currentTime)
long
getEstimatedDurationExceededTime(long currentTime)
long
getEstimationForTimeLeft()
Returns server estimation for this build remaining time.long
getEstimationForTimeLeft(long currentTime)
Date
getFinishDate()
Returns finish timestamp for the build (server time) ornull
if it hasn't been finished yet.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.Map<String,Boolean>
getRunnersState()
StatusDescriptor
getStatusDescriptor()
Returns status descriptor of the buildList<TestInfo>
getTestMessages(int skipTests, int maxTestsToLoad)
Retrieves information about tests failed in the build.TestRunMuter
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.protected void
initialize(boolean newBuild)
boolean
isCompositeBuild()
Returns true if this build is a composite build.boolean
isFinished()
boolean
isFinishReceived()
boolean
isProbablyHanging()
Returns true if server thinks this build has hung.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
muteBuildProblems(boolean muteIfTrue)
Makes all existing build problems enabled or disabledboolean
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 source, PublishArtifactProgressListener progressListener)
Adds artifact to the build from the specified stream allowing to trace progressvoid
resetAgentCache()
Resets internal cache of agent instanceboolean
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
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, 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
- ifbuildPromotion
is a composite one.
-
RunningBuildImpl
protected RunningBuildImpl(@NotNull BuildPromotionEx buildPromotion, RunningBuildData runningBuildData, @NotNull BuildContext context)
Used for loading the build from DB.- Throws:
IllegalArgumentException
- ifbuildPromotion
is a composite one.
-
-
Method Detail
-
initialize
protected void initialize(boolean newBuild)
-
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
-
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.
-
computeAgentlessBuildAgent
@NotNull public BuildAgentEx computeAgentlessBuildAgent()
-
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
-
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
-
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
-
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
-
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.
-
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.
-
doBuildFinish
protected boolean doBuildFinish()
- Overrides:
doBuildFinish
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
-
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
-
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
-
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
-
clearCachedEstimate
@TestOnly public void clearCachedEstimate()
-
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().
-
getAgentName
@NotNull 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
-
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
-
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
-
getCompletedPercent
public int getCompletedPercent(long currentTime)
-
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.
-
getEstimationForTimeLeft
public long getEstimationForTimeLeft(long currentTime)
-
isFinishReceived
public boolean isFinishReceived()
- Specified by:
isFinishReceived
in interfaceRunningBuildEx
- Returns:
- true if build finished was received by the server.
-
publishArtifact
public final void publishArtifact(@NotNull String path, @NotNull byte[] content) throws IOException
Description copied from interface:RunningBuildEx
Adds artifact to the build by the specified path- Specified by:
publishArtifact
in interfaceRunningBuildEx
- Parameters:
path
- path where to store artifactcontent
- artifact content- Throws:
IOException
-
publishArtifact
public final void publishArtifact(@NotNull String path, @NotNull File srcFile) throws IOException
Description copied from interface:RunningBuildEx
Adds artifact to the build by the specified path- 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:
IOException
-
publishArtifact
public final void publishArtifact(@NotNull String path, @NotNull File srcFile, @Nullable PublishArtifactProgressListener progressListener) throws IOException
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- Throws:
IOException
-
publishArtifact
public final void publishArtifact(@NotNull String path, @NotNull InputStream is) throws IOException
Description copied from interface:RunningBuildEx
Adds artifact to the build by the specified path- Specified by:
publishArtifact
in 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 IOException
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- Throws:
IOException
-
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.
-
getEstimatedDurationExceededTime
public long getEstimatedDurationExceededTime(long currentTime)
-
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.
-
getElapsedTime
public long getElapsedTime(long currentTime)
-
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
-
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
-
getTestMessages
public List<TestInfo> getTestMessages(int skipTests, int maxTestsToLoad)
Description copied from interface:Build
Retrieves information about tests failed in the build. Note that for running build currently executing test will be added to the list too.- Specified by:
getTestMessages
in interfaceBuild
- Overrides:
getTestMessages
in 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:
isFinished
in interfaceBuild
- Returns:
- true if the build was finished and was saved to the history
-
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
-
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
-
createAgentBuild
@NotNull public AgentBuild createAgentBuild() throws BuildTypeNotFoundException
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:
- Throws:
BuildTypeNotFoundException
-
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
-
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
-
computeProbablyHanging
public boolean computeProbablyHanging(long currentTime)
-
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
-
start
public void start(boolean async)
Description copied from interface:RunningBuildEx
Must be invoked only once when build starts.- Specified by:
start
in interfaceRunningBuildEx
-
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:
-
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 final void stopNoInterrupt()
Description copied from interface:RunningBuildEx
Stops build on server and on agent without making it interrupted- Specified by:
stopNoInterrupt
in interfaceRunningBuildEx
-
buildPatch
public void buildPatch(OutputStream stream, @NotNull FullCheckoutFlag fullCheckoutFlag, boolean personalChanges, @NotNull AgentCheckoutDirRevisionInfo workDirState) throws IOException
- Specified by:
buildPatch
in interfaceRunningBuildEx
- Throws:
IOException
-
buildPersonalPatch
public void buildPersonalPatch(OutputStream stream, long personalChangeId, @NotNull AgentCheckoutDirRevisionInfo workDirState) throws IOException
- Specified by:
buildPersonalPatch
in interfaceRunningBuildEx
- Throws:
IOException
-
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
-
getBuildOwnParameters
@NotNull public Map<String,String> getBuildOwnParameters()
Description copied from interface:SBuild
Returns map of parameters (configuration params, system properties and environment variables) excluding parameters provided by extensions.- Specified by:
getBuildOwnParameters
in interfaceSBuild
- Overrides:
getBuildOwnParameters
in classBaseBuild
- Returns:
- set of build parameters known on the server-side for the build.
-
getTestRunMuter
@NotNull 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.
-
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
-
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
-
muteBuildProblems
public void muteBuildProblems(boolean muteIfTrue)
Description copied from interface:BuildEx
Makes all existing build problems enabled or disabled- Specified by:
muteBuildProblems
in interfaceBuildEx
- Overrides:
muteBuildProblems
in 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:
markAsFinished
in interfaceRunningBuildEx
-
markAsFinishedUnexpectedly
public void markAsFinishedUnexpectedly(@NotNull String reason)
- Specified by:
markAsFinishedUnexpectedly
in interfaceRunningBuildEx
-
finishImmediately
public void finishImmediately(@NotNull Date finishDate, boolean failed)
Description copied from interface:RunningBuildEx
For tests only!- Specified by:
finishImmediately
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
-
getArtifactsLimit
@NotNull public ArtifactsUploadLimit getArtifactsLimit()
- Specified by:
getArtifactsLimit
in interfaceRunningBuildEx
-
getRunnersState
@NotNull public Map<String,Boolean> getRunnersState() throws BuildTypeNotFoundException
- Specified by:
getRunnersState
in interfaceRunningBuildEx
- Throws:
BuildTypeNotFoundException
-
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
-
-