Class DummyBuildPromotion
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.AbstractBuildPromotion
-
- jetbrains.buildServer.serverSide.impl.DummyBuildPromotion
-
- All Implemented Interfaces:
Comparable<BuildPromotion>
,BuildPromotionInfo
,BuildPromotion
,BuildPromotionEx
,InternalParameters
,ReadOnlyUserParameters
- Direct Known Subclasses:
BuildPromotionManagerImpl.TemplateDummyBuildPromotion
public class DummyBuildPromotion extends AbstractBuildPromotion
This is a fake (non real) build promotion which is used to create a build and obtain ValueResolver
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jetbrains.buildServer.serverSide.impl.AbstractBuildPromotion
AbstractBuildPromotion.CandidatesCache<A extends AgentDescription>
-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.BuildPromotionEx
BuildPromotionEx.ArtifactsState, BuildPromotionEx.ArtifactsStateInfo, BuildPromotionEx.CompatibilityCacheUpdateMode, BuildPromotionEx.PromotionPersistMode, BuildPromotionEx.UpdateReason
-
-
Field Summary
-
Fields inherited from class jetbrains.buildServer.serverSide.impl.AbstractBuildPromotion
PROVIDED_UPPER_LIMIT_REVISION_REV_ATTR_PREFIX, PROVIDED_UPPER_LIMIT_REVISION_VCS_BRANCH_ATTR_PREFIX, VERSIONED_SETTINGS_REVISION_PREFIX
-
Fields inherited from interface jetbrains.buildServer.serverSide.BuildPromotion
NOT_EXISTING_BUILD_TYPE_ID
-
Fields inherited from interface jetbrains.buildServer.serverSide.BuildPromotionEx
MAIN_NODE_MARKER, MAX_BRANCH_NAME_LENGTH
-
-
Constructor Summary
Constructors Constructor Description DummyBuildPromotion(String branchName, BuildTypeEx buildType, BuildPromotionContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBuildProblem(BuildProblemData buildProblem)
Adds build problem, currently it actually causes build failurevoid
addDependedOnMe(BuildPromotionEx promotion, DependencyOptions options)
Adds link to parent promotionvoid
addDependedOnMeIfCached(BuildPromotionEx promotion, DependencyOptions options)
Adds link to parent promotion only if depended on me list is already loaded from DB for this promotionvoid
addDependency(BuildPromotionEx dependOn, DependencyOptions options)
Adds a build dependencySQueuedBuild
addToQueue(String requestor)
Creates a new build on the base of this promotion (and all necessary builds for the promotions this one depends on) and adds it to the Queue.SQueuedBuild
addToQueue(SBuildAgent buildAgent, String requestor)
Creates a new build on the base of this promotion (and all necessary builds for the promotions this one depends on) and adds it to the Queue.boolean
allDependenciesFinished()
void
artifactsChanged(boolean scheduleUpdate)
Should be called when artifacts are changed on disk.void
associatedBuildFinished()
void
buildEvictedFromCache()
Called when finished build associated with this promotion is removed from the builds cache.void
buildFinished()
Must be called when build history entry created for this promotion.void
cancelCheckingForChanges()
int
compareTo(BuildPromotion o)
BuildPromotionEx
copy(boolean copyRevisions)
Creates copy of this build promotion (a copy will have different id).Predicate<BuildPromotion>
createBuildPromotionAccessChecker()
int
decreaseExpirationCounter(int decreaseAmount)
void
deleteBuildProblem(String identity)
Deletes build problem Deleting build problem may change build status to SUCCESSvoid
detachChanges()
Marks build as build with detached changes, i.e.void
ensureBuildLogFlushed()
Makes sure that messages in the build log buffer are flushed on disk.BuildPromotionEx[]
findTops()
Return a collection of top-level build promotions for sequence builds this build promotion participates in.void
freezeSettings()
Freeze buildType settings for this promotion.void
freezeSettings(File settings, String settingsOrigin)
Freeze settings for this promotion using the given settings file.void
freezeSettings(BuildTypeEx buildType, String settingsOrigin)
Freeze buildType settings for this promotion using the given buildType.void
freezeSettings(BuildTypeSettingsEx settings, String settingsOrigin)
Freeze settings for this promotion using the given buildSettings.void
freezeSettingsWithForcedPostprocessing(BuildTypeSettingsEx settings, String origin)
Freeze settings for this promotion using the given buildSettings and mark that postprocessing is still required for this promotion.String
generateAgentAccessCode()
Generates agent access code for communication with TeamCity during buildMap<VcsRootInstance,BuildRevisionEx>
getAllRevisionsMap()
Returns all vcs root revisions assciated with build, not only regular vcs roots attached to the build configurations.Map<VcsRootInstance,BuildRevisionEx>
getAllRevisionsMap(Boolean includeSettingsRoot)
List<SArtifactDependency>
getArtifactDependencies()
Returns collection of artifact dependencies to be sent to an agent.BuildArtifacts
getArtifacts(BuildArtifactsViewMode mode)
Returns artifacts of this build promotion.File
getArtifactsDirectory()
BuildPromotionEx.ArtifactsStateInfo
getArtifactStateInfo()
SBuild
getAssociatedBuild()
Returns running or finished build associated with this promotion or null if there is no such build.Long
getAssociatedBuildId()
Returns id of the build associated with this promotion, or null if there is no such build.Object
getAttribute(String attributeName)
com.google.common.collect.ImmutableMap<String,Object>
getAttributes()
AuditLog
getAuditLog()
List<AuditLogAction>
getAuditLogActions(AuditLogFilter filter)
String
getAutogeneratedBranchName()
Returns auto-generated branch name for the case if build promotion VCS roots differ from VCS roots in build configuration.Branch
getBranch()
static String
getBranchVcsName(RepositoryState state, BranchSpec spec, String branchName)
List<BuildProblem>
getBuildChainProblems(boolean omitInduced)
If omitInduced is false, simply traverses all of the dependencies of this promotion and returns collection of all build problems (including this promotion own problems).Comment
getBuildComment()
Returns build comment assigned for this promotionBuildLogEx
getBuildLog()
BuildLogEx
getBuildLogIfInitialized()
Map<String,String>
getBuildParameters()
Returns combined map of default and custom defined build parameters.List<BuildProblem>
getBuildProblems()
Returns all build problems for this promotion with extended information about muting.List<BuildPromotion>
getBuildPromotionsWithArtifactDependenciesOnMe(List<BuildPromotion> buildPromotions)
Checks artifact dependencies of the build promotions provided as an argument and returns those which have a direct artifact dependency (by build id) on this build promotion.BuildSettings
getBuildSettings()
Returns settings specified toBuildPromotionEx.freezeSettings(BuildTypeEx, String)
method or settings of this buildType this promotion belongs to ifBuildPromotionEx.freezeSettings(BuildTypeEx, String)
wasn't calledBuildTypeEx
getBuildType()
Returns build configuration to which this promotion corresponds.String
getBuildTypeExternalId()
Returns the external id of the associated build type.String
getBuildTypeId()
Returns internal id of build configuration to which this promotion corresponds, same asBuildPromotion.getBuildType()
.getBuildTypeId()Long
getChainModificationId()
Returns max modification id (max result of #getLastModificationId()) among this promotion all all its dependencies transitively.String
getCheckoutDirectory()
String
getCollectChangesError()
String
getCreatorNodeId()
List<SArtifactDependency>
getCustomArtifactDependencies()
Map<String,String>
getCustomParameters()
Returns map of user-defined build and configuration parameters associated with this build promotion.Collection<Parameter>
getCustomParametersCollection()
Returns a collection of user-defined build and configuration parameters associated with this build promotion.String
getDefaultCheckoutDirectory(BuildTypeDescriptor.CheckoutType checkoutType)
Returns name of the checkout directory that should be used for the build if explicit checkout directory is not specified.Map<String,String>
getDefaultParameters()
Returns map of default build and configuration parameters associated with this build promotion.Collection<BuildDependencyEx>
getDependedOnMe()
Returns snapshot dependencies of parent build promotions depending on this promotion.Collection<Long>
getDependedOnMeIds()
Collection<BuildDependencyEx>
getDependencies()
Returns the direct snapshot dependencies of this build promotion filtered according to current user permissions.Collection<Long>
getDependenciesIds()
List<BuildPromotionEx>
getDependentCompositePromotions()
List<SVcsModification>
getDetachedChanges()
Collection<BuildPromotionInfo>
getDirectDependencies()
Returns direct snapshot dependencies of this build promotionList<BuildPromotionEx>
getEquivalentPromotions(List<BuildPromotionEx> promotions)
Returns build promotions from the build queue equivalent to this build promotion (same settings, changes and revisions)int
getExecutionTimeoutMin()
Returns build execution timeout in minutes, 0 indicates that there is no limitList<BuildProblemData>
getFailureReasons()
Returns non-muted build problems for this promotion Note that this mathod may cause DB call, if you only require the fact if there are any failure reasons use hasFailureReasons which is guaranteed fastList<SArtifactDependency>
getFinalArtifactDependencies()
Boolean
getFreezeSettings()
Returns true if we should freeze settings if it is enabled in buildType, false if settings shouldn't be frozen, null - use buildType's defaultsFile
getFrozenSettingsFile()
long
getId()
Returns id of this promotion, promotion id is unique among all other build promotions and is not changed during promotion life cycle.String
getInternalBranchName()
Long
getLastModificationId()
Returns id of the last change associated with this promotion or null if changes collecting is not performed yet.int
getNumberOfDependedOnMe()
Returns total number of parent snapshot dependencies (without permissions filtering).int
getNumberOfDependencies()
Returns total number of snapshot dependencies (without permissions filtering).Map<VcsRootInstance,VcsRootInstance>
getOverridenVcsRoots()
Get overriden vcs root map in this promotion.List<SVcsModification>
getOwnChanges(ChangesCalculationOptions options)
Returns changes in this promotion computed according to specified options, doesn't include changes from dependencies.List<SVcsModification>
getOwnChanges(ChangesCalculationOptions options, boolean checkOwnBranchExistence)
SUser
getOwner()
For personal builds returns owner of the build.TeamCityNode
getOwnerNode()
String
getOwnerNodeUrl()
Returns url of the node which processes this build messages.Parameter
getParameter(String paramName)
Map<String,String>
getParameters()
Returns combined map of default and custom parameters.Collection<Parameter>
getParametersCollection()
Returns build and configuration parameters in single collection.String
getParameterValue(String paramName)
BuildTypeEx
getParentBuildType()
Returns base build configuration to which this promotion corresponds, i.e.String
getParentBuildTypeId()
For non personal builds returns same asBuildPromotion.getBuildTypeId()
.Long
getPersonalChangeId()
Returns personal change id associated with this build promotion.List<String>
getPrivateTags(SUser user)
Returns list of private tag labels in lexicographical order for particular user for this build promotionString
getProjectExternalId()
Returns the project external idString
getProjectId()
Returns the project internal id.List<String>
getProjectPathIds()
Returns project path of a project where this build promotion belongs.QueuedBuildEx
getQueuedBuild()
Returns queued build associated with this promotion or null if there is no such build in the queueDate
getQueuedDate()
Returns the date when the build was added to queue.List<BuildRevision>
getRevisions()
Returns VCS root revisions associated with this promotion.Map<VcsRootInstance,BuildRevision>
getRevisionsMap()
SBuild
getSequenceBuild()
Date
getServerStartDate()
Returns the timestamp when the build was removed from the queue.VcsRootInstance
getSettingsVcsRootInstance()
List<BuildPromotionEx>
getStartedEquivalentPromotions(int maxNumToProcess)
Returns build promotions with associated builds and equivalent to this build promotion (same settings, changes and revisions)Collection<TagData>
getTagDatas()
Returns list of all tags for this build promotion, no special order is preservedList<String>
getTags()
Returns list of public tag labels in lexicographical order for the build promotionCollection<BuildProblem>
getUnsortedBuildProblems()
Same asBuildPromotionEx.getBuildProblems()
but returns problems in any order and can work faster because of that.List<VcsRootInstanceEntry>
getVcsRootEntries()
Returns VCS root entries associated with this promotion.List<VcsRootInstanceEntry>
getVcsRootEntries(boolean includeSettingsRoot)
Returns entries for VCS roots associated with this promotion.boolean
hasBuildProblemsOfType(String type)
boolean
hasComputedArtifactsState()
boolean
hasCustomPatch()
boolean
hasDependencyOn(long id)
boolean
hasFailureReasons()
boolean
hasFrozenSettings()
boolean
hasFrozenSettingsFromVcs()
boolean
hasLoadedTags()
Returns true if promotion loaded information about tags from dbboolean
hasStartedParent()
Returns true if there exists started build which has reference to this promotionboolean
hasUnpublishedPromotionPersistingEvent()
void
initBuildProblems()
Init build problems from databaseboolean
isAssociatedBuildFinished()
boolean
isCanceled()
Return true if associated build is canceledboolean
isChangeCollectingNeeded()
Return true if change collection is required for this build promotion (otherwise, changes are collected already).boolean
isChangeCollectingNeeded(boolean checkDependencies)
boolean
isChangesCollectingInProgress()
boolean
isChangesDetached()
boolean
isCompositeBuild()
boolean
isDeleted()
boolean
isEquivalentTo(BuildPromotion promotion)
Returns true if this build promotion is equivalent to specified promotion, i.e.EquivalenceCheckResult
isEquivalentTo(BuildPromotion promoToCompare, Boolean compareBranches)
boolean
isFailedToCollectChanges()
boolean
isFinished()
boolean
isForcedPostprocessingOfFrozenSettings()
boolean
isIncomplete()
Returns whether the build promotion is incomplete (canceled).boolean
isLaterThan(BuildPromotion promotion)
Returns true if this promotion contains more recent changes comparing to the specified promotion.boolean
isOutOfChangesSequence()
Returns true if there is a build started before this build promotion associated build which contains more recent changes.boolean
isPartOfBuildChain()
boolean
isPersisted()
boolean
isPersonal()
Return true if this build promotion relates to personal buildboolean
isUsed()
Returns true if there is a reference to this build promotion from queued, running or history build.void
lockDependenciesOptimizing()
void
markAsIncompleteIfHasFailedToStartProblems()
Marks build promotion as incomplete if it has failed to start build problemsvoid
markDeleted()
Mark this promotion as deleted in the database.void
markIncomplete()
Mark build promotion as incomplete (canceled)protected int
maxChangesToStoreInCache(boolean returnChangesIfNoPreviousBuild)
void
muteBuildProblems(boolean muteIfTrue, SUser user, String comment)
Makes all existing build problems enabled or disabledboolean
needToFreezeSettings()
void
persist()
Persists state of the build promotionvoid
persist(BuildPromotionEx.PromotionPersistMode persistMode)
void
persistDependencies()
void
persistVcsRootEntries()
Persists information about VCS roots used by this build promotion to the database.void
removeDependedOnMe(BuildPromotion parentPromo)
Removes link to parent promotionvoid
removeDependency(BuildPromotionEx promo)
Removes dependency on specified promotionvoid
replaceDependency(BuildPromotionEx origPromo, BuildPromotionEx newPromo, DependencyOptions newOptions)
Replaces dependency on one promotion with dependency to another promotionvoid
resetAgentsCompatibilityCache()
Resets promotion compatibility cache for all agents and agent typesvoid
resetArtifactsState(boolean scheduleUpdate)
Resets current artifacts state in the build promotionvoid
resetBuildLog()
void
resetBuildRevisions()
void
resetBuildSettings()
Resets cached build settings associated with promotionvoid
resetDependenciesHardRefs()
Each newly created build promotion keeps a reference to its direct dependencies (BuildPromotion instances).void
resetDependentOnMeCache()
reset only dependent on this cache of the promotion.void
resetDirectDependenciesCache()
reset only direct dependencies cache of the promotion.void
resetLogActionsCache()
Reset cached audit logvoid
resetTagsCache()
Reset cached tagsboolean
scheduleCheckingForChangesIfNeeded()
void
setArtifactsDirectory(File artifactsDir)
Sets new artifacts directory to this build promotion.void
setAssociatedBuild(SBuild build)
Associates new build to this build promotionvoid
setAttribute(String name, Object value)
Sets some attribute to the build promotionvoid
setBuildComment(User user, String comment)
Assigns the build comment for this promotionvoid
setBuildRevisions(Collection<BuildRevisionEx> revisions, long maxModificationId, long chainModificationId)
Same asBuildPromotionEx.setBuildRevisions(Collection, long, long, boolean)
with validateBranch parameter set to true.void
setBuildRevisions(Collection<BuildRevisionEx> revisions, long maxModificationId, long chainModificationId, boolean validateBranch)
Sets revisions and modificationId into this build promotion.void
setCustomArtifactDependencies(List<SArtifactDependency> dependencies)
Sets custom artifact dependencies, those which override default (specified in build configuration).void
setCustomParameters(Collection<Parameter> parameters)
Same as#setCustomParameters(List)
but acceptingParameter
instancesvoid
setCustomParameters(Map<String,String> customParameters)
Sets custom parameters in build promotion.void
setDesiredBranchName(String branchName)
void
setExpirationCounter(int counter)
void
setFailedToCollectChanges(Throwable t)
void
setFinalArtifactDependencies(List<SArtifactDependency> dependencies)
Sets the final artifact dependencies, i.e.void
setFreezeSettings(Boolean freezeSettings)
Indicates if we should freeze settings in buildvoid
setOverridenVcsRoots(Map<VcsRootInstance,VcsRootInstance> overridenVcsRoots)
Override default vcs roots for this promotion.void
setOwnerNodeUrl(String url)
Sets url of the node which processes this build messages.void
setPrivateTags(List<String> labels, SUser user)
Set private tags for particular user Attention! Replace all private tags related to the particular user with new setvoid
setQueuedAt(Date queuedAt)
void
setRemoveFromQueueDate(Date removeFromQueueDate)
void
setTagDatas(Collection<TagData> tags)
Changes tag set for this build promotion.void
setTags(List<String> labels)
Set public tags.void
traverseDependedOnMe(DependencyConsumer<BuildPromotionEx> consumer)
Traverses all build promotions depending on this one transitively.void
traverseDependencies(DependencyConsumer<BuildPromotionEx> consumer)
Traverses all build promotion dependencies (breadth first).void
traverseSelfAndDependedOnMe(DependencyConsumer<BuildPromotionEx> consumer)
void
traverseSelfAndDependencies(DependencyConsumer<BuildPromotionEx> consumer)
void
unlockDependenciesOptimizing()
void
updateDependenciesCache(Supplier<Map<Long,Integer>> dependenciesSupplier)
Updates dependencies cache of the promotion and resets "dependent on me" cache of the supplied dependencies.void
updateFromDB(BuildPromotionEx.UpdateReason reason)
Updates promotion data from databasevoid
updateSelfAndDependenciesFromDB()
Updates the build promotion and all its dependencies from the databasevoid
updateStateFromBuildData(AbstractBuildData runningBuildData)
Quickly updates some information in build promotion from DB information.void
waitForChangesCollectingToFinish(long timeoutMillis)
If checking for changes is in progress, blocks for the specified timeout-
Methods inherited from class jetbrains.buildServer.serverSide.impl.AbstractBuildPromotion
clearPrevPromotionCache, containsChange, createOrderedBuild, fillDetectedChanges, fillDetectedChanges, findSelfOrDependencyWithProblem, getAgentCompatibility, getAgentTypeCompatibilityMap, getAllDependencies, getAnchorBuildPromotion, getBuildFeaturesOfType, getBuildFeaturesRequirements, getBuildPromotionManager, getCanRunOnAgents, getCanRunOnAgentTypes, getChanges, getChanges, getChanges, getCommitters, getCommitters, getCompatibilityMap, getCompatibleAgents, getCompatibleAgentTypes, getContainingChanges, getContext, getDependenciesSupplier, getDependencyGraph, getDetachedFromAgentDate, getDetectedChanges, getDetectedChanges, getDetectedChanges, getDetectedChanges, getDetectedChangesProviders, getDummyBuild, getLimitedChanges, getMaximumNumberOfBuildsPerBranch, getParametersProvider, getPersonalChanges, getPersonalChanges, getPreviousBuildPromotion, getPreviousBuilds, getPreviousOrderedBuild, getPromotionCustomization, getProvidedUpperLimitRevisions, getRealOrDummyBuild, getRequirements, getRunnersRequirements, getSettingsDigest, getTopDependencyGraph, getUpperLimitRevisions, getVersionedSettingsRevision, hasArtifactDependencyOn, hasBuildFeatureOfType, hasComputedChanges, isAgentLessBuild, isDetachedFromAgent, isMaximumNumberOfBuildsPerBranchLimited, isVirtual, occupiesLicenseSlot, resetAllCompatibilityCaches, resetChangesCache, resetIncompatibleAgentsCache, resetIncompatibleAgentTypesCache, resetRequirementsCache, sameBranch, setProvidedUpperLimitRevisions, setVersionedSettingsRevision, toExternalName, updateAgentsCompatibilityCache
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.InternalParameters
getBooleanInternalParameter, getBooleanInternalParameterOrTrue, getInternalParameterValue
-
-
-
-
Constructor Detail
-
DummyBuildPromotion
public DummyBuildPromotion(@NotNull String branchName, @NotNull BuildTypeEx buildType, @NotNull BuildPromotionContext context)
-
-
Method Detail
-
getId
public long getId()
Description copied from interface:BuildPromotion
Returns id of this promotion, promotion id is unique among all other build promotions and is not changed during promotion life cycle.- Returns:
- id of this build promotion
-
getOwner
@Nullable public SUser getOwner()
Description copied from interface:BuildPromotion
For personal builds returns owner of the build. For non personal builds returns null.- Returns:
- see above
-
persist
public void persist()
Description copied from interface:BuildPromotionEx
Persists state of the build promotion
-
addToQueue
public SQueuedBuild addToQueue(@NotNull String requestor)
Description copied from interface:BuildPromotion
Creates a new build on the base of this promotion (and all necessary builds for the promotions this one depends on) and adds it to the Queue.- Parameters:
requestor
- contains details about who triggered build, see alsoTriggeredByBuilder
- Returns:
- the queued build or null if adding to queue is impossible for some reason
-
addToQueue
public SQueuedBuild addToQueue(@NotNull SBuildAgent buildAgent, @NotNull String requestor)
Description copied from interface:BuildPromotion
Creates a new build on the base of this promotion (and all necessary builds for the promotions this one depends on) and adds it to the Queue.- Parameters:
buildAgent
- build agent where the build is to runrequestor
- contains details about who triggered build, see alsoTriggeredByBuilder
- Returns:
- the queued build or null if adding to queue is impossible for some reason
-
isUsed
public boolean isUsed()
Description copied from interface:BuildPromotion
Returns true if there is a reference to this build promotion from queued, running or history build.- Returns:
- see above
-
isChangesDetached
public boolean isChangesDetached()
- Returns:
- true if changes are detached from this promotion, i.e. next build will have all of the changes included in this promotion.
-
getAssociatedBuild
public SBuild getAssociatedBuild()
Description copied from interface:BuildPromotion
Returns running or finished build associated with this promotion or null if there is no such build.- Returns:
- see above
-
getAssociatedBuildId
public Long getAssociatedBuildId()
Description copied from interface:BuildPromotion
Returns id of the build associated with this promotion, or null if there is no such build.- Returns:
- see above
-
getBuildType
@NotNull public BuildTypeEx getBuildType()
Description copied from interface:BuildPromotion
Returns build configuration to which this promotion corresponds. If promotion is for personal build, returns RemoteBuildType.If the correspondent build configuration is deleted - returns null.
- Returns:
- the correspondent build configuration or null if that was deleted.
-
getProjectId
public String getProjectId()
Description copied from interface:BuildPromotion
Returns the project internal id.- Returns:
- project internal id
-
getProjectExternalId
public String getProjectExternalId()
Description copied from interface:BuildPromotion
Returns the project external id- Returns:
- project external id
-
getParentBuildType
public BuildTypeEx getParentBuildType()
Description copied from interface:BuildPromotion
Returns base build configuration to which this promotion corresponds, i.e. for personal builds returns parent build configuration, not the personal build type- Returns:
- see above
-
getParentBuildTypeId
@NotNull public String getParentBuildTypeId()
Description copied from interface:BuildPromotion
For non personal builds returns same asBuildPromotion.getBuildTypeId()
. For personal builds returns id of parent build configuration: getParentBuildType().getBuildTypeId()- Returns:
- see above
-
getBuildTypeExternalId
@NotNull public String getBuildTypeExternalId()
Description copied from interface:BuildPromotion
Returns the external id of the associated build type. In case of the personal build - it is the identifier of the real build configuration (as for a regular build), without suffixes.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.- Returns:
- the external identifier of the associated build type.
-
getBuildTypeId
@NotNull public String getBuildTypeId()
Description copied from interface:BuildPromotion
Returns internal id of build configuration to which this promotion corresponds, same asBuildPromotion.getBuildType()
.getBuildTypeId()- Returns:
- id of build configuration
-
isPartOfBuildChain
public boolean isPartOfBuildChain()
- Returns:
- true if this build promotion is a part of build dependencies graph, i.e. there are promotions having dependencies on this promotion or this promotion has dependencies on other promotions.
-
isCanceled
public boolean isCanceled()
Description copied from interface:BuildPromotion
Return true if associated build is canceled- Returns:
- see above
-
isFailedToCollectChanges
public boolean isFailedToCollectChanges()
- Returns:
- true if process of changes collecting failed for this build
-
getCustomParameters
@NotNull public Map<String,String> getCustomParameters()
Description copied from interface:BuildPromotion
Returns map of user-defined build and configuration parameters associated with this build promotion.- Returns:
- see above
-
getDefaultParameters
@NotNull public Map<String,String> getDefaultParameters()
Description copied from interface:BuildPromotion
Returns map of default build and configuration parameters associated with this build promotion. Default parameters are taken from the build configuration when build promotion is created.- Returns:
- see above
-
getParametersCollection
@NotNull public Collection<Parameter> getParametersCollection()
Description copied from interface:ReadOnlyUserParameters
Returns build and configuration parameters in single collection.- Returns:
- see above
-
getVcsRootEntries
@NotNull public List<VcsRootInstanceEntry> getVcsRootEntries()
Description copied from interface:BuildPromotion
Returns VCS root entries associated with this promotion.- Returns:
- VCS root entries
-
getVcsRootEntries
@NotNull public List<VcsRootInstanceEntry> getVcsRootEntries(boolean includeSettingsRoot)
Description copied from interface:BuildPromotionEx
Returns entries for VCS roots associated with this promotion. If promotion has an implicit settings root (not attached to buildType) andincludeSettingsRoot
istrue
, then an entry for this settings root is included in the result.- Parameters:
includeSettingsRoot
- whether settings root should be included in result- Returns:
- see above
- See Also:
BuildTypeEx.getVcsRootInstanceEntries(boolean)
-
getBuildLog
@NotNull public BuildLogEx getBuildLog()
- Returns:
- Log for operations which could occur before build start, like changes collecting or logging detailed triggering information.
-
getBuildLogIfInitialized
@Nullable public BuildLogEx getBuildLogIfInitialized()
-
hasLoadedTags
public boolean hasLoadedTags()
Description copied from interface:BuildPromotionEx
Returns true if promotion loaded information about tags from db- Returns:
- see above
-
isEquivalentTo
public EquivalenceCheckResult isEquivalentTo(@NotNull BuildPromotion promoToCompare, @Nullable Boolean compareBranches)
- Parameters:
promoToCompare
- build promotion to compare withcompareBranches
- whether to compare branches strictly or not- Returns:
- object with reason why builds are not equivalent
-
setArtifactsDirectory
public void setArtifactsDirectory(@NotNull File artifactsDir)
Description copied from interface:BuildPromotionEx
Sets new artifacts directory to this build promotion. This method also persists new artifacts directory in database, not additional call toBuildPromotionEx.persist()
is required.- Parameters:
artifactsDir
- new artifacts directory
-
isFinished
public boolean isFinished()
- Returns:
- true if build associated with this promotion is finished. Method is not optimized for performance, and can perform one SQL query to determine whether build is finished or not.
-
getProjectPathIds
@NotNull public List<String> getProjectPathIds()
Description copied from interface:BuildPromotionEx
Returns project path of a project where this build promotion belongs. Project path is fixed on the moment when some build is associated with this promotion. List contains internal ids of the projects. The first element in the list is root project id, while the last element contains id of the build promotion project.
The list can be empty.
-
getOwnerNodeUrl
@Nullable public String getOwnerNodeUrl()
Description copied from interface:BuildPromotionEx
Returns url of the node which processes this build messages. Returns null if this build promotion is not assigned to any node. ReturnsBuildPromotionEx.MAIN_NODE_MARKER
if build promotion was specifically assigned to main node.
-
getOwnerNode
@Nullable public TeamCityNode getOwnerNode()
- Returns:
- TeamCityNode of build messages processor type if this promotion was assigned to such a node using setOwnerNodeUrl call; returns null in all other cases.
-
setOwnerNodeUrl
public void setOwnerNodeUrl(@Nullable String url)
Description copied from interface:BuildPromotionEx
Sets url of the node which processes this build messages.
-
getOverridenVcsRoots
@NotNull public Map<VcsRootInstance,VcsRootInstance> getOverridenVcsRoots()
Description copied from interface:BuildPromotionEx
Get overriden vcs root map in this promotion.- Returns:
- map from original vcs root id to substitution root id
-
addDependency
public void addDependency(@NotNull BuildPromotionEx dependOn, @NotNull DependencyOptions options) throws IllegalArgumentException
Description copied from interface:BuildPromotionEx
Adds a build dependency- Parameters:
dependOn
- the Build Promotion we're depending upon- Throws:
IllegalArgumentException
- when dependency to the same build configuration is added
-
addDependedOnMe
public void addDependedOnMe(@NotNull BuildPromotionEx promotion, @NotNull DependencyOptions options)
Description copied from interface:BuildPromotionEx
Adds link to parent promotion
-
addDependedOnMeIfCached
public void addDependedOnMeIfCached(@NotNull BuildPromotionEx promotion, @NotNull DependencyOptions options)
Description copied from interface:BuildPromotionEx
Adds link to parent promotion only if depended on me list is already loaded from DB for this promotion
-
removeDependedOnMe
public void removeDependedOnMe(@NotNull BuildPromotion parentPromo)
Description copied from interface:BuildPromotionEx
Removes link to parent promotion
-
getQueuedBuild
public QueuedBuildEx getQueuedBuild()
Description copied from interface:BuildPromotion
Returns queued build associated with this promotion or null if there is no such build in the queue- Returns:
- see above
-
getBuildComment
@Nullable public Comment getBuildComment()
Description copied from interface:BuildPromotion
Returns build comment assigned for this promotion- Returns:
- build comment
-
setBuildComment
public void setBuildComment(@NotNull User user, @Nullable String comment)
Description copied from interface:BuildPromotion
Assigns the build comment for this promotion- Parameters:
user
- user who sets the commentcomment
- text of the comment
-
isLaterThan
public boolean isLaterThan(@NotNull BuildPromotion promotion)
Description copied from interface:BuildPromotion
Returns true if this promotion contains more recent changes comparing to the specified promotion.- Parameters:
promotion
- promotion- Returns:
- see above
-
getCollectChangesError
@Nullable public String getCollectChangesError()
-
setFailedToCollectChanges
public void setFailedToCollectChanges(@Nullable Throwable t)
-
setFinalArtifactDependencies
public void setFinalArtifactDependencies(@NotNull List<SArtifactDependency> dependencies)
Description copied from interface:BuildPromotionEx
Sets the final artifact dependencies, i.e. those which must be sent to an agent.- Parameters:
dependencies
- the artifact dependencies
-
setCustomArtifactDependencies
public void setCustomArtifactDependencies(@NotNull List<SArtifactDependency> dependencies) throws IllegalArgumentException
Description copied from interface:BuildPromotionEx
Sets custom artifact dependencies, those which override default (specified in build configuration). Custom artifact dependencies will override default completely. If list is empty, it will reset custom artifact dependencies.- Parameters:
dependencies
- custom dependencies- Throws:
IllegalArgumentException
-
getDependedOnMe
@NotNull public Collection<BuildDependencyEx> getDependedOnMe()
Description copied from interface:BuildPromotion
Returns snapshot dependencies of parent build promotions depending on this promotion. Parent build promotions are filtered according to current user permissions.- Returns:
- see above
-
getNumberOfDependencies
public int getNumberOfDependencies()
Description copied from interface:BuildPromotion
Returns total number of snapshot dependencies (without permissions filtering).- Returns:
- see above
-
getNumberOfDependedOnMe
public int getNumberOfDependedOnMe()
Description copied from interface:BuildPromotion
Returns total number of parent snapshot dependencies (without permissions filtering).- Returns:
- see above
-
getAttributes
@NotNull public com.google.common.collect.ImmutableMap<String,Object> getAttributes()
- Returns:
- map of arbitrary options associated with this promotion.
-
detachChanges
public void detachChanges()
Description copied from interface:BuildPromotionEx
Marks build as build with detached changes, i.e. changes of this build will be shown in the next build too.
-
setAttribute
public void setAttribute(@NotNull String name, @Nullable Object value)
Description copied from interface:BuildPromotionEx
Sets some attribute to the build promotion- Parameters:
name
- attribute namevalue
- attribute value
-
isChangeCollectingNeeded
public boolean isChangeCollectingNeeded()
Description copied from interface:BuildPromotionEx
Return true if change collection is required for this build promotion (otherwise, changes are collected already).- Returns:
- see above
-
isChangeCollectingNeeded
public boolean isChangeCollectingNeeded(boolean checkDependencies)
- Returns:
- same as
BuildPromotionEx.isChangeCollectingNeeded()
but can also check dependencies
-
markIncomplete
public void markIncomplete()
Description copied from interface:BuildPromotionEx
Mark build promotion as incomplete (canceled)
-
markAsIncompleteIfHasFailedToStartProblems
public void markAsIncompleteIfHasFailedToStartProblems()
Description copied from interface:BuildPromotionEx
Marks build promotion as incomplete if it has failed to start build problems
-
isIncomplete
public boolean isIncomplete()
Description copied from interface:BuildPromotionEx
Returns whether the build promotion is incomplete (canceled). Method is efficient enough, can be called often.- Returns:
- true iff is incomplete
-
markDeleted
public void markDeleted() throws IllegalStateException
Description copied from interface:BuildPromotionEx
Mark this promotion as deleted in the database. This makes this promotion 'invisible' for most queries, and it becomes a subject for cleanup. If there is an associated finishedBuild with this promotion, this finished build is considered deleted as well, i.e. various 'buildDeleted' events are sent.- Throws:
IllegalStateException
- if this promotion is associated with a build
-
isDeleted
public boolean isDeleted()
- Returns:
- true if promotion is marked as deleted
-
isPersisted
public boolean isPersisted()
- Returns:
- true if this promotion was ever persisted into the database, so the method will return true even if markDeleted() was called for this promotion and promotion was previously stored in database
-
hasStartedParent
public boolean hasStartedParent()
Description copied from interface:BuildPromotionEx
Returns true if there exists started build which has reference to this promotion- Returns:
- see above
-
isChangesCollectingInProgress
public boolean isChangesCollectingInProgress()
-
waitForChangesCollectingToFinish
public void waitForChangesCollectingToFinish(long timeoutMillis) throws InterruptedException, ExecutionException, TimeoutException, CancellationException
Description copied from interface:BuildPromotionEx
If checking for changes is in progress, blocks for the specified timeout- Parameters:
timeoutMillis
- timeout in milliseconds- Throws:
TimeoutException
- if operation did not finish within specified timeoutInterruptedException
ExecutionException
CancellationException
-
lockDependenciesOptimizing
public void lockDependenciesOptimizing()
-
unlockDependenciesOptimizing
public void unlockDependenciesOptimizing()
-
addBuildProblem
public void addBuildProblem(@NotNull BuildProblemData buildProblem)
Description copied from interface:BuildPromotionEx
Adds build problem, currently it actually causes build failure
-
getFailureReasons
@NotNull public List<BuildProblemData> getFailureReasons()
Description copied from interface:BuildPromotionEx
Returns non-muted build problems for this promotion Note that this mathod may cause DB call, if you only require the fact if there are any failure reasons use hasFailureReasons which is guaranteed fast
-
getBuildProblems
@NotNull public List<BuildProblem> getBuildProblems()
Description copied from interface:BuildPromotionEx
Returns all build problems for this promotion with extended information about muting. The problems are sorted in order of their appearance.- Returns:
- see above
-
getUnsortedBuildProblems
@NotNull public Collection<BuildProblem> getUnsortedBuildProblems()
Description copied from interface:BuildPromotionEx
Same asBuildPromotionEx.getBuildProblems()
but returns problems in any order and can work faster because of that.- Returns:
- build problems in no particular order
-
getBuildChainProblems
@NotNull public List<BuildProblem> getBuildChainProblems(boolean omitInduced)
Description copied from interface:BuildPromotionEx
If omitInduced is false, simply traverses all of the dependencies of this promotion and returns collection of all build problems (including this promotion own problems). If omitInduced is true, returns only those build problems which caused failure of this build promotion (root causes). Returned list will not have build problems of snapshot dependency type (seeErrorData.isSnapshotDependencyError(String)
) as such problems are induced and never represent the root cause.- Parameters:
omitInduced
- see above- Returns:
- list of own problems as well as problems from snapshot dependencies transitively
-
hasBuildProblemsOfType
public boolean hasBuildProblemsOfType(@NotNull String type)
- Returns:
- true if there are build problems with specified type
-
hasFailureReasons
public boolean hasFailureReasons()
-
muteBuildProblems
public void muteBuildProblems(boolean muteIfTrue, @Nullable SUser user, @Nullable String comment)
Description copied from interface:BuildPromotionEx
Makes all existing build problems enabled or disabled- Parameters:
muteIfTrue
- pass true to make build successful, false to make existing problems visible again
-
deleteBuildProblem
public void deleteBuildProblem(@NotNull String identity)
Description copied from interface:BuildPromotionEx
Deletes build problem Deleting build problem may change build status to SUCCESS- Parameters:
identity
- identiry of build problem to be removed
-
updateStateFromBuildData
public void updateStateFromBuildData(@NotNull AbstractBuildData runningBuildData)
Description copied from interface:BuildPromotionEx
Quickly updates some information in build promotion from DB information. Doesn't store anything back to DB
-
updateFromDB
public void updateFromDB(@NotNull BuildPromotionEx.UpdateReason reason)
Description copied from interface:BuildPromotionEx
Updates promotion data from database
-
updateSelfAndDependenciesFromDB
public void updateSelfAndDependenciesFromDB()
Description copied from interface:BuildPromotionEx
Updates the build promotion and all its dependencies from the database
-
initBuildProblems
public void initBuildProblems()
Description copied from interface:BuildPromotionEx
Init build problems from database
-
getRevisions
@NotNull public List<BuildRevision> getRevisions()
Description copied from interface:BuildPromotion
Returns VCS root revisions associated with this promotion.- Returns:
- VCS root revisions
-
getAllRevisionsMap
@NotNull public Map<VcsRootInstance,BuildRevisionEx> getAllRevisionsMap()
Description copied from interface:BuildPromotionEx
Returns all vcs root revisions assciated with build, not only regular vcs roots attached to the build configurations.- Returns:
- see above
-
getSettingsVcsRootInstance
@Nullable public VcsRootInstance getSettingsVcsRootInstance()
- Specified by:
getSettingsVcsRootInstance
in interfaceBuildPromotionEx
- Overrides:
getSettingsVcsRootInstance
in classAbstractBuildPromotion
- Returns:
- settings VCS root associated with this promotion
-
decreaseExpirationCounter
public int decreaseExpirationCounter(int decreaseAmount)
-
setExpirationCounter
public void setExpirationCounter(int counter)
-
isAssociatedBuildFinished
public boolean isAssociatedBuildFinished()
-
getAllRevisionsMap
@NotNull public Map<VcsRootInstance,BuildRevisionEx> getAllRevisionsMap(@Nullable Boolean includeSettingsRoot)
-
getBranchVcsName
@NotNull public static String getBranchVcsName(@NotNull RepositoryState state, @NotNull BranchSpec spec, @NotNull String branchName)
-
getOwnChanges
@NotNull public List<SVcsModification> getOwnChanges(@NotNull ChangesCalculationOptions options)
Description copied from interface:BuildPromotionEx
Returns changes in this promotion computed according to specified options, doesn't include changes from dependencies.- Specified by:
getOwnChanges
in interfaceBuildPromotionEx
- Overrides:
getOwnChanges
in classAbstractBuildPromotion
- Parameters:
options
- changes calculation options- Returns:
- see above
-
getOwnChanges
@NotNull public List<SVcsModification> getOwnChanges(@NotNull ChangesCalculationOptions options, boolean checkOwnBranchExistence)
-
getDetachedChanges
@NotNull public List<SVcsModification> getDetachedChanges()
- Returns:
- all pending changes from detached VCS roots (changes which belong to VCS roots that are no longer attached to our build configuration)
-
getRevisionsMap
@NotNull public Map<VcsRootInstance,BuildRevision> getRevisionsMap()
-
getLastModificationId
public Long getLastModificationId()
Description copied from interface:BuildPromotion
Returns id of the last change associated with this promotion or null if changes collecting is not performed yet. Returns -1 if changes collecting is performed but there were no changes detected and there were no changes in the build configuration since its creation.- Returns:
- see above
-
isPersonal
public boolean isPersonal()
Description copied from interface:BuildPromotion
Return true if this build promotion relates to personal build- Returns:
- see above
-
getPersonalChangeId
public Long getPersonalChangeId()
Description copied from interface:BuildPromotionEx
Returns personal change id associated with this build promotion. If promotion is not personal (isPersonal == false), returns null.- Returns:
- see above
-
hasCustomPatch
public boolean hasCustomPatch()
- Returns:
- true if this build promotion has a custom patch associated with it which should be applied when build starts on an agent
-
getCustomParametersCollection
@NotNull public Collection<Parameter> getCustomParametersCollection()
Description copied from interface:BuildPromotionEx
Returns a collection of user-defined build and configuration parameters associated with this build promotion.- Returns:
- see above
-
findTops
public BuildPromotionEx[] findTops()
Description copied from interface:BuildPromotion
Return a collection of top-level build promotions for sequence builds this build promotion participates in. This build promotion may have several tops only if it has an associated running or finished build. If this build promotion is a top of the graph, returns an array with itself as the only element. This method always returns at least one element. The array of build promotions is sorted in a way that the most recent top of the graph is returned first.- Returns:
- see above
-
traverseDependedOnMe
public void traverseDependedOnMe(@NotNull DependencyConsumer<BuildPromotionEx> consumer)
Description copied from interface:BuildPromotionEx
Traverses all build promotions depending on this one transitively. If processor returns false, traversing stops.
-
traverseSelfAndDependedOnMe
public void traverseSelfAndDependedOnMe(@NotNull DependencyConsumer<BuildPromotionEx> consumer)
-
traverseDependencies
public void traverseDependencies(@NotNull DependencyConsumer<BuildPromotionEx> consumer)
Description copied from interface:BuildPromotionEx
Traverses all build promotion dependencies (breadth first). If processor returns false, traversing stops.
-
traverseSelfAndDependencies
public void traverseSelfAndDependencies(@NotNull DependencyConsumer<BuildPromotionEx> consumer)
-
setBuildRevisions
public void setBuildRevisions(@NotNull Collection<BuildRevisionEx> revisions, long maxModificationId, long chainModificationId)
Description copied from interface:BuildPromotionEx
Same asBuildPromotionEx.setBuildRevisions(Collection, long, long, boolean)
with validateBranch parameter set to true.
-
setBuildRevisions
public void setBuildRevisions(@NotNull Collection<BuildRevisionEx> revisions, long maxModificationId, long chainModificationId, boolean validateBranch)
Description copied from interface:BuildPromotionEx
Sets revisions and modificationId into this build promotion. If revisions list is empty, that means that changes were not collected for this build- Parameters:
revisions
- list of revisions for this build. If empty, changes were not collected for the build (possibly, because of some failure)maxModificationId
- modification id associated with this build, used to determine changes in this buildchainModificationId
- max mod id associated with this build configuration or its dependencies transitively, cannot be smaller than maxModificationIdvalidateBranch
- if set to true then branch validation logic is enabled; the validation will check whether the current build branch exists in any of the VCS roots in the provided revisions, and if it does not then a build problem will be added to the build- See Also:
BuildPromotion.getRevisions()
,BuildPromotion.getLastModificationId()
-
resetBuildRevisions
public void resetBuildRevisions()
-
getChainModificationId
@Nullable public Long getChainModificationId()
Description copied from interface:BuildPromotionEx
Returns max modification id (max result of #getLastModificationId()) among this promotion all all its dependencies transitively. Returns null if changes are not collected for this promotion yet or if this is an old promotion created before the chain modification id was introduced. Returns -1 if changes collecting was performed but there were no changes detected and there were no changes in this build configuration and its dependencies since their creation.- Returns:
- see above
-
getDependencies
@NotNull public Collection<BuildDependencyEx> getDependencies()
Description copied from interface:BuildPromotion
Returns the direct snapshot dependencies of this build promotion filtered according to current user permissions.- Returns:
- see above
-
getDependedOnMeIds
@NotNull public Collection<Long> getDependedOnMeIds()
-
getDependenciesIds
@NotNull public Collection<Long> getDependenciesIds()
-
getDirectDependencies
public Collection<BuildPromotionInfo> getDirectDependencies()
Description copied from interface:BuildPromotionInfo
Returns direct snapshot dependencies of this build promotion- Returns:
- see above
-
removeDependency
public void removeDependency(@NotNull BuildPromotionEx promo)
Description copied from interface:BuildPromotionEx
Removes dependency on specified promotion
-
replaceDependency
public void replaceDependency(@NotNull BuildPromotionEx origPromo, @NotNull BuildPromotionEx newPromo, @NotNull DependencyOptions newOptions)
Description copied from interface:BuildPromotionEx
Replaces dependency on one promotion with dependency to another promotion- Parameters:
origPromo
- original promotionnewPromo
- replacement
-
allDependenciesFinished
public boolean allDependenciesFinished()
- Returns:
- true if all direct dependencies of this build promotion are finished
-
getDependentCompositePromotions
@NotNull public List<BuildPromotionEx> getDependentCompositePromotions()
- Returns:
- list of all composite promotions depending on this build promotion either directly or transitively
-
updateDependenciesCache
public void updateDependenciesCache(@NotNull Supplier<Map<Long,Integer>> dependenciesSupplier)
Description copied from interface:BuildPromotionEx
Updates dependencies cache of the promotion and resets "dependent on me" cache of the supplied dependencies.
-
resetDirectDependenciesCache
public void resetDirectDependenciesCache()
Description copied from interface:BuildPromotionEx
reset only direct dependencies cache of the promotion.
-
resetDependentOnMeCache
public void resetDependentOnMeCache()
Description copied from interface:BuildPromotionEx
reset only dependent on this cache of the promotion.
-
ensureBuildLogFlushed
public void ensureBuildLogFlushed()
Description copied from interface:BuildPromotionEx
Makes sure that messages in the build log buffer are flushed on disk.
-
generateAgentAccessCode
public String generateAgentAccessCode()
Description copied from interface:BuildPromotionEx
Generates agent access code for communication with TeamCity during build
-
resetDependenciesHardRefs
public void resetDependenciesHardRefs()
Description copied from interface:BuildPromotionEx
Each newly created build promotion keeps a reference to its direct dependencies (BuildPromotion instances). These references are kept to avoid removal of them by GC. Once these dependencies are persisted to DB, these hard refs are no longer required. At this point this method should be called to free some memory.
-
getArtifactStateInfo
@NotNull public BuildPromotionEx.ArtifactsStateInfo getArtifactStateInfo()
- Returns:
- state of the artifacts directory of this build promotion.
-
hasComputedArtifactsState
public boolean hasComputedArtifactsState()
-
getArtifacts
@NotNull public BuildArtifacts getArtifacts(@NotNull BuildArtifactsViewMode mode)
Description copied from interface:BuildPromotionEx
Returns artifacts of this build promotion.- Parameters:
mode
- artifacts view mode- Returns:
- object describing artifacts of this build promotion.
-
artifactsChanged
public void artifactsChanged(boolean scheduleUpdate)
Description copied from interface:BuildPromotionEx
Should be called when artifacts are changed on disk.- Parameters:
scheduleUpdate
- if true, a task should be scheduled to update artifacts state
-
hasUnpublishedPromotionPersistingEvent
public boolean hasUnpublishedPromotionPersistingEvent()
- Returns:
- true if "promotion persisted" event for this build promotion is not yet stored in DB
-
resetArtifactsState
public void resetArtifactsState(boolean scheduleUpdate)
Description copied from interface:BuildPromotionEx
Resets current artifacts state in the build promotion- Parameters:
scheduleUpdate
- if true, a task should be scheduled to update artifacts state, otherwise state will be calculated whenBuildPromotionEx.getArtifactStateInfo()
is called
-
setQueuedAt
public void setQueuedAt(Date queuedAt)
-
setRemoveFromQueueDate
public void setRemoveFromQueueDate(@NotNull Date removeFromQueueDate)
-
resetBuildLog
public void resetBuildLog()
-
buildFinished
public void buildFinished()
Description copied from interface:BuildPromotionEx
Must be called when build history entry created for this promotion.
-
buildEvictedFromCache
public void buildEvictedFromCache()
Description copied from interface:BuildPromotionEx
Called when finished build associated with this promotion is removed from the builds cache. In this case promotion can clear some of its internal objects and free some memory.
-
associatedBuildFinished
public void associatedBuildFinished()
-
isForcedPostprocessingOfFrozenSettings
public boolean isForcedPostprocessingOfFrozenSettings()
- Returns:
- true if settings post processing is required even if settings are already marked as frozen
-
freezeSettings
public void freezeSettings()
Description copied from interface:BuildPromotionEx
Freeze buildType settings for this promotion. After call to this method a promotion will use frozen buildType settings instead of current ones.
-
freezeSettings
public void freezeSettings(@NotNull BuildTypeEx buildType, @NotNull String settingsOrigin)
Description copied from interface:BuildPromotionEx
Freeze buildType settings for this promotion using the given buildType. After call to this method a promotion will use frozen buildType settings instead of current ones.- Parameters:
buildType
- buildType those settings to usesettingsOrigin
- origin of settings, predefined values: 'vcs' for settings from vcs, 'current' for current buildType settings
-
freezeSettings
public void freezeSettings(@NotNull BuildTypeSettingsEx settings, @NotNull String settingsOrigin)
Description copied from interface:BuildPromotionEx
Freeze settings for this promotion using the given buildSettings.- Parameters:
settings
- the settings to store into the build promotionsettingsOrigin
- origin of settings, predefined values: 'vcs' for settings from vcs, 'current' for current buildType settings
-
freezeSettingsWithForcedPostprocessing
public void freezeSettingsWithForcedPostprocessing(@NotNull BuildTypeSettingsEx settings, String origin)
Description copied from interface:BuildPromotionEx
Freeze settings for this promotion using the given buildSettings and mark that postprocessing is still required for this promotion.- Parameters:
settings
- the settings to store into the build promotionorigin
- origin of settings, predefined values: 'vcs' for settings from vcs, 'current' for current buildType settings
-
freezeSettings
public void freezeSettings(@NotNull File settings, @NotNull String settingsOrigin) throws IOException
Description copied from interface:BuildPromotionEx
Freeze settings for this promotion using the given settings file.- Parameters:
settings
- the settings file to store into the build promotionsettingsOrigin
- origin of settings, predefined values: 'vcs' for settings from vcs, 'current' for current buildType settings- Throws:
IOException
- when freeze fails
-
setFreezeSettings
public void setFreezeSettings(@Nullable Boolean freezeSettings)
Description copied from interface:BuildPromotionEx
Indicates if we should freeze settings in build- Parameters:
freezeSettings
- true means freeze settings if it is enabled for buildType, false means don't attempt to freeze settings even if they are enabled, null means use buildType's defaults (it is default value)
-
getFreezeSettings
@Nullable public Boolean getFreezeSettings()
Description copied from interface:BuildPromotionEx
Returns true if we should freeze settings if it is enabled in buildType, false if settings shouldn't be frozen, null - use buildType's defaults- Returns:
- see above
-
getFrozenSettingsFile
@NotNull public File getFrozenSettingsFile()
- Returns:
- path to file with frozen settings.
-
hasFrozenSettings
public boolean hasFrozenSettings()
- Returns:
- true if settings of this promotion were frozen.
-
hasFrozenSettingsFromVcs
public boolean hasFrozenSettingsFromVcs()
- Returns:
- true if this promotion has frozen settins from VCS
-
needToFreezeSettings
public boolean needToFreezeSettings()
- Returns:
- true if there was no attempt to freeze settings (successful or failed)
-
scheduleCheckingForChangesIfNeeded
public boolean scheduleCheckingForChangesIfNeeded()
- Returns:
- true if checking for changes was scheduled and false if it was not, because build promotion has changes collected already
-
cancelCheckingForChanges
public void cancelCheckingForChanges()
-
hasDependencyOn
public boolean hasDependencyOn(long id)
-
setCustomParameters
public void setCustomParameters(@NotNull Map<String,String> customParameters)
Description copied from interface:BuildPromotionEx
Sets custom parameters in build promotion. Custom parameters contain both configuration and build parameters. Custom parameters override default parameters. BuildPromotion.persist() method should be called to persist them.- Parameters:
customParameters
- custom parameters
-
setCustomParameters
public void setCustomParameters(@NotNull Collection<Parameter> parameters)
Description copied from interface:BuildPromotionEx
Same as#setCustomParameters(List)
but acceptingParameter
instances
-
setAssociatedBuild
public void setAssociatedBuild(@Nullable SBuild build)
Description copied from interface:BuildPromotionEx
Associates new build to this build promotion
-
setOverridenVcsRoots
public void setOverridenVcsRoots(@NotNull Map<VcsRootInstance,VcsRootInstance> overridenVcsRoots) throws InvalidOverridenRootsException
Description copied from interface:BuildPromotionEx
Override default vcs roots for this promotion.- Parameters:
overridenVcsRoots
- map from original vcs root id to substitution root id- Throws:
InvalidOverridenRootsException
-
persist
public void persist(BuildPromotionEx.PromotionPersistMode persistMode)
-
copy
public BuildPromotionEx copy(boolean copyRevisions)
Description copied from interface:BuildPromotion
Creates copy of this build promotion (a copy will have different id). Note that this method does not make a deep copy if dependencies exist.- Parameters:
copyRevisions
- indicates whether to copy revisions associated with this promotion or not- Returns:
- copy of this build promotion
-
getSequenceBuild
@Nullable public SBuild getSequenceBuild()
- See Also:
BuildPromotionOwner.getSequenceBuild()
-
getStartedEquivalentPromotions
@NotNull public List<BuildPromotionEx> getStartedEquivalentPromotions(int maxNumToProcess)
Description copied from interface:BuildPromotionEx
Returns build promotions with associated builds and equivalent to this build promotion (same settings, changes and revisions)- Parameters:
maxNumToProcess
- maximum number of promotions to process while searching for equivalent promotions, -1 means unlimited- Returns:
- see above
-
getEquivalentPromotions
@NotNull public List<BuildPromotionEx> getEquivalentPromotions(@NotNull List<BuildPromotionEx> promotions)
Description copied from interface:BuildPromotionEx
Returns build promotions from the build queue equivalent to this build promotion (same settings, changes and revisions)- Returns:
- see above
-
isOutOfChangesSequence
public boolean isOutOfChangesSequence()
Description copied from interface:BuildPromotion
Returns true if there is a build started before this build promotion associated build which contains more recent changes.- Returns:
- see above
-
getArtifactDependencies
@NotNull public List<SArtifactDependency> getArtifactDependencies()
Description copied from interface:BuildPromotion
Returns collection of artifact dependencies to be sent to an agent. This collection may or may not be the same as default build configuration dependencies because before sending to an agent revision rules are fixed (dependencies begin pointing to concrete builds).- Returns:
- see above
-
getParameters
@NotNull public Map<String,String> getParameters()
Description copied from interface:BuildPromotion
Returns combined map of default and custom parameters. Combined map contains both build and configuration parameters. Custom parameters take precedence over default parameters. Note that parameters returned by this method can be modified before they are passed to agent, seeParametersPreprocessor
for more details.- Returns:
- see above
-
getParameterValue
@Nullable public String getParameterValue(@NotNull String paramName)
- Parameters:
paramName
- parameter name- Returns:
- value of the parameter with given name or null if there is no such parameter
-
getBuildParameters
@NotNull public Map<String,String> getBuildParameters()
Description copied from interface:BuildPromotion
Returns combined map of default and custom defined build parameters. Custom build parameters takes precedence over default parameters. Note that parameters returned by this method can be modified before they are passed to agent, seeParametersPreprocessor
for more details.- Returns:
- see above
-
isEquivalentTo
public boolean isEquivalentTo(@NotNull BuildPromotion promotion)
Description copied from interface:BuildPromotion
Returns true if this build promotion is equivalent to specified promotion, i.e. it corresponds to the same build configuration, contains same revisions and build parameters.- Parameters:
promotion
- build promotion- Returns:
- see above
-
setDesiredBranchName
public void setDesiredBranchName(@NotNull String branchName)
-
isCompositeBuild
public boolean isCompositeBuild()
- Returns:
- true if build promotion has dependencies and it was created in a build configuration marked as composite build
-
getCreatorNodeId
@NotNull public String getCreatorNodeId()
- Returns:
- node id which created the build promotion.
-
getInternalBranchName
@NotNull public String getInternalBranchName()
- Returns:
- internal branch name associated with build promotion. If build promotion belongs to default branch or is not branched, returns empty string.
-
getAutogeneratedBranchName
@Nullable public String getAutogeneratedBranchName()
Description copied from interface:BuildPromotionEx
Returns auto-generated branch name for the case if build promotion VCS roots differ from VCS roots in build configuration. The auto-generated name will have diff of changed settings.- Returns:
- auto-generated name or null if settings do not differ
-
getAuditLogActions
@NotNull public List<AuditLogAction> getAuditLogActions(@Nullable AuditLogFilter filter)
- Parameters:
filter
- if not null the filter is applied to the returned set of objects- Returns:
- audit log actions associated with this promotion
-
getAuditLog
@NotNull public AuditLog getAuditLog()
- Returns:
- audit log which can be used to log user actions for this build promotion
-
resetLogActionsCache
public void resetLogActionsCache()
Description copied from interface:BuildPromotionEx
Reset cached audit log
-
resetTagsCache
public void resetTagsCache()
Description copied from interface:BuildPromotionEx
Reset cached tags
-
getBuildSettings
@NotNull public BuildSettings getBuildSettings()
Description copied from interface:BuildPromotionEx
Returns settings specified toBuildPromotionEx.freezeSettings(BuildTypeEx, String)
method or settings of this buildType this promotion belongs to ifBuildPromotionEx.freezeSettings(BuildTypeEx, String)
wasn't called
-
maxChangesToStoreInCache
protected int maxChangesToStoreInCache(boolean returnChangesIfNoPreviousBuild)
- Overrides:
maxChangesToStoreInCache
in classAbstractBuildPromotion
-
getFinalArtifactDependencies
@NotNull public List<SArtifactDependency> getFinalArtifactDependencies()
-
getCustomArtifactDependencies
@NotNull public List<SArtifactDependency> getCustomArtifactDependencies()
-
resetAgentsCompatibilityCache
public void resetAgentsCompatibilityCache()
Description copied from interface:BuildPromotionEx
Resets promotion compatibility cache for all agents and agent types- Specified by:
resetAgentsCompatibilityCache
in interfaceBuildPromotionEx
- Overrides:
resetAgentsCompatibilityCache
in classAbstractBuildPromotion
-
getCheckoutDirectory
@Nullable public String getCheckoutDirectory()
-
getDefaultCheckoutDirectory
@NotNull public String getDefaultCheckoutDirectory(BuildTypeDescriptor.CheckoutType checkoutType)
Description copied from interface:BuildPromotionEx
Returns name of the checkout directory that should be used for the build if explicit checkout directory is not specified. Don't acceptBuildTypeDescriptor.CheckoutType.AUTO
, throwingIllegalArgumentException
if it's passed.
-
getBranch
public Branch getBranch()
- Returns:
- branch associated with this build promotion if it exists and null otherwise.
-
getArtifactsDirectory
@NotNull public File getArtifactsDirectory() throws BuildTypeNotFoundException
- Returns:
- Artifacts directory for given build promotion
- Throws:
BuildTypeNotFoundException
- in some rare cases when path to the artifacts directory is not known to this build promotion and there is no build configuration anymore so it is not possible to find this location without performing expensive disk scan operations- See Also:
SBuildType.getArtifactsDirectory()
,SBuild.getArtifactsDirectory()
-
setTagDatas
public void setTagDatas(@NotNull Collection<TagData> tags)
Description copied from interface:BuildPromotion
Changes tag set for this build promotion. Attention! The whole set of tags will be replaced with new one. It means that even if new set contains only public tag the action will affect private tags as well.- Parameters:
tags
- tags- See Also:
TagDataUtil
,for variety of tag-releated actions
-
getTagDatas
@NotNull public Collection<TagData> getTagDatas()
Description copied from interface:BuildPromotion
Returns list of all tags for this build promotion, no special order is preserved- Returns:
- tags
- See Also:
TagDataUtil
,for variety of tag-releated actions
-
getPrivateTags
@NotNull public List<String> getPrivateTags(@NotNull SUser user)
Description copied from interface:BuildPromotion
Returns list of private tag labels in lexicographical order for particular user for this build promotion- Returns:
- tags
-
setPrivateTags
public void setPrivateTags(@Nullable List<String> labels, @NotNull SUser user)
Description copied from interface:BuildPromotion
Set private tags for particular user Attention! Replace all private tags related to the particular user with new set- Parameters:
labels
- new tag labelsuser
- a particular user which tags should be updated- See Also:
for variety of tag-releated actions
-
getTags
@NotNull public List<String> getTags()
Description copied from interface:BuildPromotion
Returns list of public tag labels in lexicographical order for the build promotion- Returns:
- tags
-
setTags
public void setTags(List<String> labels)
Description copied from interface:BuildPromotion
Set public tags. Attention! Replace old public tags set with new one.- Parameters:
labels
- tag labels- See Also:
for variety of tag-releated actions
-
getQueuedDate
@Nullable public Date getQueuedDate()
Description copied from interface:BuildPromotion
Returns the date when the build was added to queue.- Returns:
- queued time, null if promotion wasn't queued
-
getServerStartDate
@Nullable public Date getServerStartDate()
Description copied from interface:BuildPromotion
Returns the timestamp when the build was removed from the queue.- Returns:
- the timestamp when the build was removed from the queue, null if wasn't yet
-
compareTo
public int compareTo(@NotNull BuildPromotion o)
-
resetBuildSettings
public void resetBuildSettings()
Description copied from interface:BuildPromotionEx
Resets cached build settings associated with promotion
-
getBuildPromotionsWithArtifactDependenciesOnMe
@NotNull public List<BuildPromotion> getBuildPromotionsWithArtifactDependenciesOnMe(@NotNull List<BuildPromotion> buildPromotions)
Description copied from interface:BuildPromotionEx
Checks artifact dependencies of the build promotions provided as an argument and returns those which have a direct artifact dependency (by build id) on this build promotion.- Parameters:
buildPromotions
- build promotions to check- Returns:
- the dependent build promotions
-
getExecutionTimeoutMin
public int getExecutionTimeoutMin()
Description copied from interface:BuildPromotionEx
Returns build execution timeout in minutes, 0 indicates that there is no limit
-
createBuildPromotionAccessChecker
@NotNull public Predicate<BuildPromotion> createBuildPromotionAccessChecker()
-
persistVcsRootEntries
public void persistVcsRootEntries()
Description copied from interface:BuildPromotionEx
Persists information about VCS roots used by this build promotion to the database.
-
persistDependencies
public void persistDependencies()
-
-