Class BaseBuild
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.BaseBuild
-
- All Implemented Interfaces:
Build
,BuildEx
,BuildPromotionOwner
,ParametersSupport
,SBuild
- Direct Known Subclasses:
BaseRunningBuild
,DummyBuild
,FinishedBuildImpl
public abstract class BaseBuild extends Object implements BuildEx
-
-
Field Summary
Fields Modifier and Type Field Description protected long
myBuildId
protected BuildContext
myContext
protected Counter
myStatsCallCounter
static String
REMOTE_ARTIFACTS_PREFIX
Internal property that enables storing remote artifacts count by type in custom storage
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseBuild(long buildId, String rawTriggeredBy, Date buildStartDateOnServer, BuildContext context)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addBuildProblem(BuildProblemData buildProblem)
Adds build problem to the build.BuildProblemData
addUserBuildProblem(SUser user, String problemDescription)
Adds user provided build problem to the build.void
buildProblemsChanged(List<BuildProblemData> before, List<BuildProblemData> after)
Called when build problems are changed (added, deleted or muted)Date
convertToAgentTime(Date serverTime)
Converts server time to agent time by taking into account agent and server time difference.Date
convertToServerTime(Date agentTime)
Converts agent time to server time by taking into account agent and server time difference.protected ShortStatistics
createShortStatistics(boolean updatePersistentCaches)
void
deleteBuildProblem(SUser user, String identity, String comment)
Deletes build problem Deleting build problem may change build status to SUCCESSprotected DepParametersMemoryOptimizedMap
doGetBuildFinishParameters()
protected DepParametersMemoryOptimizedMap
doGetBuildStartParameters()
abstract BuildAgentEx
getAgent()
List<SArtifactDependency>
getArtifactDependencies()
Returns the artifact dependencies of this build.BuildArtifacts
getArtifacts(BuildArtifactsViewMode mode)
Returns accessor for build artifacts.File
getArtifactsDirectory()
Returns artifacts directory of this build.AuditLogFactory
getAuditLogFactory()
AuditLogProvider
getAuditLogProvider()
Branch
getBranch()
Comment
getBuildComment()
Returns build comment.protected BuildContext
getBuildContext()
protected abstract long
getBuildCounter()
Collection<SBuildFeatureDescriptor>
getBuildFeaturesOfType(String featureType)
Returns collection of enabled and resolved build features of specified type from build settings (resolving is performed at the moment of the method call).DepParametersMemoryOptimizedMap
getBuildFinishParameters()
long
getBuildId()
Returns build idMap<String,String>
getBuildNumberParameters()
protected static String
getBuildNumberWithoutRefs(String curBuildNumber)
Map<String,String>
getBuildOwnParameters()
Returns map of parameters (configuration params, system properties and environment variables) excluding parameters provided by extensions.List<BuildProblem>
getBuildProblems()
Returns all build problems for this promotion with extended information about muting This method can perform rather slow as it reloads build problems from database and fills mute info from audit (reads database as well) If you don't need mute info try usingSBuild.getFailureReasons()
abstract BuildPromotionEx
getBuildPromotion()
Returns build promotionDepParametersMemoryOptimizedMap
getBuildStartParameters()
BuildStatistics
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 idString
getBuildTypeName()
Returns name of the build configuration this build belongs to.List<SVcsModification>
getChanges(SelectPrevBuildPolicy policy, boolean includeModificationsIfPreviousBuildIsAbsent)
List of modifications detected in the version control since the previous build (selected according to the specified policy) Ordering: last detected modifications goes first in the listDate
getClientStartDate()
Returns the timestamp when the build was started on the build agent (in agent time)TimeZone
getClientTimeZone()
Returns agent machine time zone if it's available on server.UserSet<SUser>
getCommitters(SelectPrevBuildPolicy selectPrevBuildPolicy)
Returns all users who made modifications since the previous build selected according to the specified policy.List<String>
getCompilationErrorMessages()
Returns compilation error messages of this buildList<SVcsModification>
getContainingChanges()
Returns changes in this build.CustomDataStorage
getCustomDataStorage(String key)
Returns a data storage which can be used to associate arbitrary data with the build.protected Set<String>
getCustomDataStorageIdsByPrefix(String keyPrefix)
Long
getDetachFromAgentReceivedTimestamp()
DownloadedArtifacts
getDownloadedArtifacts()
Returns information about artifacts downloaded by this build according to configured artifact dependencies.long
getDuration()
The build duration is computed as follows: - if build was started on an agent (run command was successfully sent) then duration is calculated as finish time - start on agent time - otherwise duration is calculated as finish time - remove from queue timelong
getDurationOnAgent()
List<BuildProblemData>
getFailureReasons()
Returns build problems that caused build failure or empty list if build is successfulbyte[]
getFileContent(String filePath)
Get binary content of the single file related to this build.Date
getFinishOnAgentDate()
Returns timestamp when the build finished on agent (server time) ornull
if it is still running on agent.String
getFirstInternalError()
Returns the first internal error in a build, or null.String
getFirstInternalErrorMessage()
Returns the error message associated with the first internal error, or nullString
getFullName()
BuildStatistics
getFullStatistics()
Calculates full statistics for this build.String
getId()
List<VcsLabel>
getLabels()
VCS labels which were made by TeamCity for the build.List<String>
getLogMessages(int skipMessages, int maxCount)
Allows to get messages logged for the buildSUser
getOwner()
If this build is personal one, returns the owner of this build.ParametersProvider
getParametersProvider()
Returns parameters which can be used by value resolver.SFinishedBuild
getPreviousFinished()
DownloadedArtifacts
getProvidedArtifacts()
Returns information about provided artifacts, i.e.Date
getQueuedDate()
Returns the date when the build was added to queue.abstract String
getRawBuildNumber()
Returns raw build number (i.e.SFinishedBuild
getRecentlyFinishedBuild()
Collection<Issue>
getRelatedIssues()
Returns the collection of related issues (e.g.List<RemoteArtifacts>
getRemoteArtifacts()
Returns list of all remote artifacts that were published for this build.RemoteArtifacts
getRemoteArtifactsByType(String type)
Returns list of remote artifacts that belong to a specific type.List<BuildRevision>
getRevisions()
List of all revisions which were used for the build instanceSBuild
getSequenceBuild()
If associated build promotion has modification id, returns the sequence build which contains the same changes as this build promotion.Date
getServerStartDate()
Returns the timestamp when the build was removed from the queue.protected File
getSettingsDigestFile()
static byte[]
getSettingsDigestFromFile(File artifactsDirectory)
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 sentBigDecimal
getStatisticValue(String valueTypeKey)
Map<String,BigDecimal>
getStatisticValues()
protected static Status
getStatus(List<BuildProblemData> before, List<BuildProblemData> after)
List<String>
getTags()
Returns list of public tags for this buildCustomDataStorage
getTemporaryCustomDataStorage()
List<TestInfo>
getTestMessages(int skipTests, int maxTestsToLoad)
Retrieves information about tests failed in the build.TriggeredBy
getTriggeredBy()
Returns details about how this build was triggered.ValueResolver
getValueResolver()
Returns build-aware value resolver to be used to resolve values based on the build's properties.ValueResolver
getValueResolver(boolean preferBuildStartParameters)
Creates resolver which can use build start parameters instead of build finish params, this resolver is required to provide consistent resolving on the server for personal and non personal buildsprotected ValueResolver
getValueResolver(Map<String,String> highPrioParams)
Creates value resolver where the specified map of parameters has the highest priority.protected ContextVariables
getVariablesProvider()
List<VcsRootInstanceEntry>
getVcsRootEntries()
Returns vcs roots with checkout rules for the build start moment.Map<String,Long>
getWaitReasons()
Returns wait reasons for this build, while it was in the build queue.boolean
hasBuildFinishParameters()
boolean
hasBuildProblemOfType(String type)
Returns true if build has build problem of this typeboolean
hasTests()
protected void
initMetrics(BuildContext context)
boolean
isAgentLessBuild()
boolean
isArtifactsExists()
Returns true if this build has artifacts.boolean
isDetachedFromAgent()
Returns true if this build was detached from agent at some point.boolean
isHasInternalArtifactsOnly()
Returns true if this build has only internal (hidden) artifacts.boolean
isHasRelatedIssues()
Returns whether the build has related issues (e.g.boolean
isInternalError()
Returns whether this build failed because of internal error (infrastructural error not related to build script).boolean
isOutdated()
Returns true if this build is outdated.boolean
isOutOfChangesSequence()
Returns true if there is a build started before but having more recent changes then this build.boolean
isPersonal()
Returns if this build has been run to test personal changesprotected boolean
isPersonalPatchAvailable()
boolean
isPinned()
Returns true if this build is pinnedboolean
isResponsibleNeeded()
Always returns false for personal and/or cancelled builds.boolean
isStartedOnAgent()
Returns true if this build was started on agent.boolean
isTimedOut()
boolean
isUsedByOtherBuilds()
Returns true if this build is used by other builds, i.e.void
muteBuildProblems(boolean muteIfTrue)
Makes all existing build problems enabled or disabledvoid
muteBuildProblems(SUser user, boolean muteIfTrue, String comment)
Makes all existing build problems enabled or disabledprotected abstract void
notifyOnBuildProblemsChanged(List<BuildProblemData> before, List<BuildProblemData> after)
protected long
now()
protected Date
nowDate()
protected void
preloadFailedTests(ShortStatistics stats)
void
publishStatisticValue(String valueTypeKey, BigDecimal value)
void
resetBuildFinalParameters()
void
setBuildComment(User user, String comment)
Sets the comment for the buildprotected void
setBuildStartTimes(Date buildStartTimeAgent, Date buildStartTimeServer, TimeZone agentTimeZone)
void
setTags(List<String> tags)
Sets public tags for this buildvoid
setTags(User user, List<String> tags)
Sets public tags for this buildvoid
updateExternalArtifactsInfoOnAccess()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.Build
getAgentName, getBuildNumber, getCanceledInfo, getFinishDate, getProjectExternalId, getProjectId, getStatusDescriptor, isFinished
-
Methods inherited from interface jetbrains.buildServer.serverSide.BuildEx
getBuildLog, getCachedShortStatistics
-
Methods inherited from interface jetbrains.buildServer.serverSide.SBuild
getBuildDescription, isCompositeBuild
-
-
-
-
Field Detail
-
REMOTE_ARTIFACTS_PREFIX
public static final String REMOTE_ARTIFACTS_PREFIX
Internal property that enables storing remote artifacts count by type in custom storage- Since:
- 2022.06
- See Also:
- Constant Field Values
-
myContext
protected final BuildContext myContext
-
myBuildId
protected long myBuildId
-
myStatsCallCounter
protected Counter myStatsCallCounter
-
-
Constructor Detail
-
BaseBuild
protected BaseBuild(long buildId, String rawTriggeredBy, @Nullable Date buildStartDateOnServer, @NotNull BuildContext context)
-
-
Method Detail
-
initMetrics
protected void initMetrics(@NotNull BuildContext context)
-
setBuildStartTimes
protected void setBuildStartTimes(@Nullable Date buildStartTimeAgent, @NotNull Date buildStartTimeServer, @Nullable TimeZone agentTimeZone)
-
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
- Returns:
- true is the build has been started as personal, and its changes were not committed to the VCS
-
isPersonalPatchAvailable
protected boolean isPersonalPatchAvailable()
-
getDuration
public long getDuration()
The build duration is computed as follows: - if build was started on an agent (run command was successfully sent) then duration is calculated as finish time - start on agent time - otherwise duration is calculated as finish time - remove from queue time- Specified by:
getDuration
in interfaceBuild
- Returns:
- current build duration in seconds
-
getDurationOnAgent
public long getDurationOnAgent()
- Specified by:
getDurationOnAgent
in interfaceBuildEx
- Returns:
- build duration in seconds on agent or 0 if the build wasn't running on agent
-
getOwner
@Nullable public SUser getOwner()
Description copied from interface:SBuild
If this build is personal one, returns the owner of this build.- Specified by:
getOwner
in interfaceSBuild
- Returns:
- null if this build is not personal otherwise owner of this build
- See Also:
Build.isPersonal()
-
getBuildId
public long getBuildId()
Description copied from interface:Build
Returns build id- Specified by:
getBuildId
in interfaceBuild
- Returns:
- Unique build id
-
getBuildTypeId
@NotNull public String getBuildTypeId()
Description copied from interface:Build
Returns build configuration internal id- Specified by:
getBuildTypeId
in interfaceBuild
- 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
- 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
- Returns:
- build configuration descriptor.
-
getBuildTypeName
@NotNull public String getBuildTypeName()
Description copied from interface:Build
Returns name of the build configuration this build belongs to.- Specified by:
getBuildTypeName
in interfaceBuild
- Returns:
- name of the build configuration this build belongs to.
-
getFullName
@NotNull public String getFullName()
- Specified by:
getFullName
in interfaceBuild
- Returns:
- full name of the build configuration this build belongs to, has form "project_name :: buildconfig_name"
-
getArtifacts
@NotNull public BuildArtifacts getArtifacts(@NotNull BuildArtifactsViewMode mode)
Description copied from interface:SBuild
Returns accessor for build artifacts. This accessor checks all necessary permissions for accessing files.- Specified by:
getArtifacts
in interfaceSBuild
- Parameters:
mode
- view mode to see artifacts- Returns:
- build artifacts viewer
-
getArtifactsDirectory
@NotNull public File getArtifactsDirectory()
Description copied from interface:SBuild
Returns artifacts directory of this build. Artifacts should be locked with help ofArtifactsGuard
for the period of their processing.- Specified by:
getArtifactsDirectory
in interfaceSBuild
- Returns:
- artifacts directory of this build
-
getArtifactDependencies
@NotNull public List<SArtifactDependency> getArtifactDependencies()
Description copied from interface:SBuild
Returns the artifact dependencies of this build. Same as getBuildPromotion().getArtifactDependencies().- Specified by:
getArtifactDependencies
in interfaceSBuild
- Returns:
- artifact dependencies
-
isResponsibleNeeded
public boolean isResponsibleNeeded()
Description copied from interface:SBuild
Always returns false for personal and/or cancelled builds. Returns true if this build is failed (or failing) and there are no finished successful builds after this build. Returns true even if there is active responsible for the build configuration but the configuration status is failed.- Specified by:
isResponsibleNeeded
in interfaceSBuild
- Returns:
- see above.
-
getLogMessages
public List<String> getLogMessages(int skipMessages, int maxCount)
Description copied from interface:Build
Allows to get messages logged for the build- Specified by:
getLogMessages
in interfaceBuild
- Parameters:
skipMessages
- index of the first message to load (zero based)maxCount
- messages count limit.- Returns:
- list of plain messages
-
getCompilationErrorMessages
public List<String> getCompilationErrorMessages()
Description copied from interface:Build
Returns compilation error messages of this build- Specified by:
getCompilationErrorMessages
in interfaceBuild
- Returns:
- list of plain messages
-
getDownloadedArtifacts
@NotNull public DownloadedArtifacts getDownloadedArtifacts()
Description copied from interface:SBuild
Returns information about artifacts downloaded by this build according to configured artifact dependencies.- Specified by:
getDownloadedArtifacts
in interfaceSBuild
- Returns:
- information about downloaded artifacts.
-
getProvidedArtifacts
@NotNull public DownloadedArtifacts getProvidedArtifacts()
Description copied from interface:SBuild
Returns information about provided artifacts, i.e. artifacts that were downloaded from this build by other builds by artifact dependencies.- Specified by:
getProvidedArtifacts
in interfaceSBuild
- Returns:
- see above
-
isUsedByOtherBuilds
public boolean isUsedByOtherBuilds()
Description copied from interface:SBuild
Returns true if this build is used by other builds, i.e. there are dependencies by sources on this build or artifacts of this build were downloaded by other builds.- Specified by:
isUsedByOtherBuilds
in interfaceSBuild
- Returns:
- see above
-
getTags
public List<String> getTags()
Description copied from interface:SBuild
Returns list of public tags for this build
-
setTags
public void setTags(List<String> tags)
Description copied from interface:SBuild
Sets public tags for this build
-
setTags
public void setTags(@Nullable User user, @Nullable List<String> tags)
Description copied from interface:SBuild
Sets public tags for this build
-
getFileContent
@NotNull public byte[] getFileContent(String filePath) throws VcsException
Description copied from interface:SBuild
Get binary content of the single file related to this build.- Specified by:
getFileContent
in interfaceSBuild
- Parameters:
filePath
- - relative file path regarding to the project root, "checkout root" from vcs root should not be included- Returns:
- - specified file content, corresponding to the build
- Throws:
VcsException
- if some problem occurred while getting file content from the source control repository.
-
getRevisions
@NotNull public List<BuildRevision> getRevisions()
Description copied from interface:SBuild
List of all revisions which were used for the build instance- Specified by:
getRevisions
in interfaceSBuild
- Returns:
- all revisions which were used in this build
-
getLabels
public List<VcsLabel> getLabels()
Description copied from interface:SBuild
VCS labels which were made by TeamCity for the build. If label attempt fails VcsLabel status is FAILED and failureReason contains short description of the problem.
-
getFullStatistics
@NotNull public BuildStatistics getFullStatistics()
Description copied from interface:SBuild
Calculates full statistics for this build. This method can be time consuming, if you do not need some parts of build statistics try to use methodSBuild.getBuildStatistics(BuildStatisticsOptions)
instead.- Specified by:
getFullStatistics
in interfaceSBuild
- Returns:
- full statistics for this build.
-
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
- Parameters:
options
- options- Returns:
- build statistics according to specified options
-
isArtifactsExists
public boolean isArtifactsExists()
Description copied from interface:SBuild
Returns true if this build has artifacts. Internal TeamCity artifacts are ignored.- Specified by:
isArtifactsExists
in interfaceSBuild
- Returns:
- true if this build has artifacts
- See Also:
ArtifactsConstants.TEAMCITY_ARTIFACTS_DIR
,SBuild.isHasInternalArtifactsOnly()
-
isHasInternalArtifactsOnly
public boolean isHasInternalArtifactsOnly()
Description copied from interface:SBuild
Returns true if this build has only internal (hidden) artifacts.- Specified by:
isHasInternalArtifactsOnly
in interfaceSBuild
- Returns:
- true if this build has internal artifacts only
- See Also:
SBuild.isArtifactsExists()
-
getQueuedDate
@NotNull public Date getQueuedDate()
Description copied from interface:SBuild
Returns the date when the build was added to queue.- Specified by:
getQueuedDate
in interfaceSBuild
- Returns:
- queued time.
-
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
- Returns:
- the timestamp when the build was removed from the queue.
-
getClientStartDate
@Nullable public Date getClientStartDate()
Description copied from interface:SBuild
Returns the timestamp when the build was started on the build agent (in agent time)- Specified by:
getClientStartDate
in interfaceSBuild
- Returns:
- the timestamp when the build was started on the build agent (in agent time)
-
isStartedOnAgent
public boolean isStartedOnAgent()
Description copied from interface:SBuild
Returns true if this build was started on agent.- Specified by:
isStartedOnAgent
in interfaceSBuild
- Returns:
- see above
-
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
- Returns:
- see above
-
convertToServerTime
@NotNull public Date convertToServerTime(@NotNull Date agentTime)
Description copied from interface:SBuild
Converts agent time to server time by taking into account agent and server time difference.- Specified by:
convertToServerTime
in interfaceSBuild
- Parameters:
agentTime
- time on agent- Returns:
- server time
-
convertToAgentTime
@NotNull public Date convertToAgentTime(@NotNull Date serverTime)
Description copied from interface:SBuild
Converts server time to agent time by taking into account agent and server time difference.- Specified by:
convertToAgentTime
in interfaceSBuild
- Parameters:
serverTime
- server time to convert- Returns:
- agent time
-
getRawBuildNumber
public abstract 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
- Returns:
- raw build number which can contain unresolved parameters
-
getBuildCounter
protected abstract long getBuildCounter()
-
getBuildPromotion
@NotNull public abstract BuildPromotionEx getBuildPromotion()
Description copied from interface:BuildPromotionOwner
Returns build promotion- Specified by:
getBuildPromotion
in interfaceBuildEx
- Specified by:
getBuildPromotion
in interfaceBuildPromotionOwner
- Returns:
- see above.
-
getSequenceBuild
public SBuild getSequenceBuild()
Description copied from interface:BuildPromotionOwner
If associated build promotion has modification id, returns the sequence build which contains the same changes as this build promotion. I.e. returns the first build, which contains all the changes from associated build promotion. If associated build promotion already in changes sequence, returnsBuildPromotion.getAssociatedBuild()
- Specified by:
getSequenceBuild
in interfaceBuildPromotionOwner
- Returns:
- sequence build for the same changes as for associated build promotion, or null if there are no such a build
-
getVcsRootEntries
public List<VcsRootInstanceEntry> getVcsRootEntries()
Description copied from interface:SBuild
Returns vcs roots with checkout rules for the build start moment.- Specified by:
getVcsRootEntries
in interfaceSBuild
- Returns:
- vcs roots with checkout rules for the build start moment.
-
getChanges
@NotNull public List<SVcsModification> getChanges(@NotNull SelectPrevBuildPolicy policy, boolean includeModificationsIfPreviousBuildIsAbsent)
Description copied from interface:Build
List of modifications detected in the version control since the previous build (selected according to the specified policy) Ordering: last detected modifications goes first in the list- Specified by:
getChanges
in interfaceBuild
- Specified by:
getChanges
in interfaceSBuild
- Parameters:
policy
- can be one of the two kinds:SelectPrevBuildPolicy.SINCE_LAST_BUILD
- all modifications made since previous running buildSelectPrevBuildPolicy.SINCE_LAST_SUCCESSFULLY_FINISHED_BUILD
- all modifications made since previous successfully finished build
includeModificationsIfPreviousBuildIsAbsent
- should the method return something if there's no previous build.- Returns:
- list of modifications
-
getContainingChanges
@NotNull public List<SVcsModification> getContainingChanges()
Description copied from interface:Build
Returns changes in this build. Same as getChanges(SelectPrevBuildPolicy.SINCE_LAST_BUILD, false) Ordering: last detected modifications goes first in the list- Specified by:
getContainingChanges
in interfaceBuild
- Specified by:
getContainingChanges
in interfaceSBuild
- Returns:
- changes in this build
-
getCommitters
public UserSet<SUser> getCommitters(@NotNull SelectPrevBuildPolicy selectPrevBuildPolicy)
Description copied from interface:Build
Returns all users who made modifications since the previous build selected according to the specified policy. Will provide results only after changes are collected for a build (i.e. afterBuildServerListener.changesLoaded
event for the build) and will only return users with matching VCS usernames set.- Specified by:
getCommitters
in interfaceBuild
- Specified by:
getCommitters
in interfaceSBuild
- Parameters:
selectPrevBuildPolicy
- can be one of the two kinds:SelectPrevBuildPolicy.SINCE_LAST_BUILD
- all modifications made since previous running buildSelectPrevBuildPolicy.SINCE_LAST_SUCCESSFULLY_FINISHED_BUILD
- all modifications made since previous successfully finished build
- Returns:
- committers in this build according to selection policy. If the build is personal, the set contains the only user who started the build
-
isOutOfChangesSequence
public boolean isOutOfChangesSequence()
Description copied from interface:SBuild
Returns true if there is a build started before but having more recent changes then this build. Such situation can occur if this build was associated with a specific change list before adding to queue at the time when more recent changes were available.- Specified by:
isOutOfChangesSequence
in interfaceSBuild
- Returns:
- see above
-
getTriggeredBy
@NotNull public TriggeredBy getTriggeredBy()
Description copied from interface:SBuild
Returns details about how this build was triggered.- Specified by:
getTriggeredBy
in interfaceSBuild
- Returns:
- see above
-
getBuildComment
public Comment getBuildComment()
Description copied from interface:SBuild
Returns build comment.- Specified by:
getBuildComment
in interfaceSBuild
- Returns:
- build comment, or null if this build is not commented.
-
setBuildComment
public void setBuildComment(@Nullable User user, @Nullable String comment)
Description copied from interface:SBuild
Sets the comment for the build- Specified by:
setBuildComment
in interfaceSBuild
- Parameters:
user
- user who sets the commentcomment
- text of the comment
-
isPinned
public boolean isPinned()
Description copied from interface:SBuild
Returns true if this build is pinned
-
getId
public String getId()
-
hasBuildFinishParameters
public boolean hasBuildFinishParameters()
-
resetBuildFinalParameters
public void resetBuildFinalParameters()
-
getParametersProvider
@NotNull public ParametersProvider getParametersProvider()
Description copied from interface:ParametersSupport
Returns parameters which can be used by value resolver. Note that some of the parameters may not have values defined because sometimes values can be calculated on the agent side only.- Specified by:
getParametersProvider
in interfaceParametersSupport
- Returns:
- set of build parameters known on the server-side for the build and prefixed server-side parameters of all the build dependencies
-
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
- Returns:
- short statistics for this build.
-
hasTests
public boolean hasTests()
-
createShortStatistics
@NotNull protected ShortStatistics createShortStatistics(boolean updatePersistentCaches)
-
preloadFailedTests
protected void preloadFailedTests(@NotNull ShortStatistics stats)
-
getBuildFinishParameters
@Nullable public DepParametersMemoryOptimizedMap getBuildFinishParameters()
-
getBuildStartParameters
@Nullable public DepParametersMemoryOptimizedMap getBuildStartParameters()
-
doGetBuildFinishParameters
@Nullable protected DepParametersMemoryOptimizedMap doGetBuildFinishParameters()
-
doGetBuildStartParameters
@Nullable protected DepParametersMemoryOptimizedMap doGetBuildStartParameters()
-
publishStatisticValue
public void publishStatisticValue(@NotNull String valueTypeKey, @Nullable BigDecimal value)
-
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
- Returns:
- set of build parameters known on the server-side for the build.
-
getRelatedIssues
@NotNull public Collection<Issue> getRelatedIssues()
Description copied from interface:SBuild
Returns the collection of related issues (e.g. mentioned in modification's comments, or mentioned in the build's comment).- Specified by:
getRelatedIssues
in interfaceSBuild
- Returns:
- related issues
- See Also:
SBuild.isHasRelatedIssues()
,SVcsModification.getRelatedIssues()
-
isHasRelatedIssues
public boolean isHasRelatedIssues()
Description copied from interface:SBuild
Returns whether the build has related issues (e.g. mentioned in modification's comments, or mentioned in the build's comment).- Specified by:
isHasRelatedIssues
in interfaceSBuild
- Returns:
- true if the build has related issues
- See Also:
SBuild.getRelatedIssues()
,SVcsModification.isHasRelatedIssues()
-
getVariablesProvider
@NotNull protected ContextVariables getVariablesProvider()
-
getValueResolver
@NotNull public ValueResolver getValueResolver()
Description copied from interface:SBuild
Returns build-aware value resolver to be used to resolve values based on the build's properties.- Specified by:
getValueResolver
in interfaceParametersSupport
- Specified by:
getValueResolver
in interfaceSBuild
- Returns:
- this build-aware value resolver
-
getValueResolver
@NotNull protected ValueResolver getValueResolver(@NotNull Map<String,String> highPrioParams)
Creates value resolver where the specified map of parameters has the highest priority.
-
getValueResolver
@NotNull public ValueResolver getValueResolver(boolean preferBuildStartParameters)
Creates resolver which can use build start parameters instead of build finish params, this resolver is required to provide consistent resolving on the server for personal and non personal builds
-
getBuildNumberWithoutRefs
@NotNull @Contract("null -> !null") protected static String getBuildNumberWithoutRefs(@Nullable String curBuildNumber)
-
isInternalError
public boolean isInternalError()
Description copied from interface:SBuild
Returns whether this build failed because of internal error (infrastructural error not related to build script).- Specified by:
isInternalError
in interfaceSBuild
- Returns:
- true iff the build is error
-
getFirstInternalError
public String getFirstInternalError()
Description copied from interface:SBuild
Returns the first internal error in a build, or null.- Specified by:
getFirstInternalError
in interfaceSBuild
- Returns:
- first internal error type
-
getFirstInternalErrorMessage
public String getFirstInternalErrorMessage()
Description copied from interface:SBuild
Returns the error message associated with the first internal error, or null- Specified by:
getFirstInternalErrorMessage
in interfaceSBuild
- Returns:
- first internal error message
-
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
- 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
-
getClientTimeZone
@Nullable public TimeZone getClientTimeZone()
Description copied from interface:SBuild
Returns agent machine time zone if it's available on server.- Specified by:
getClientTimeZone
in interfaceSBuild
- Returns:
- Agent time zone or null if the build wasn't started yet.
-
getAgent
@NotNull public abstract BuildAgentEx getAgent()
-
addBuildProblem
public void addBuildProblem(@NotNull BuildProblemData buildProblem)
Description copied from interface:SBuild
Adds build problem to the build. Currently build problem causes build failure.- Specified by:
addBuildProblem
in interfaceSBuild
-
buildProblemsChanged
public void buildProblemsChanged(@NotNull List<BuildProblemData> before, @NotNull List<BuildProblemData> after)
Description copied from interface:BuildEx
Called when build problems are changed (added, deleted or muted)- Specified by:
buildProblemsChanged
in interfaceBuildEx
- Parameters:
before
- problems before changeafter
- problems after change
-
getRemoteArtifacts
@NotNull public List<RemoteArtifacts> getRemoteArtifacts()
Description copied from interface:SBuild
Returns list of all remote artifacts that were published for this build.- Specified by:
getRemoteArtifacts
in interfaceSBuild
- Returns:
- collection of
RemoteArtifact
-
getRemoteArtifactsByType
@NotNull public RemoteArtifacts getRemoteArtifactsByType(@NotNull String type)
Description copied from interface:SBuild
Returns list of remote artifacts that belong to a specific type.- Specified by:
getRemoteArtifactsByType
in interfaceSBuild
- Returns:
- collection of
RemoteArtifact
-
notifyOnBuildProblemsChanged
protected abstract void notifyOnBuildProblemsChanged(@NotNull List<BuildProblemData> before, @NotNull List<BuildProblemData> after)
-
getStatus
@Nullable protected static Status getStatus(@NotNull List<BuildProblemData> before, @NotNull List<BuildProblemData> after)
-
getBuildStatus
public Status getBuildStatus()
Description copied from interface:Build
Returns current build status- Specified by:
getBuildStatus
in interfaceBuild
- Returns:
- Current build status
-
getFailureReasons
@NotNull public List<BuildProblemData> getFailureReasons()
Description copied from interface:SBuild
Returns build problems that caused build failure or empty list if build is successful- Specified by:
getFailureReasons
in interfaceSBuild
- Returns:
- see above
-
getBuildProblems
@NotNull public List<BuildProblem> getBuildProblems()
Description copied from interface:BuildEx
Returns all build problems for this promotion with extended information about muting This method can perform rather slow as it reloads build problems from database and fills mute info from audit (reads database as well) If you don't need mute info try usingSBuild.getFailureReasons()
- Specified by:
getBuildProblems
in interfaceBuildEx
- Returns:
- see above
-
hasBuildProblemOfType
public boolean hasBuildProblemOfType(@NotNull String type)
Description copied from interface:SBuild
Returns true if build has build problem of this type- Specified by:
hasBuildProblemOfType
in interfaceSBuild
- Parameters:
type
- build problem type- Returns:
- see above
- See Also:
BuildProblemData
-
muteBuildProblems
public void muteBuildProblems(boolean muteIfTrue)
Description copied from interface:BuildEx
Makes all existing build problems enabled or disabled- Specified by:
muteBuildProblems
in interfaceBuildEx
- Parameters:
muteIfTrue
- pass true to make build successful, false to make existing problems visible again
-
muteBuildProblems
public void muteBuildProblems(@NotNull SUser user, boolean muteIfTrue, @NotNull String comment)
Description copied from interface:SBuild
Makes all existing build problems enabled or disabled- Specified by:
muteBuildProblems
in interfaceSBuild
- Parameters:
user
- user that will be used in auditmuteIfTrue
- pass true to make build successful, false to make existing problems visible againcomment
- comment for audit
-
addUserBuildProblem
public BuildProblemData addUserBuildProblem(@NotNull SUser user, @NotNull String problemDescription)
Description copied from interface:SBuild
Adds user provided build problem to the build. Currently build problem causes build failure. Adding user provided problem always overrides previously added one- Specified by:
addUserBuildProblem
in interfaceSBuild
- Parameters:
user
- user that will be used in audit- Returns:
- added build problem
-
deleteBuildProblem
public void deleteBuildProblem(@NotNull SUser user, @NotNull String identity, @Nullable String comment)
Description copied from interface:BuildEx
Deletes build problem Deleting build problem may change build status to SUCCESS- Specified by:
deleteBuildProblem
in interfaceBuildEx
- Parameters:
user
- user that will be used in auditidentity
- identiry of build problem to be removedcomment
- comment for audit
-
getBranch
@Nullable public Branch getBranch()
-
getPreviousFinished
@Nullable public SFinishedBuild getPreviousFinished()
- Specified by:
getPreviousFinished
in interfaceSBuild
- Returns:
- returns previous finished build (ordered by changes). If this build is personal, this method can return previous personal build, otherwise only regular builds are returned.
-
getAuditLogFactory
@NotNull public AuditLogFactory getAuditLogFactory()
-
getAuditLogProvider
@NotNull public AuditLogProvider getAuditLogProvider()
-
getSettingsDigestFromFile
@Nullable public static byte[] getSettingsDigestFromFile(@NotNull File artifactsDirectory)
-
getCustomDataStorage
@NotNull public CustomDataStorage getCustomDataStorage(@NotNull String key)
Description copied from interface:SBuild
Returns a data storage which can be used to associate arbitrary data with the build.- Specified by:
getCustomDataStorage
in interfaceSBuild
- Parameters:
key
- a key to access the storage- Returns:
- an existing or newly created storage for the given key
-
getCustomDataStorageIdsByPrefix
@NotNull protected Set<String> getCustomDataStorageIdsByPrefix(@NotNull String keyPrefix)
-
getTemporaryCustomDataStorage
@NotNull public CustomDataStorage getTemporaryCustomDataStorage()
-
getSettingsDigestFile
@NotNull protected File getSettingsDigestFile()
-
getStatisticValue
@Nullable public BigDecimal getStatisticValue(@NotNull String valueTypeKey)
- Specified by:
getStatisticValue
in interfaceSBuild
- Parameters:
valueTypeKey
- ValueType key to lookup. Eg TimeSpentInQueue, ArtifactsSize, DuplicatorStats CodeCoverageB, CodeCoverageC or any custom build statistic value reported by service message during the build.- Returns:
- Value of specified ValueType. Null when specified value wasn't produced during the build (eg no artifacts produced for ArtifactsSize key) or key is invalid.
- See Also:
ValueProviderRegistry
-
getStatisticValues
@NotNull public Map<String,BigDecimal> getStatisticValues()
- Specified by:
getStatisticValues
in interfaceSBuild
- Returns:
- All statistics values associated with this build. Includes all predefined ValueTypes reported for this build and custom metrics reported by service message during the build as well (even when there is no ValueType defined for the metric).
-
getBuildFeaturesOfType
@NotNull public Collection<SBuildFeatureDescriptor> getBuildFeaturesOfType(@NotNull String featureType)
Description copied from interface:SBuild
Returns collection of enabled and resolved build features of specified type from build settings (resolving is performed at the moment of the method call).- Specified by:
getBuildFeaturesOfType
in interfaceSBuild
- Parameters:
featureType
- type of the build feature- Returns:
- see above
-
isOutdated
public boolean isOutdated()
Description copied from interface:SBuild
Returns true if this build is outdated. The build is considered outdated if there is a finished non-personal build which contains newer (or same) changes as contained in this build.- Specified by:
isOutdated
in interfaceSBuild
- Returns:
- see above
-
getRecentlyFinishedBuild
@Nullable public SFinishedBuild getRecentlyFinishedBuild()
- Specified by:
getRecentlyFinishedBuild
in interfaceSBuild
- Returns:
- the build because of which this running build has been marked as outdated (see
SBuild.isOutdated()
).
-
isAgentLessBuild
public boolean isAgentLessBuild()
- Specified by:
isAgentLessBuild
in interfaceSBuild
- 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
- Returns:
- see above
-
getDetachFromAgentReceivedTimestamp
@Nullable public Long getDetachFromAgentReceivedTimestamp()
- Specified by:
getDetachFromAgentReceivedTimestamp
in interfaceBuildEx
- Returns:
- timestamp when this build was attempted to detach from agent
-
getWaitReasons
@NotNull public Map<String,Long> getWaitReasons()
Description copied from interface:SBuild
Returns wait reasons for this build, while it was in the build queue. The key of the map is a wait reason description in human friendly form. The value is amount of milliseconds this wait reason was reported for this queued build.- Specified by:
getWaitReasons
in interfaceSBuild
- Returns:
- map of a wait reason to amount of time it was reported for the build in milliseconds
-
getBuildContext
@NotNull protected BuildContext getBuildContext()
-
isTimedOut
public boolean isTimedOut()
- Specified by:
isTimedOut
in interfaceBuildEx
- Returns:
- true if this build finished by timeout
-
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
- Returns:
- see above
-
nowDate
@NotNull protected Date nowDate()
-
now
protected long now()
-
updateExternalArtifactsInfoOnAccess
public void updateExternalArtifactsInfoOnAccess()
-
-