Class FinishedBuildImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.BaseBuild
-
- jetbrains.buildServer.serverSide.impl.FinishedBuildImpl
-
- All Implemented Interfaces:
Build
,BuildEx
,BuildPromotionOwner
,FinishedBuildEx
,ParametersSupport
,SBuild
,SFinishedBuild
- Direct Known Subclasses:
SecuredFinishedBuildImpl
public class FinishedBuildImpl extends BaseBuild implements FinishedBuildEx
- Author:
- Eugene Zhuravlev Date: Feb 4, 2006
-
-
Field Summary
-
Fields inherited from class jetbrains.buildServer.serverSide.impl.BaseBuild
myBuildId, myContext, myStatsCallCounter, REMOTE_ARTIFACTS_PREFIX
-
-
Constructor Summary
Constructors Constructor Description FinishedBuildImpl(long buildId, long buildPromotionId, String buildTypeId, String agentName, int agentTypeId, Date buildStartTimeServer, Date buildStartTimeAgent, Date buildFinishTimeServer, Status buildStatus, String finalStatusText, String buildNumber, boolean pinned, boolean personal, CanceledInfo canceledInfo, String rawTriggeredBy, String buildDescription, BuildPromotionEx buildPromotion, BuildContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeDelete(boolean sendEvent)
This method should be called before build is going to be deleted.void
buildEvictedFromCache()
This method is called when the build is about to be removed from the cacheboolean
equals(Object o)
BuildAgentEx
getAgent()
String
getAgentName()
Returns agent name where build is running or happened to run if finished.long
getBuildCounter()
String
getBuildDescription()
Returns build description set to this build explicitly or null.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 '???').BuildPromotionEx
getBuildPromotion()
Returns build promotionBuildStatistics
getBuildStatistics(BuildStatisticsOptions options)
Same asSBuild.getFullStatistics()
but with more control of data being loaded.Status
getBuildStatus()
Returns current build statusBuildTypeEx
getBuildType()
Returns build configuration this build belongs to.String
getBuildTypeExternalId()
Returns the build type external ID.String
getBuildTypeId()
Returns build configuration internal idShortStatistics
getCachedShortStatistics(boolean calculateIfAbsent)
Return cached short statistics for this build.CanceledInfo
getCanceledInfo()
Returns info related to interrupted build.SortedMap<BuildTypeEx,BuildPromotionEx>
getDeploymentStatus()
Date
getFinishDate()
Returns finish timestamp for the build.Date
getFinishOnAgentDate()
Returns timestamp when the build finished on agent (server time) ornull
if it is still running on agent.Comment
getPinComment()
Returns the pin/unpin commentString
getProjectExternalId()
Returns external id of the project this build belongs to.String
getProjectId()
Returns internal id of the project this build belongs to.String
getRawBuildNumber()
Returns raw build number (i.e.StatusDescriptor
getStatusDescriptor()
Returns status descriptor of the buildint
hashCode()
boolean
isAgentLessBuild()
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
isPersonal()
Returns if this build has been run to test personal changesboolean
isPinned()
Returns true if this build is pinnedvoid
notifyOnBuildProblemsChanged(List<BuildProblemData> before, List<BuildProblemData> after)
void
resetFullStatisticsCache()
void
resetShortStatisticsCache()
void
setLabel(String labelValue, String message, List<VcsRootInstance> rootsToLabel)
Sets a label on files in VCS repository used by this build in the specified VCS rootsvoid
setLabel(String labelValue, List<VcsRootInstance> rootsToLabel)
Sets a label on files in VCS repository used by this build in the specified VCS rootsvoid
setPinned(boolean pinned)
Sets pin status for this build.void
setPinned(boolean pinned, User user, String comment)
Sets pin status for this build.void
setStatusText(String newText)
String
toString()
void
updatePinInfo()
Reload pin status from the databasevoid
updateStatusText()
Recalculate status line text-
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, getBuildTypeName, getChanges, getClientStartDate, getClientTimeZone, getCommitters, getCompilationErrorMessages, getContainingChanges, getCustomDataStorage, getCustomDataStorageIdsByPrefix, getDetachFromAgentReceivedTimestamp, getDownloadedArtifacts, getDuration, getDurationOnAgent, getFailureReasons, getFileContent, 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, getTestMessages, getTriggeredBy, getValueResolver, getValueResolver, getValueResolver, getVariablesProvider, getVcsRootEntries, getWaitReasons, hasBuildFinishParameters, hasBuildProblemOfType, hasTests, initMetrics, isArtifactsExists, isHasInternalArtifactsOnly, isHasRelatedIssues, isInternalError, isOutdated, isOutOfChangesSequence, isPersonalPatchAvailable, isResponsibleNeeded, isStartedOnAgent, isTimedOut, isUsedByOtherBuilds, muteBuildProblems, muteBuildProblems, now, nowDate, preloadFailedTests, publishStatisticValue, resetBuildFinalParameters, setBuildComment, setBuildStartTimes, setTags, setTags, updateExternalArtifactsInfoOnAccess
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.Build
getBuildId, getBuildTypeName, getCompilationErrorMessages, getDuration, getFullName, getLogMessages, getStartDate, getTestMessages
-
Methods inherited from interface jetbrains.buildServer.serverSide.BuildPromotionOwner
getSequenceBuild
-
Methods inherited from interface jetbrains.buildServer.serverSide.impl.FinishedBuildEx
getBuildFinishParameters, getBuildStartParameters
-
Methods inherited from interface jetbrains.buildServer.serverSide.ParametersSupport
getParametersProvider
-
Methods inherited from interface jetbrains.buildServer.serverSide.SBuild
addBuildProblem, addUserBuildProblem, convertToAgentTime, convertToServerTime, getArtifactDependencies, getArtifacts, getArtifactsDirectory, getBranch, getBuildComment, getBuildFeaturesOfType, getBuildOwnParameters, getChanges, getClientStartDate, getClientTimeZone, getCommitters, getContainingChanges, getCustomDataStorage, getDownloadedArtifacts, getFailureReasons, getFileContent, getFirstInternalError, getFirstInternalErrorMessage, getFullStatistics, getLabels, getOwner, getPreviousFinished, getProvidedArtifacts, getQueuedDate, getRecentlyFinishedBuild, getRelatedIssues, getRemoteArtifacts, getRemoteArtifactsByType, getRevisions, getServerStartDate, getShortStatistics, getStatisticValue, getStatisticValues, getTags, getTriggeredBy, getValueResolver, getVcsRootEntries, getWaitReasons, hasBuildProblemOfType, hasTests, isArtifactsExists, isHasInternalArtifactsOnly, isHasRelatedIssues, isInternalError, isOutdated, isOutOfChangesSequence, isResponsibleNeeded, isStartedOnAgent, isUsedByOtherBuilds, muteBuildProblems, setBuildComment, setTags, setTags
-
-
-
-
Constructor Detail
-
FinishedBuildImpl
public FinishedBuildImpl(long buildId, long buildPromotionId, @NotNull String buildTypeId, String agentName, int agentTypeId, @NotNull Date buildStartTimeServer, Date buildStartTimeAgent, @NotNull Date buildFinishTimeServer, @NotNull Status buildStatus, String finalStatusText, String buildNumber, boolean pinned, boolean personal, CanceledInfo canceledInfo, String rawTriggeredBy, String buildDescription, @NotNull BuildPromotionEx buildPromotion, @NotNull BuildContext context)
-
-
Method Detail
-
getBuildTypeId
@NotNull public String getBuildTypeId()
Description copied from interface:Build
Returns build configuration internal id- Specified by:
getBuildTypeId
in interfaceBuild
- Overrides:
getBuildTypeId
in classBaseBuild
- Returns:
- ID of the configuration this build belongs to.
-
getBuildTypeExternalId
@NotNull public String getBuildTypeExternalId()
Description copied from interface:Build
Returns the build type external ID.If the external identifier does not exist (this might happen for a running build if the build type was deleted, and a new build type with same external id was created), a
BuildPromotion#NOT_EXISTING_BUILD_TYPE_ID
value is returned.- Specified by:
getBuildTypeExternalId
in interfaceBuild
- Overrides:
getBuildTypeExternalId
in classBaseBuild
- Returns:
- build type external ID
-
getBuildType
@Nullable public BuildTypeEx getBuildType()
Description copied from interface:SBuild
Returns build configuration this build belongs to.- Specified by:
getBuildType
in interfaceBuild
- Specified by:
getBuildType
in interfaceSBuild
- Overrides:
getBuildType
in classBaseBuild
- Returns:
- build configuration descriptor.
-
isAgentLessBuild
public boolean isAgentLessBuild()
- Specified by:
isAgentLessBuild
in interfaceSBuild
- Overrides:
isAgentLessBuild
in classBaseBuild
- Returns:
- true if this build does not require an agent (for now this is true for composite builds only)
-
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
-
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
-
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
-
isPinned
public boolean isPinned()
Description copied from interface:SBuild
Returns true if this build is pinned
-
setPinned
public void setPinned(boolean pinned, @Nullable User user, @Nullable String comment)
Description copied from interface:SFinishedBuild
Sets pin status for this build. Pinned builds will not be cleaned by the server cleanup process.- Specified by:
setPinned
in interfaceSFinishedBuild
- Parameters:
pinned
- whether to pin build or not.user
- user who pins/unpins buildcomment
- comment
-
setPinned
public void setPinned(boolean pinned)
Description copied from interface:SFinishedBuild
Sets pin status for this build. Pinned builds will not be cleaned by the server cleanup process.- Specified by:
setPinned
in interfaceSFinishedBuild
- Parameters:
pinned
- whether to pin build or not.
-
updatePinInfo
public void updatePinInfo()
Description copied from interface:FinishedBuildEx
Reload pin status from the database- Specified by:
updatePinInfo
in interfaceFinishedBuildEx
-
getPinComment
@Nullable public Comment getPinComment()
Description copied from interface:SFinishedBuild
Returns the pin/unpin comment- Specified by:
getPinComment
in interfaceSFinishedBuild
- Returns:
- the pin/unpin comment or null if the build has never been pinned/unpinned
-
getFinishDate
@NotNull public Date getFinishDate()
Description copied from interface:SFinishedBuild
Returns finish timestamp for the build.- Specified by:
getFinishDate
in interfaceBuild
- Specified by:
getFinishDate
in interfaceSFinishedBuild
- Returns:
- Date/time when the build has been finished.
-
getFinishOnAgentDate
@NotNull 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
- Specified by:
getFinishOnAgentDate
in interfaceSFinishedBuild
- Overrides:
getFinishOnAgentDate
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
-
getBuildDescription
@Nullable 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
-
resetFullStatisticsCache
public void resetFullStatisticsCache()
- Specified by:
resetFullStatisticsCache
in interfaceFinishedBuildEx
-
resetShortStatisticsCache
public void resetShortStatisticsCache()
- Specified by:
resetShortStatisticsCache
in interfaceFinishedBuildEx
-
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
-
setLabel
public void setLabel(String labelValue, List<VcsRootInstance> rootsToLabel) throws VcsException
Description copied from interface:SFinishedBuild
Sets a label on files in VCS repository used by this build in the specified VCS roots- Specified by:
setLabel
in interfaceSFinishedBuild
- Parameters:
labelValue
- VCS label to set (references to properties are not supported)rootsToLabel
- VCS roots to label- Throws:
VcsException
- if labeling failed
-
setLabel
public void setLabel(String labelValue, @Nullable String message, List<VcsRootInstance> rootsToLabel) throws VcsException
Description copied from interface:SFinishedBuild
Sets a label on files in VCS repository used by this build in the specified VCS roots- Specified by:
setLabel
in interfaceSFinishedBuild
- Parameters:
labelValue
- label to setrootsToLabel
- VCS roots to label- Throws:
VcsException
-
getBuildLog
@NotNull public BuildLogEx getBuildLog()
Description copied from interface:SBuild
Returns build log.- Specified by:
getBuildLog
in interfaceBuildEx
- Specified by:
getBuildLog
in interfaceFinishedBuildEx
- Specified by:
getBuildLog
in interfaceSBuild
- Returns:
- build log.
-
getBuildLogIfInitialized
@Nullable public BuildLogEx getBuildLogIfInitialized()
- Specified by:
getBuildLogIfInitialized
in interfaceFinishedBuildEx
-
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
-
getBuildStatistics
@NotNull public BuildStatistics getBuildStatistics(@NotNull BuildStatisticsOptions options)
Description copied from interface:SBuild
Same asSBuild.getFullStatistics()
but with more control of data being loaded.- Specified by:
getBuildStatistics
in interfaceSBuild
- Overrides:
getBuildStatistics
in classBaseBuild
- Parameters:
options
- options- Returns:
- build statistics according to specified options
-
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 classBaseBuild
-
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 interfaceFinishedBuildEx
- Specified by:
getBuildPromotion
in classBaseBuild
- Returns:
- see above.
-
beforeDelete
public void beforeDelete(boolean sendEvent)
Description copied from interface:FinishedBuildEx
This method should be called before build is going to be deleted. This method will send corresponding event, and will remember state (build promotion) inside the build to make sure this instance of the build can still be used even after data is deleted from database.- Specified by:
beforeDelete
in interfaceFinishedBuildEx
-
buildEvictedFromCache
public void buildEvictedFromCache()
Description copied from interface:FinishedBuildEx
This method is called when the build is about to be removed from the cache- Specified by:
buildEvictedFromCache
in interfaceFinishedBuildEx
-
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.
-
isPersonal
public boolean isPersonal()
Description copied from interface:Build
Returns if this build has been run to test personal changes- Specified by:
isPersonal
in interfaceBuild
- Overrides:
isPersonal
in classBaseBuild
- Returns:
- true is the build has been started as personal, and its changes were not committed to the VCS
-
setStatusText
public void setStatusText(@NotNull String newText)
- Specified by:
setStatusText
in interfaceFinishedBuildEx
-
updateStatusText
public void updateStatusText()
Description copied from interface:FinishedBuildEx
Recalculate status line text- Specified by:
updateStatusText
in interfaceFinishedBuildEx
-
getDeploymentStatus
@NotNull public SortedMap<BuildTypeEx,BuildPromotionEx> getDeploymentStatus()
- Specified by:
getDeploymentStatus
in interfaceFinishedBuildEx
- Returns:
- map of environment build configurations depending directly on configuration of this build by snapshot or artifact dependencies to the latest triggered build promotion which is using this build. If there is no triggered build yet, then corresponding value in map entry is null.
-
getAgent
@NotNull public BuildAgentEx getAgent()
-
getBuildStatus
public Status getBuildStatus()
Description copied from interface:Build
Returns current build status- Specified by:
getBuildStatus
in interfaceBuild
- Overrides:
getBuildStatus
in classBaseBuild
- Returns:
- Current build status
-
notifyOnBuildProblemsChanged
public void notifyOnBuildProblemsChanged(@NotNull List<BuildProblemData> before, @NotNull List<BuildProblemData> after)
- Specified by:
notifyOnBuildProblemsChanged
in classBaseBuild
-
-