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 voidaddBuildProblem(BuildProblemData buildProblem)Adds build problem, currently it actually causes build failurevoidaddDependedOnMe(BuildPromotionEx promotion, DependencyOptions options)Adds link to parent promotionvoidaddDependedOnMeIfCached(BuildPromotionEx promotion, DependencyOptions options)Adds link to parent promotion only if depended on me list is already loaded from DB for this promotionvoidaddDependency(BuildPromotionEx dependOn, DependencyOptions options)Adds a build dependencySQueuedBuildaddToQueue(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.SQueuedBuildaddToQueue(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.booleanallDependenciesFinished()voidartifactsChanged(boolean scheduleUpdate)Should be called when artifacts are changed on disk.voidassociatedBuildFinished()voidbuildEvictedFromCache()Called when finished build associated with this promotion is removed from the builds cache.voidbuildFinished()Must be called when build history entry created for this promotion.voidcancelCheckingForChanges()intcompareTo(BuildPromotion o)BuildPromotionExcopy(boolean copyRevisions)Creates copy of this build promotion (a copy will have different id).Predicate<BuildPromotion>createBuildPromotionAccessChecker()intdecreaseExpirationCounter(int decreaseAmount)voiddeleteBuildProblem(String identity)Deletes build problem Deleting build problem may change build status to SUCCESSvoiddetachChanges()Marks build as build with detached changes, i.e.voidensureBuildLogFlushed()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.voidfreezeSettings()Freeze buildType settings for this promotion.voidfreezeSettings(File settings, String settingsOrigin)Freeze settings for this promotion using the given settings file.voidfreezeSettings(BuildTypeEx buildType, String settingsOrigin)Freeze buildType settings for this promotion using the given buildType.voidfreezeSettings(BuildTypeSettingsEx settings, String settingsOrigin)Freeze settings for this promotion using the given buildSettings.voidfreezeSettingsWithForcedPostprocessing(BuildTypeSettingsEx settings, String origin)Freeze settings for this promotion using the given buildSettings and mark that postprocessing is still required for this promotion.StringgenerateAgentAccessCode()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.BuildArtifactsgetArtifacts(BuildArtifactsViewMode mode)Returns artifacts of this build promotion.FilegetArtifactsDirectory()BuildPromotionEx.ArtifactsStateInfogetArtifactStateInfo()SBuildgetAssociatedBuild()Returns running or finished build associated with this promotion or null if there is no such build.LonggetAssociatedBuildId()Returns id of the build associated with this promotion, or null if there is no such build.ObjectgetAttribute(String attributeName)com.google.common.collect.ImmutableMap<String,Object>getAttributes()AuditLoggetAuditLog()List<AuditLogAction>getAuditLogActions(AuditLogFilter filter)StringgetAutogeneratedBranchName()Returns auto-generated branch name for the case if build promotion VCS roots differ from VCS roots in build configuration.BranchgetBranch()static StringgetBranchVcsName(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).CommentgetBuildComment()Returns build comment assigned for this promotionBuildLogExgetBuildLog()BuildLogExgetBuildLogIfInitialized()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.BuildSettingsgetBuildSettings()Returns settings specified toBuildPromotionEx.freezeSettings(BuildTypeEx, String)method or settings of this buildType this promotion belongs to ifBuildPromotionEx.freezeSettings(BuildTypeEx, String)wasn't calledBuildTypeExgetBuildType()Returns build configuration to which this promotion corresponds.StringgetBuildTypeExternalId()Returns the external id of the associated build type.StringgetBuildTypeId()Returns internal id of build configuration to which this promotion corresponds, same asBuildPromotion.getBuildType().getBuildTypeId()LonggetChainModificationId()Returns max modification id (max result of #getLastModificationId()) among this promotion all all its dependencies transitively.StringgetCheckoutDirectory()StringgetCollectChangesError()StringgetCreatorNodeId()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.StringgetDefaultCheckoutDirectory(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)intgetExecutionTimeoutMin()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()BooleangetFreezeSettings()Returns true if we should freeze settings if it is enabled in buildType, false if settings shouldn't be frozen, null - use buildType's defaultsFilegetFrozenSettingsFile()longgetId()Returns id of this promotion, promotion id is unique among all other build promotions and is not changed during promotion life cycle.StringgetInternalBranchName()LonggetLastModificationId()Returns id of the last change associated with this promotion or null if changes collecting is not performed yet.intgetNumberOfDependedOnMe()Returns total number of parent snapshot dependencies (without permissions filtering).intgetNumberOfDependencies()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)SUsergetOwner()For personal builds returns owner of the build.TeamCityNodegetOwnerNode()StringgetOwnerNodeUrl()Returns url of the node which processes this build messages.ParametergetParameter(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.StringgetParameterValue(String paramName)BuildTypeExgetParentBuildType()Returns base build configuration to which this promotion corresponds, i.e.StringgetParentBuildTypeId()For non personal builds returns same asBuildPromotion.getBuildTypeId().LonggetPersonalChangeId()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 promotionStringgetProjectExternalId()Returns the project external idStringgetProjectId()Returns the project internal id.List<String>getProjectPathIds()Returns project path of a project where this build promotion belongs.QueuedBuildExgetQueuedBuild()Returns queued build associated with this promotion or null if there is no such build in the queueDategetQueuedDate()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()SBuildgetSequenceBuild()DategetServerStartDate()Returns the timestamp when the build was removed from the queue.VcsRootInstancegetSettingsVcsRootInstance()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.booleanhasBuildProblemsOfType(String type)booleanhasComputedArtifactsState()booleanhasCustomPatch()booleanhasDependencyOn(long id)booleanhasFailureReasons()booleanhasFrozenSettings()booleanhasFrozenSettingsFromVcs()booleanhasLoadedTags()Returns true if promotion loaded information about tags from dbbooleanhasStartedParent()Returns true if there exists started build which has reference to this promotionbooleanhasUnpublishedPromotionPersistingEvent()voidinitBuildProblems()Init build problems from databasebooleanisAssociatedBuildFinished()booleanisCanceled()Return true if associated build is canceledbooleanisChangeCollectingNeeded()Return true if change collection is required for this build promotion (otherwise, changes are collected already).booleanisChangeCollectingNeeded(boolean checkDependencies)booleanisChangesCollectingInProgress()booleanisChangesDetached()booleanisCompositeBuild()booleanisDeleted()booleanisEquivalentTo(BuildPromotion promotion)Returns true if this build promotion is equivalent to specified promotion, i.e.EquivalenceCheckResultisEquivalentTo(BuildPromotion promoToCompare, Boolean compareBranches)booleanisFailedToCollectChanges()booleanisFinished()booleanisForcedPostprocessingOfFrozenSettings()booleanisIncomplete()Returns whether the build promotion is incomplete (canceled).booleanisLaterThan(BuildPromotion promotion)Returns true if this promotion contains more recent changes comparing to the specified promotion.booleanisOutOfChangesSequence()Returns true if there is a build started before this build promotion associated build which contains more recent changes.booleanisPartOfBuildChain()booleanisPersisted()booleanisPersonal()Return true if this build promotion relates to personal buildbooleanisUsed()Returns true if there is a reference to this build promotion from queued, running or history build.voidlockDependenciesOptimizing()voidmarkAsIncompleteIfHasFailedToStartProblems()Marks build promotion as incomplete if it has failed to start build problemsvoidmarkDeleted()Mark this promotion as deleted in the database.voidmarkIncomplete()Mark build promotion as incomplete (canceled)protected intmaxChangesToStoreInCache(boolean returnChangesIfNoPreviousBuild)voidmuteBuildProblems(boolean muteIfTrue, SUser user, String comment)Makes all existing build problems enabled or disabledbooleanneedToFreezeSettings()voidpersist()Persists state of the build promotionvoidpersist(BuildPromotionEx.PromotionPersistMode persistMode)voidpersistDependencies()voidpersistVcsRootEntries()Persists information about VCS roots used by this build promotion to the database.voidremoveDependedOnMe(BuildPromotion parentPromo)Removes link to parent promotionvoidremoveDependency(BuildPromotionEx promo)Removes dependency on specified promotionvoidreplaceDependency(BuildPromotionEx origPromo, BuildPromotionEx newPromo, DependencyOptions newOptions)Replaces dependency on one promotion with dependency to another promotionvoidresetAgentsCompatibilityCache()Resets promotion compatibility cache for all agents and agent typesvoidresetArtifactsState(boolean scheduleUpdate)Resets current artifacts state in the build promotionvoidresetBuildLog()voidresetBuildRevisions()voidresetBuildSettings()Resets cached build settings associated with promotionvoidresetDependenciesHardRefs()Each newly created build promotion keeps a reference to its direct dependencies (BuildPromotion instances).voidresetDependentOnMeCache()reset only dependent on this cache of the promotion.voidresetDirectDependenciesCache()reset only direct dependencies cache of the promotion.voidresetLogActionsCache()Reset cached audit logvoidresetTagsCache()Reset cached tagsbooleanscheduleCheckingForChangesIfNeeded()voidsetArtifactsDirectory(File artifactsDir)Sets new artifacts directory to this build promotion.voidsetAssociatedBuild(SBuild build)Associates new build to this build promotionvoidsetAttribute(String name, Object value)Sets some attribute to the build promotionvoidsetBuildComment(User user, String comment)Assigns the build comment for this promotionvoidsetBuildRevisions(Collection<BuildRevisionEx> revisions, long maxModificationId, long chainModificationId)Same asBuildPromotionEx.setBuildRevisions(Collection, long, long, boolean)with validateBranch parameter set to true.voidsetBuildRevisions(Collection<BuildRevisionEx> revisions, long maxModificationId, long chainModificationId, boolean validateBranch)Sets revisions and modificationId into this build promotion.voidsetCustomArtifactDependencies(List<SArtifactDependency> dependencies)Sets custom artifact dependencies, those which override default (specified in build configuration).voidsetCustomParameters(Collection<Parameter> parameters)Same as#setCustomParameters(List)but acceptingParameterinstancesvoidsetCustomParameters(Map<String,String> customParameters)Sets custom parameters in build promotion.voidsetDesiredBranchName(String branchName)voidsetExpirationCounter(int counter)voidsetFailedToCollectChanges(Throwable t)voidsetFinalArtifactDependencies(List<SArtifactDependency> dependencies)Sets the final artifact dependencies, i.e.voidsetFreezeSettings(Boolean freezeSettings)Indicates if we should freeze settings in buildvoidsetOverridenVcsRoots(Map<VcsRootInstance,VcsRootInstance> overridenVcsRoots)Override default vcs roots for this promotion.voidsetOwnerNodeUrl(String url)Sets url of the node which processes this build messages.voidsetPrivateTags(List<String> labels, SUser user)Set private tags for particular user Attention! Replace all private tags related to the particular user with new setvoidsetQueuedAt(Date queuedAt)voidsetRemoveFromQueueDate(Date removeFromQueueDate)voidsetTagDatas(Collection<TagData> tags)Changes tag set for this build promotion.voidsetTags(List<String> labels)Set public tags.voidtraverseDependedOnMe(DependencyConsumer<BuildPromotionEx> consumer)Traverses all build promotions depending on this one transitively.voidtraverseDependencies(DependencyConsumer<BuildPromotionEx> consumer)Traverses all build promotion dependencies (breadth first).voidtraverseSelfAndDependedOnMe(DependencyConsumer<BuildPromotionEx> consumer)voidtraverseSelfAndDependencies(DependencyConsumer<BuildPromotionEx> consumer)voidunlockDependenciesOptimizing()voidupdateDependenciesCache(Supplier<Map<Long,Integer>> dependenciesSupplier)Updates dependencies cache of the promotion and resets "dependent on me" cache of the supplied dependencies.voidupdateFromDB(BuildPromotionEx.UpdateReason reason)Updates promotion data from databasevoidupdateSelfAndDependenciesFromDB()Updates the build promotion and all its dependencies from the databasevoidupdateStateFromBuildData(AbstractBuildData runningBuildData)Quickly updates some information in build promotion from DB information.voidwaitForChangesCollectingToFinish(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:BuildPromotionReturns 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:BuildPromotionFor personal builds returns owner of the build. For non personal builds returns null.- Returns:
- see above
-
persist
public void persist()
Description copied from interface:BuildPromotionExPersists state of the build promotion
-
addToQueue
public SQueuedBuild addToQueue(@NotNull String requestor)
Description copied from interface:BuildPromotionCreates 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:BuildPromotionCreates 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:BuildPromotionReturns 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:BuildPromotionReturns 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:BuildPromotionReturns 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:BuildPromotionReturns 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:BuildPromotionReturns the project internal id.- Returns:
- project internal id
-
getProjectExternalId
public String getProjectExternalId()
Description copied from interface:BuildPromotionReturns the project external id- Returns:
- project external id
-
getParentBuildType
public BuildTypeEx getParentBuildType()
Description copied from interface:BuildPromotionReturns 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:BuildPromotionFor 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:BuildPromotionReturns 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_IDvalue is returned.- Returns:
- the external identifier of the associated build type.
-
getBuildTypeId
@NotNull public String getBuildTypeId()
Description copied from interface:BuildPromotionReturns 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:BuildPromotionReturn 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:BuildPromotionReturns 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:BuildPromotionReturns 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:ReadOnlyUserParametersReturns build and configuration parameters in single collection.- Returns:
- see above
-
getVcsRootEntries
@NotNull public List<VcsRootInstanceEntry> getVcsRootEntries()
Description copied from interface:BuildPromotionReturns VCS root entries associated with this promotion.- Returns:
- VCS root entries
-
getVcsRootEntries
@NotNull public List<VcsRootInstanceEntry> getVcsRootEntries(boolean includeSettingsRoot)
Description copied from interface:BuildPromotionExReturns entries for VCS roots associated with this promotion. If promotion has an implicit settings root (not attached to buildType) andincludeSettingsRootistrue, 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:BuildPromotionExReturns 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:BuildPromotionExSets 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:BuildPromotionExReturns 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:BuildPromotionExReturns url of the node which processes this build messages. Returns null if this build promotion is not assigned to any node. ReturnsBuildPromotionEx.MAIN_NODE_MARKERif 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:BuildPromotionExSets url of the node which processes this build messages.
-
getOverridenVcsRoots
@NotNull public Map<VcsRootInstance,VcsRootInstance> getOverridenVcsRoots()
Description copied from interface:BuildPromotionExGet 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 IllegalArgumentExceptionDescription copied from interface:BuildPromotionExAdds 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:BuildPromotionExAdds link to parent promotion
-
addDependedOnMeIfCached
public void addDependedOnMeIfCached(@NotNull BuildPromotionEx promotion, @NotNull DependencyOptions options)Description copied from interface:BuildPromotionExAdds 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:BuildPromotionExRemoves link to parent promotion
-
getQueuedBuild
public QueuedBuildEx getQueuedBuild()
Description copied from interface:BuildPromotionReturns 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:BuildPromotionReturns build comment assigned for this promotion- Returns:
- build comment
-
setBuildComment
public void setBuildComment(@NotNull User user, @Nullable String comment)Description copied from interface:BuildPromotionAssigns 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:BuildPromotionReturns 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:BuildPromotionExSets 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 IllegalArgumentExceptionDescription copied from interface:BuildPromotionExSets 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:BuildPromotionReturns 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:BuildPromotionReturns total number of snapshot dependencies (without permissions filtering).- Returns:
- see above
-
getNumberOfDependedOnMe
public int getNumberOfDependedOnMe()
Description copied from interface:BuildPromotionReturns 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:BuildPromotionExMarks 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:BuildPromotionExSets some attribute to the build promotion- Parameters:
name- attribute namevalue- attribute value
-
isChangeCollectingNeeded
public boolean isChangeCollectingNeeded()
Description copied from interface:BuildPromotionExReturn 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:BuildPromotionExMark build promotion as incomplete (canceled)
-
markAsIncompleteIfHasFailedToStartProblems
public void markAsIncompleteIfHasFailedToStartProblems()
Description copied from interface:BuildPromotionExMarks build promotion as incomplete if it has failed to start build problems
-
isIncomplete
public boolean isIncomplete()
Description copied from interface:BuildPromotionExReturns 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 IllegalStateExceptionDescription copied from interface:BuildPromotionExMark 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:BuildPromotionExReturns 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, CancellationExceptionDescription copied from interface:BuildPromotionExIf 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 timeoutInterruptedExceptionExecutionExceptionCancellationException
-
lockDependenciesOptimizing
public void lockDependenciesOptimizing()
-
unlockDependenciesOptimizing
public void unlockDependenciesOptimizing()
-
addBuildProblem
public void addBuildProblem(@NotNull BuildProblemData buildProblem)Description copied from interface:BuildPromotionExAdds build problem, currently it actually causes build failure
-
getFailureReasons
@NotNull public List<BuildProblemData> getFailureReasons()
Description copied from interface:BuildPromotionExReturns 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:BuildPromotionExReturns 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:BuildPromotionExSame 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:BuildPromotionExIf 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:BuildPromotionExMakes 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:BuildPromotionExDeletes 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:BuildPromotionExQuickly 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:BuildPromotionExUpdates promotion data from database
-
updateSelfAndDependenciesFromDB
public void updateSelfAndDependenciesFromDB()
Description copied from interface:BuildPromotionExUpdates the build promotion and all its dependencies from the database
-
initBuildProblems
public void initBuildProblems()
Description copied from interface:BuildPromotionExInit build problems from database
-
getRevisions
@NotNull public List<BuildRevision> getRevisions()
Description copied from interface:BuildPromotionReturns VCS root revisions associated with this promotion.- Returns:
- VCS root revisions
-
getAllRevisionsMap
@NotNull public Map<VcsRootInstance,BuildRevisionEx> getAllRevisionsMap()
Description copied from interface:BuildPromotionExReturns 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:
getSettingsVcsRootInstancein interfaceBuildPromotionEx- Overrides:
getSettingsVcsRootInstancein 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:BuildPromotionExReturns changes in this promotion computed according to specified options, doesn't include changes from dependencies.- Specified by:
getOwnChangesin interfaceBuildPromotionEx- Overrides:
getOwnChangesin 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:BuildPromotionReturns 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:BuildPromotionReturn true if this build promotion relates to personal build- Returns:
- see above
-
getPersonalChangeId
public Long getPersonalChangeId()
Description copied from interface:BuildPromotionExReturns 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:BuildPromotionExReturns 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:BuildPromotionReturn 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:BuildPromotionExTraverses 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:BuildPromotionExTraverses 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:BuildPromotionExSame 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:BuildPromotionExSets 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:BuildPromotionExReturns 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:BuildPromotionReturns 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:BuildPromotionInfoReturns direct snapshot dependencies of this build promotion- Returns:
- see above
-
removeDependency
public void removeDependency(@NotNull BuildPromotionEx promo)Description copied from interface:BuildPromotionExRemoves dependency on specified promotion
-
replaceDependency
public void replaceDependency(@NotNull BuildPromotionEx origPromo, @NotNull BuildPromotionEx newPromo, @NotNull DependencyOptions newOptions)Description copied from interface:BuildPromotionExReplaces 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:BuildPromotionExUpdates dependencies cache of the promotion and resets "dependent on me" cache of the supplied dependencies.
-
resetDirectDependenciesCache
public void resetDirectDependenciesCache()
Description copied from interface:BuildPromotionExreset only direct dependencies cache of the promotion.
-
resetDependentOnMeCache
public void resetDependentOnMeCache()
Description copied from interface:BuildPromotionExreset only dependent on this cache of the promotion.
-
ensureBuildLogFlushed
public void ensureBuildLogFlushed()
Description copied from interface:BuildPromotionExMakes sure that messages in the build log buffer are flushed on disk.
-
generateAgentAccessCode
public String generateAgentAccessCode()
Description copied from interface:BuildPromotionExGenerates agent access code for communication with TeamCity during build
-
resetDependenciesHardRefs
public void resetDependenciesHardRefs()
Description copied from interface:BuildPromotionExEach 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:BuildPromotionExReturns 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:BuildPromotionExShould 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:BuildPromotionExResets 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:BuildPromotionExMust be called when build history entry created for this promotion.
-
buildEvictedFromCache
public void buildEvictedFromCache()
Description copied from interface:BuildPromotionExCalled 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:BuildPromotionExFreeze 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:BuildPromotionExFreeze 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:BuildPromotionExFreeze 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:BuildPromotionExFreeze 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 IOExceptionDescription copied from interface:BuildPromotionExFreeze 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:BuildPromotionExIndicates 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:BuildPromotionExReturns 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:BuildPromotionExSets 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:BuildPromotionExSame as#setCustomParameters(List)but acceptingParameterinstances
-
setAssociatedBuild
public void setAssociatedBuild(@Nullable SBuild build)Description copied from interface:BuildPromotionExAssociates new build to this build promotion
-
setOverridenVcsRoots
public void setOverridenVcsRoots(@NotNull Map<VcsRootInstance,VcsRootInstance> overridenVcsRoots) throws InvalidOverridenRootsExceptionDescription copied from interface:BuildPromotionExOverride 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:BuildPromotionCreates 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:BuildPromotionExReturns 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:BuildPromotionExReturns 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:BuildPromotionReturns 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:BuildPromotionReturns 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:BuildPromotionReturns 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, seeParametersPreprocessorfor 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:BuildPromotionReturns 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, seeParametersPreprocessorfor more details.- Returns:
- see above
-
isEquivalentTo
public boolean isEquivalentTo(@NotNull BuildPromotion promotion)Description copied from interface:BuildPromotionReturns 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:BuildPromotionExReturns 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:BuildPromotionExReset cached audit log
-
resetTagsCache
public void resetTagsCache()
Description copied from interface:BuildPromotionExReset cached tags
-
getBuildSettings
@NotNull public BuildSettings getBuildSettings()
Description copied from interface:BuildPromotionExReturns 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:
maxChangesToStoreInCachein classAbstractBuildPromotion
-
getFinalArtifactDependencies
@NotNull public List<SArtifactDependency> getFinalArtifactDependencies()
-
getCustomArtifactDependencies
@NotNull public List<SArtifactDependency> getCustomArtifactDependencies()
-
resetAgentsCompatibilityCache
public void resetAgentsCompatibilityCache()
Description copied from interface:BuildPromotionExResets promotion compatibility cache for all agents and agent types- Specified by:
resetAgentsCompatibilityCachein interfaceBuildPromotionEx- Overrides:
resetAgentsCompatibilityCachein classAbstractBuildPromotion
-
getCheckoutDirectory
@Nullable public String getCheckoutDirectory()
-
getDefaultCheckoutDirectory
@NotNull public String getDefaultCheckoutDirectory(BuildTypeDescriptor.CheckoutType checkoutType)
Description copied from interface:BuildPromotionExReturns name of the checkout directory that should be used for the build if explicit checkout directory is not specified. Don't acceptBuildTypeDescriptor.CheckoutType.AUTO, throwingIllegalArgumentExceptionif 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:BuildPromotionChanges 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:BuildPromotionReturns 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:BuildPromotionReturns 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:BuildPromotionSet 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:BuildPromotionReturns 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:BuildPromotionSet 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:BuildPromotionReturns 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:BuildPromotionReturns 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:BuildPromotionExResets cached build settings associated with promotion
-
getBuildPromotionsWithArtifactDependenciesOnMe
@NotNull public List<BuildPromotion> getBuildPromotionsWithArtifactDependenciesOnMe(@NotNull List<BuildPromotion> buildPromotions)
Description copied from interface:BuildPromotionExChecks 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:BuildPromotionExReturns 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:BuildPromotionExPersists information about VCS roots used by this build promotion to the database.
-
persistDependencies
public void persistDependencies()
-
-