Package jetbrains.buildServer.serverSide
Interface BuildPromotionEx
-
- All Superinterfaces:
BuildPromotion,BuildPromotionInfo,Comparable<BuildPromotion>,InternalParameters,ReadOnlyUserParameters
- All Known Implementing Classes:
AbstractBuildPromotion,BuildPromotionImpl,BuildPromotionManagerImpl.TemplateDummyBuildPromotion,DummyBuildPromotion,MockBuildPromotion
public interface BuildPromotionEx extends BuildPromotion, BuildPromotionInfo, InternalParameters
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classBuildPromotionEx.ArtifactsStatestatic interfaceBuildPromotionEx.ArtifactsStateInfostatic classBuildPromotionEx.CompatibilityCacheUpdateModestatic classBuildPromotionEx.PromotionPersistModestatic classBuildPromotionEx.UpdateReason
-
Field Summary
Fields Modifier and Type Field Description static StringMAIN_NODE_MARKERstatic intMAX_BRANCH_NAME_LENGTHHolds the maximum branch name length.-
Fields inherited from interface jetbrains.buildServer.serverSide.BuildPromotion
NOT_EXISTING_BUILD_TYPE_ID
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddBuildProblem(BuildProblemData buildProblem)Adds build problem, currently it actually causes build failurevoidaddDependedOnMe(BuildPromotionEx promoEx, 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 promo, DependencyOptions options)Adds a build dependencybooleanallDependenciesFinished()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()voidclearPrevPromotionCache(Collection<BuildPromotion> targetPromos)booleancontainsChange(SVcsModification m)Returns true if promotion contains specified modification among its changes.BuildPromotionExcopy(boolean copyRevisions)Creates copy of this build promotion (a copy will have different id).Predicate<BuildPromotion>createBuildPromotionAccessChecker()OrderedBuildcreateOrderedBuild()Returns an OrderedBuild with all fields filled.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.voidfillDetectedChanges(List<ChangeDescriptor> accumulator, ChangesCalculationOptionsEx options)Computes changes according to the specified options and add them to the given accumulatorvoidfillDetectedChanges(List<ChangeDescriptor> accumulator, SelectPrevBuildPolicy prevBuildPolicy, Boolean includeDependencyChanges, VcsModificationProcessor callback)BuildPromotionExfindSelfOrDependencyWithProblem(Predicate<BuildProblemData> predicate)Traverses build problems of the current build promotion and all of its dependencies using breadth first search and returns the first one for which the supplied predicate returns trueBuildPromotionEx[]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 buildCompatibilityResultgetAgentCompatibility(AgentDescription agentDescription)Map<SAgentType,CompatibilityResult>getAgentTypeCompatibilityMap(Collection<SAgentType> available)Returns map of agent types to compatibility result.Map<VcsRootInstance,BuildRevisionEx>getAllRevisionsMap()Returns all vcs root revisions assciated with build, not only regular vcs roots attached to the build configurations.BuildPromotionExgetAnchorBuildPromotion()For the build promotion which runs in a virtual build configuration returns a build promotion which created it.BuildArtifactsgetArtifacts(BuildArtifactsViewMode mode)Returns artifacts of this build promotion.BuildPromotionEx.ArtifactsStateInfogetArtifactStateInfo()ObjectgetAttribute(String attributeName)Map<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.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).List<Requirement>getBuildFeaturesRequirements()Returns requirements coming by build features, resolvedBuildLogExgetBuildLog()BuildLogExgetBuildLogIfInitialized()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 tofreezeSettings(BuildTypeEx, String)method or settings of this buildType this promotion belongs to iffreezeSettings(BuildTypeEx, String)wasn't calledBuildTypeExgetBuildType()Returns build configuration to which this promotion corresponds.Collection<SAgentType>getCanRunOnAgentTypes(Collection<SAgentType> available)LonggetChainModificationId()Returns max modification id (max result of #getLastModificationId()) among this promotion all all its dependencies transitively.List<SVcsModification>getChanges(SelectPrevBuildPolicy policy, boolean returnChangesIfNoPreviousBuild, VcsModificationProcessor callback)StringgetCheckoutDirectory()StringgetCollectChangesError()Set<SUser>getCommitters(SelectPrevBuildPolicy selectPrevBuildPolicy, int maxChangesToProcess)Same asBuildPromotion.getCommitters(SelectPrevBuildPolicy)but allows to control number of changes which should be looked up when committers are computed.Collection<SAgentType>getCompatibleAgentTypes(Collection<SAgentType> available)List<SArtifactDependency>getCustomArtifactDependencies()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.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()DependenciesSuppliergetDependenciesSupplier()Creates a dependencies supplier from the snapshot dependencies of this build promotion.BuildDependencyGraphgetDependencyGraph()Returns dependency graph as if this build promotion is the top of the graph.List<BuildPromotionEx>getDependentCompositePromotions()DategetDetachedFromAgentDate()List<ChangeDescriptor>getDetectedChanges(ChangesCalculationOptionsEx options)Returns changes according to the specified optionsList<ChangeDescriptor>getDetectedChanges(SelectPrevBuildPolicy prevBuildPolicy)List<ChangeDescriptor>getDetectedChanges(SelectPrevBuildPolicy prevBuildPolicy, Boolean includeDependencyChanges)List<ChangeDescriptor>getDetectedChanges(SelectPrevBuildPolicy prevBuildPolicy, Boolean includeDependencyChanges, VcsModificationProcessor callback)List<BuildDetectedChangesProvider>getDetectedChangesProviders(SelectPrevBuildPolicy prevBuildPolicy, Boolean includeDependencyChanges)List<BuildPromotionEx>getEquivalentPromotions(List<BuildPromotionEx> queuedBuilds)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()StringgetInternalBranchName()LimitedChangesCollectiongetLimitedChanges(SelectPrevBuildPolicy policy, int limit)intgetMaximumNumberOfBuildsPerBranch()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.TeamCityNodegetOwnerNode()StringgetOwnerNodeUrl()Returns url of the node which processes this build messages.ParametersProvidergetParametersProvider()Creates and returns a parameters provider, that provides with all parameters of this build and buidls this one depends on.BuildTypeExgetParentBuildType()Returns base build configuration to which this promotion corresponds, i.e.LonggetPersonalChangeId()Returns personal change id associated with this build promotion.List<ChangeDescriptor>getPersonalChanges(List<ChangeDescriptor> allChanges)Takes all changes and returns only those that belong to current owner of build promotion.Stream<OrderedBuild>getPreviousBuilds(Filter<String> branchFilter)Returns stream of previous builds matched by specified branch filter and ordered by changesOrderedBuildgetPreviousOrderedBuild(SelectPrevBuildPolicy policy)Returns previous OrderedBuild instance which corresponds to a build promotion which is created before this one and corresponding to the specified policy.List<String>getProjectPathIds()Returns project path of a project where this build promotion belongs.PromotionCustomizationInfogetPromotionCustomization()Returns promotion customization details, if any Build promotion can be customized by pressing ...Map<Long,RepositoryVersion>getProvidedUpperLimitRevisions()QueuedBuildExgetQueuedBuild()Returns queued build associated with this promotion or null if there is no such build in the queueSBuildgetRealOrDummyBuild()List<Requirement>getRequirements()Returns requirements configured for this build promotion.Map<VcsRootInstance,BuildRevision>getRevisionsMap()List<Requirement>getRunnersRequirements(SBuildStepsCollection buildSteps)Returns requirements exposed by runners.SBuildgetSequenceBuild()byte[]getSettingsDigest(boolean compute)Returns digest of build promotion settings.VcsRootInstancegetSettingsVcsRootInstance()List<BuildPromotionEx>getStartedEquivalentPromotions(int maxNumToProcess)Returns build promotions with associated builds and equivalent to this build promotion (same settings, changes and revisions)TopBuildDependencyGraphgetTopDependencyGraph()Returns topmost dependency graphCollection<BuildProblem>getUnsortedBuildProblems()Same asgetBuildProblems()but returns problems in any order and can work faster because of that.Map<VcsRootInstance,BuildRevisionEx>getUpperLimitRevisions()Returns upper limit revisions which were available when checking for changes operation was performed.List<VcsRootInstanceEntry>getVcsRootEntries(boolean includeSettingsRoot)Returns entries for VCS roots associated with this promotion.StringgetVersionedSettingsRevision(VcsRootInstance vcsRoot)Returns a revision of versioned settings for the given VCS root instance or null if such a revision does not exist.booleanhasArtifactDependencyOn(BuildPromotion dependencyBuild)Checks if this promotion artifact-depends on the passed one.booleanhasBuildProblemsOfType(String type)booleanhasComputedArtifactsState()booleanhasComputedChanges(SelectPrevBuildPolicy policy, VcsModificationProcessor callback)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 databasebooleanisAgentLessBuild()Does it build cannot be executed on any usual agent but only by some external proccess.booleanisAssociatedBuildFinished()booleanisChangeCollectingNeeded()Return true if change collection is required for this build promotion (otherwise, changes are collected already).booleanisChangeCollectingNeeded(boolean checkDependencies)booleanisChangesCollectingInProgress()booleanisDeleted()booleanisDetachedFromAgent()EquivalenceCheckResultisEquivalentTo(BuildPromotion promoToCompare, Boolean compareBranches)booleanisFinished()booleanisForcedPostprocessingOfFrozenSettings()booleanisIncomplete()Returns whether the build promotion is incomplete (canceled).booleanisMaximumNumberOfBuildsPerBranchLimited()booleanisPersisted()booleanisVirtual()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)voidmuteBuildProblems(boolean muteIfTrue, SUser user, String comment)Makes all existing build problems enabled or disabledbooleanneedToFreezeSettings()booleanoccupiesLicenseSlot()Returns true when this build promotion should occupy one of license slots, false otherwise.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 promoEx)Removes link to parent promotionvoidremoveDependency(BuildPromotionEx promo)Removes dependency on specified promotionvoidreplaceDependency(BuildPromotionEx origDependency, BuildPromotionEx newDependency, DependencyOptions newOptions)Replaces dependency on one promotion with dependency to another promotionvoidresetAgentsCompatibilityCache()Resets promotion compatibility cache for all agents and agent typesvoidresetAllCompatibilityCaches()voidresetArtifactsState(boolean scheduleUpdate)Resets current artifacts state in the build promotionvoidresetBuildLog()voidresetBuildRevisions()voidresetBuildSettings()Resets cached build settings associated with promotionvoidresetChangesCache()Resets cache of changes in this 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.voidresetIncompatibleAgentsCache(Predicate<CompatibilityResult> compatibilityPredicate)voidresetIncompatibleAgentTypesCache(Predicate<CompatibilityResult> compatibilityPredicate)voidresetLogActionsCache()Reset cached audit logvoidresetRequirementsCache()voidresetTagsCache()Reset cached tagsbooleansameBranch(BuildPromotionEx promotion)booleanscheduleCheckingForChangesIfNeeded()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 promotionvoidsetBuildRevisions(Collection<BuildRevisionEx> revisions, long maxModificationId, long chainModificationId)Same assetBuildRevisions(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> parameters)Sets custom parameters in build promotion.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> overridenVcsRootIds)Override default vcs roots for this promotion.voidsetOwnerNodeUrl(String url)Sets url of the node which processes this build messages.voidsetProvidedUpperLimitRevisions(Map<Long,RepositoryVersion> upperLimitRevisions)Sets custom/provided upper limit revisions which will be used during the checking for changes process instead of the current repository version.voidsetQueuedAt(Date queuedAt)voidsetRemoveFromQueueDate(Date removeFromQueueDate)voidsetVersionedSettingsRevision(VcsRootInstance vcsRoot, String revision)Remmebers versioned settings revision for the specified VCS root.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()voidupdateAgentsCompatibilityCache(Collection<SBuildAgent> agents, BuildPromotionEx.CompatibilityCacheUpdateMode cacheUpdateMode)voidupdateDependenciesCache(Supplier<Map<Long,Integer>> newDependenciesSupplier)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 interface jetbrains.buildServer.serverSide.BuildPromotion
addToQueue, addToQueue, getAllDependencies, getArtifactDependencies, getArtifactsDirectory, getAssociatedBuild, getAssociatedBuildId, getBranch, getBuildComment, getBuildFeaturesOfType, getBuildParameters, getBuildTypeExternalId, getBuildTypeId, getCanRunOnAgents, getChanges, getChanges, getCommitters, getCompatibilityMap, getCompatibleAgents, getContainingChanges, getCreatorNodeId, getCustomParameters, getDefaultParameters, getId, getLastModificationId, getNumberOfDependedOnMe, getNumberOfDependencies, getOwner, getParameters, getParameterValue, getParentBuildTypeId, getPersonalChanges, getPreviousBuildPromotion, getPrivateTags, getProjectExternalId, getProjectId, getQueuedDate, getRevisions, getServerStartDate, getTagDatas, getTags, getVcsRootEntries, hasBuildFeatureOfType, isCanceled, isChangesDetached, isCompositeBuild, isEquivalentTo, isFailedToCollectChanges, isLaterThan, isOutOfChangesSequence, isPartOfBuildChain, isPersonal, isUsed, setBuildComment, setDesiredBranchName, setPrivateTags, setTagDatas, setTags
-
Methods inherited from interface jetbrains.buildServer.serverSide.buildDistribution.BuildPromotionInfo
getBuildParameters, getCanRunOnAgents, getDirectDependencies, getId, getParameters, isCompositeBuild
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface jetbrains.buildServer.serverSide.InternalParameters
getBooleanInternalParameter, getBooleanInternalParameterOrTrue, getInternalParameterValue
-
Methods inherited from interface jetbrains.buildServer.serverSide.ReadOnlyUserParameters
getParameter, getParameters, getParametersCollection, getParameterValue
-
-
-
-
Field Detail
-
MAX_BRANCH_NAME_LENGTH
static final int MAX_BRANCH_NAME_LENGTH
Holds the maximum branch name length.- Since:
- 7.1
- See Also:
BuildPromotion.setDesiredBranchName(String), Constant Field Values
-
MAIN_NODE_MARKER
static final String MAIN_NODE_MARKER
- See Also:
- Constant Field Values
-
-
Method Detail
-
findTops
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.- Specified by:
findTopsin interfaceBuildPromotion- Returns:
- see above
-
traverseDependedOnMe
void traverseDependedOnMe(@NotNull DependencyConsumer<BuildPromotionEx> consumer)Traverses all build promotions depending on this one transitively. If processor returns false, traversing stops.- Parameters:
consumer-- Since:
- 2018.1.3
-
traverseSelfAndDependedOnMe
void traverseSelfAndDependedOnMe(@NotNull DependencyConsumer<BuildPromotionEx> consumer)
-
traverseDependencies
void traverseDependencies(@NotNull DependencyConsumer<BuildPromotionEx> consumer)Traverses all build promotion dependencies (breadth first). If processor returns false, traversing stops.- Parameters:
consumer-- Since:
- 2018.1.3
-
traverseSelfAndDependencies
void traverseSelfAndDependencies(@NotNull DependencyConsumer<BuildPromotionEx> consumer)
-
findSelfOrDependencyWithProblem
@Nullable BuildPromotionEx findSelfOrDependencyWithProblem(@NotNull Predicate<BuildProblemData> predicate)
Traverses build problems of the current build promotion and all of its dependencies using breadth first search and returns the first one for which the supplied predicate returns true- Parameters:
predicate- predicate to apply- Returns:
- found dependency or null
- Since:
- 2024.07
-
setBuildRevisions
void setBuildRevisions(@NotNull Collection<BuildRevisionEx> revisions, long maxModificationId, long chainModificationId)Same assetBuildRevisions(Collection, long, long, boolean)with validateBranch parameter set to true.
-
setBuildRevisions
void setBuildRevisions(@NotNull Collection<BuildRevisionEx> revisions, long maxModificationId, long chainModificationId, boolean validateBranch)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- Since:
- 2023.11
- See Also:
BuildPromotion.getRevisions(),BuildPromotion.getLastModificationId()
-
resetBuildRevisions
void resetBuildRevisions()
-
getChainModificationId
@Nullable Long getChainModificationId()
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
-
getPersonalChangeId
Long getPersonalChangeId()
Returns personal change id associated with this build promotion. If promotion is not personal (isPersonal == false), returns null.- Returns:
- see above
- Since:
- 2019.2
-
hasCustomPatch
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
- Since:
- 2021.1
-
getCustomParametersCollection
@NotNull Collection<Parameter> getCustomParametersCollection()
Returns a collection of user-defined build and configuration parameters associated with this build promotion.- Returns:
- see above
- Since:
- 2023.05
-
setCustomParameters
void setCustomParameters(@NotNull Map<String,String> parameters)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:
parameters- custom parameters- Since:
- 6.5
-
setCustomParameters
void setCustomParameters(@NotNull Collection<Parameter> parameters)Same as#setCustomParameters(List)but acceptingParameterinstances- Since:
- 2021.1
-
setAssociatedBuild
void setAssociatedBuild(@Nullable SBuild build)Associates new build to this build promotion
-
addDependency
void addDependency(@NotNull BuildPromotionEx promo, @NotNull DependencyOptions options) throws IllegalArgumentExceptionAdds a build dependency- Parameters:
promo- the Build Promotion we're depending upon- Throws:
IllegalArgumentException- when dependency to the same build configuration is added
-
removeDependency
void removeDependency(@NotNull BuildPromotionEx promo)Removes dependency on specified promotion- Parameters:
promo-
-
replaceDependency
void replaceDependency(@NotNull BuildPromotionEx origDependency, @NotNull BuildPromotionEx newDependency, @NotNull DependencyOptions newOptions)Replaces dependency on one promotion with dependency to another promotion- Parameters:
origDependency- original promotionnewDependency- replacement
-
getBuildType
@Nullable 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.
- Specified by:
getBuildTypein interfaceBuildPromotion- Returns:
- the correspondent build configuration or null if that was deleted.
-
getParentBuildType
@Nullable 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- Specified by:
getParentBuildTypein interfaceBuildPromotion- Returns:
- see above
-
getParametersProvider
@NotNull ParametersProvider getParametersProvider()
Creates and returns a parameters provider, that provides with all parameters of this build and buidls this one depends on.
-
getDependencies
@NotNull Collection<BuildDependencyEx> getDependencies()
Description copied from interface:BuildPromotionReturns the direct snapshot dependencies of this build promotion filtered according to current user permissions.- Specified by:
getDependenciesin interfaceBuildPromotion- Returns:
- see above
-
hasDependencyOn
boolean hasDependencyOn(long id)
-
getDependedOnMe
@NotNull 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.- Specified by:
getDependedOnMein interfaceBuildPromotion- Returns:
- see above
-
getDependedOnMeIds
@NotNull Collection<Long> getDependedOnMeIds()
-
getDependenciesIds
@NotNull Collection<Long> getDependenciesIds()
-
getDependencyGraph
@NotNull BuildDependencyGraph getDependencyGraph()
Returns dependency graph as if this build promotion is the top of the graph. See alsofindTops()- Returns:
- graph with this promotion at the top
-
getTopDependencyGraph
@NotNull TopBuildDependencyGraph getTopDependencyGraph()
Returns topmost dependency graph- Returns:
- see above
-
isChangeCollectingNeeded
boolean isChangeCollectingNeeded()
Return true if change collection is required for this build promotion (otherwise, changes are collected already).- Returns:
- see above
-
isChangeCollectingNeeded
boolean isChangeCollectingNeeded(boolean checkDependencies)
- Parameters:
checkDependencies-- Returns:
- same as
isChangeCollectingNeeded()but can also check dependencies
-
markIncomplete
void markIncomplete()
Mark build promotion as incomplete (canceled)
-
markAsIncompleteIfHasFailedToStartProblems
void markAsIncompleteIfHasFailedToStartProblems()
Marks build promotion as incomplete if it has failed to start build problems
-
isIncomplete
boolean isIncomplete()
Returns whether the build promotion is incomplete (canceled). Method is efficient enough, can be called often.- Returns:
- true iff is incomplete
-
markDeleted
void markDeleted() throws IllegalStateExceptionMark 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
boolean isDeleted()
- Returns:
- true if promotion is marked as deleted
-
isPersisted
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
- Since:
- 2019.1
-
hasStartedParent
boolean hasStartedParent()
Returns true if there exists started build which has reference to this promotion- Returns:
- see above
-
persist
void persist()
Persists state of the build promotion
-
persist
void persist(BuildPromotionEx.PromotionPersistMode persistMode)
-
clearPrevPromotionCache
void clearPrevPromotionCache(@Nullable Collection<BuildPromotion> targetPromos)
-
copy
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.- Specified by:
copyin interfaceBuildPromotion- Parameters:
copyRevisions- indicates whether to copy revisions associated with this promotion or not- Returns:
- copy of this build promotion
-
getSequenceBuild
@Nullable SBuild getSequenceBuild()
- See Also:
BuildPromotionOwner.getSequenceBuild()
-
getStartedEquivalentPromotions
@NotNull List<BuildPromotionEx> getStartedEquivalentPromotions(int maxNumToProcess)
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 List<BuildPromotionEx> getEquivalentPromotions(@NotNull List<BuildPromotionEx> queuedBuilds)
Returns build promotions from the build queue equivalent to this build promotion (same settings, changes and revisions)- Returns:
- see above
- Since:
- 2023.11
-
isChangesCollectingInProgress
boolean isChangesCollectingInProgress()
-
waitForChangesCollectingToFinish
void waitForChangesCollectingToFinish(long timeoutMillis) throws InterruptedException, ExecutionException, TimeoutException, CancellationExceptionIf 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- Since:
- 2024.03
-
lockDependenciesOptimizing
void lockDependenciesOptimizing()
-
unlockDependenciesOptimizing
void unlockDependenciesOptimizing()
-
addDependedOnMe
void addDependedOnMe(@NotNull BuildPromotionEx promoEx, @NotNull DependencyOptions options)Adds link to parent promotion- Parameters:
promoEx-
-
addDependedOnMeIfCached
void addDependedOnMeIfCached(@NotNull BuildPromotionEx promotion, @NotNull DependencyOptions options)Adds link to parent promotion only if depended on me list is already loaded from DB for this promotion- Since:
- 2021.2
-
removeDependedOnMe
void removeDependedOnMe(@NotNull BuildPromotion promoEx)Removes link to parent promotion- Parameters:
promoEx-
-
getQueuedBuild
QueuedBuildEx getQueuedBuild()
Description copied from interface:BuildPromotionReturns queued build associated with this promotion or null if there is no such build in the queue- Specified by:
getQueuedBuildin interfaceBuildPromotion- Returns:
- see above
-
getCollectChangesError
@Nullable String getCollectChangesError()
-
setFailedToCollectChanges
void setFailedToCollectChanges(@Nullable Throwable t)
-
setFinalArtifactDependencies
void setFinalArtifactDependencies(@NotNull List<SArtifactDependency> dependencies)Sets the final artifact dependencies, i.e. those which must be sent to an agent.- Parameters:
dependencies- the artifact dependencies- Since:
- 5.0
-
setCustomArtifactDependencies
void setCustomArtifactDependencies(@NotNull List<SArtifactDependency> dependencies)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- Since:
- 5.0
-
getCustomArtifactDependencies
@NotNull List<SArtifactDependency> getCustomArtifactDependencies()
-
getFinalArtifactDependencies
@NotNull List<SArtifactDependency> getFinalArtifactDependencies()
-
setOverridenVcsRoots
void setOverridenVcsRoots(@NotNull Map<VcsRootInstance,VcsRootInstance> overridenVcsRootIds) throws InvalidOverridenRootsExceptionOverride default vcs roots for this promotion.- Parameters:
overridenVcsRootIds- map from original vcs root id to substitution root id- Throws:
InvalidOverridenRootsException- Since:
- 6.5
-
getOverridenVcsRoots
@NotNull Map<VcsRootInstance,VcsRootInstance> getOverridenVcsRoots()
Get overriden vcs root map in this promotion.- Returns:
- map from original vcs root id to substitution root id
- Since:
- 6.5
-
setAttribute
void setAttribute(@NotNull String name, @Nullable Object value)Sets some attribute to the build promotion- Parameters:
name- attribute namevalue- attribute value
-
getAttributes
@NotNull Map<String,Object> getAttributes()
- Returns:
- map of arbitrary options associated with this promotion.
-
detachChanges
void detachChanges()
Marks build as build with detached changes, i.e. changes of this build will be shown in the next build too.
-
resetAgentsCompatibilityCache
void resetAgentsCompatibilityCache()
Resets promotion compatibility cache for all agents and agent types
-
updateAgentsCompatibilityCache
void updateAgentsCompatibilityCache(@NotNull Collection<SBuildAgent> agents, @NotNull BuildPromotionEx.CompatibilityCacheUpdateMode cacheUpdateMode)
-
resetIncompatibleAgentsCache
void resetIncompatibleAgentsCache(@Nullable Predicate<CompatibilityResult> compatibilityPredicate)
-
resetRequirementsCache
void resetRequirementsCache()
-
resetAllCompatibilityCaches
void resetAllCompatibilityCaches()
-
resetIncompatibleAgentTypesCache
void resetIncompatibleAgentTypesCache(@Nullable Predicate<CompatibilityResult> compatibilityPredicate)
-
getCanRunOnAgentTypes
@NotNull Collection<SAgentType> getCanRunOnAgentTypes(@NotNull Collection<SAgentType> available)
-
getCompatibleAgentTypes
@NotNull Collection<SAgentType> getCompatibleAgentTypes(@NotNull Collection<SAgentType> available)
-
getAgentTypeCompatibilityMap
@NotNull Map<SAgentType,CompatibilityResult> getAgentTypeCompatibilityMap(@NotNull Collection<SAgentType> available)
Returns map of agent types to compatibility result. Note: can return empty map if the current build promotion is marked for deletion or its build configuration no longer exists.- Parameters:
available-- Returns:
-
getCheckoutDirectory
@Nullable String getCheckoutDirectory()
-
getDefaultCheckoutDirectory
@NotNull 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. Don't acceptBuildTypeDescriptor.CheckoutType.AUTO, throwingIllegalArgumentExceptionif it's passed.
-
getRealOrDummyBuild
@NotNull SBuild getRealOrDummyBuild()
-
addBuildProblem
void addBuildProblem(@NotNull BuildProblemData buildProblem)Adds build problem, currently it actually causes build failure- Since:
- 7.1
-
getFailureReasons
@NotNull List<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 fast- Since:
- 7.1
-
getBuildProblems
@NotNull List<BuildProblem> getBuildProblems()
Returns all build problems for this promotion with extended information about muting. The problems are sorted in order of their appearance.- Returns:
- see above
- Since:
- 7.1
-
getUnsortedBuildProblems
@NotNull Collection<BuildProblem> getUnsortedBuildProblems()
Same asgetBuildProblems()but returns problems in any order and can work faster because of that.- Returns:
- build problems in no particular order
- Since:
- 2020.1
-
getBuildChainProblems
@NotNull 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). 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
- Since:
- 2017.2
-
hasBuildProblemsOfType
boolean hasBuildProblemsOfType(@NotNull String type)- Returns:
- true if there are build problems with specified type
-
hasFailureReasons
boolean hasFailureReasons()
-
muteBuildProblems
void muteBuildProblems(boolean muteIfTrue, @Nullable SUser user, @Nullable String comment)Makes all existing build problems enabled or disabled- Parameters:
muteIfTrue- pass true to make build successful, false to make existing problems visible again- Since:
- 7.1
-
deleteBuildProblem
void deleteBuildProblem(@NotNull String identity)Deletes build problem Deleting build problem may change build status to SUCCESS- Parameters:
identity- identiry of build problem to be removed- Since:
- 7.1
-
updateStateFromBuildData
void updateStateFromBuildData(@NotNull AbstractBuildData runningBuildData)Quickly updates some information in build promotion from DB information. Doesn't store anything back to DB- Parameters:
runningBuildData-
-
updateFromDB
void updateFromDB(@NotNull BuildPromotionEx.UpdateReason reason)Updates promotion data from database
-
updateSelfAndDependenciesFromDB
void updateSelfAndDependenciesFromDB()
Updates the build promotion and all its dependencies from the database
-
initBuildProblems
void initBuildProblems()
Init build problems from database
-
getDetectedChanges
@NotNull List<ChangeDescriptor> getDetectedChanges(@NotNull SelectPrevBuildPolicy prevBuildPolicy)
-
getDetectedChanges
@NotNull List<ChangeDescriptor> getDetectedChanges(@NotNull SelectPrevBuildPolicy prevBuildPolicy, @Nullable Boolean includeDependencyChanges)
-
getDetectedChanges
@NotNull List<ChangeDescriptor> getDetectedChanges(@NotNull SelectPrevBuildPolicy prevBuildPolicy, @Nullable Boolean includeDependencyChanges, @NotNull VcsModificationProcessor callback)
-
fillDetectedChanges
void fillDetectedChanges(@NotNull List<ChangeDescriptor> accumulator, @NotNull SelectPrevBuildPolicy prevBuildPolicy, @Nullable Boolean includeDependencyChanges, @NotNull VcsModificationProcessor callback)- Parameters:
accumulator- collection to add changes to, according to 'prevBuildPolicy' and 'includeDependencyChanges' options. Changes included are guaranteed to be at or _more_ than defined by the cut-off point in 'callback'prevBuildPolicy-includeDependencyChanges-callback- allows to define changes iteration cut-off logic
-
getDetectedChanges
@NotNull List<ChangeDescriptor> getDetectedChanges(@NotNull ChangesCalculationOptionsEx options)
Returns changes according to the specified options- Parameters:
options- changes calculation options- Returns:
- see above
-
fillDetectedChanges
void fillDetectedChanges(@NotNull List<ChangeDescriptor> accumulator, @NotNull ChangesCalculationOptionsEx options)Computes changes according to the specified options and add them to the given accumulator- Parameters:
accumulator- accumulator for changesoptions- changes calculation options
-
hasComputedChanges
boolean hasComputedChanges(@NotNull SelectPrevBuildPolicy policy, @NotNull VcsModificationProcessor callback)
-
getPersonalChanges
@NotNull List<ChangeDescriptor> getPersonalChanges(@NotNull List<ChangeDescriptor> allChanges)
Takes all changes and returns only those that belong to current owner of build promotion. Returns empty list of build promotion is not personal.- Parameters:
allChanges-- Returns:
-
getChanges
@NotNull List<SVcsModification> getChanges(@NotNull SelectPrevBuildPolicy policy, boolean returnChangesIfNoPreviousBuild, @NotNull VcsModificationProcessor callback)
-
getOwnChanges
@NotNull List<SVcsModification> getOwnChanges(@NotNull ChangesCalculationOptions options)
Returns changes in this promotion computed according to specified options, doesn't include changes from dependencies.- Parameters:
options- changes calculation options- Returns:
- see above
-
getLimitedChanges
@NotNull LimitedChangesCollection getLimitedChanges(@NotNull SelectPrevBuildPolicy policy, int limit)
-
getDetectedChangesProviders
@NotNull List<BuildDetectedChangesProvider> getDetectedChangesProviders(@NotNull SelectPrevBuildPolicy prevBuildPolicy, @Nullable Boolean includeDependencyChanges)
- Parameters:
prevBuildPolicy- previous build policyincludeDependencyChanges- whether to include- Returns:
- list of detected changes provides. Change provider returns changes associated with build promotion. With help of this method one can retrieve changes from some providers only.
- Since:
- 7.1.1
-
getRevisionsMap
@NotNull Map<VcsRootInstance,BuildRevision> getRevisionsMap()
-
getAllRevisionsMap
@NotNull Map<VcsRootInstance,BuildRevisionEx> getAllRevisionsMap()
Returns all vcs root revisions assciated with build, not only regular vcs roots attached to the build configurations.- Returns:
- see above
- Since:
- 8.0
-
getUpperLimitRevisions
@NotNull Map<VcsRootInstance,BuildRevisionEx> getUpperLimitRevisions()
Returns upper limit revisions which were available when checking for changes operation was performed. Upper limit revision is a revision returned byVcsRootInstance.getCurrentRevision()method at the moment when checking for changes was performed.- Since:
- 2023.11
-
getInternalBranchName
@NotNull 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 String getAutogeneratedBranchName()
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
-
sameBranch
boolean sameBranch(@NotNull BuildPromotionEx promotion)- Parameters:
promotion-- Returns:
- true if this promotion is from the same branch as promotion specified in parameter.
-
resetChangesCache
void resetChangesCache()
Resets cache of changes in this promotion
-
getAuditLogActions
@NotNull 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 AuditLog getAuditLog()
- Returns:
- audit log which can be used to log user actions for this build promotion
-
resetLogActionsCache
void resetLogActionsCache()
Reset cached audit log
-
resetTagsCache
void resetTagsCache()
Reset cached tags
-
getAgentCompatibility
@NotNull CompatibilityResult getAgentCompatibility(@NotNull AgentDescription agentDescription)
- Parameters:
agentDescription- agent or agent type- Returns:
- compatibility of this build promotion with specified agent description (agent or agent type)
-
getBuildSettings
@NotNull BuildSettings getBuildSettings() throws BuildTypeNotFoundException
Returns settings specified tofreezeSettings(BuildTypeEx, String)method or settings of this buildType this promotion belongs to iffreezeSettings(BuildTypeEx, String)wasn't called- Specified by:
getBuildSettingsin interfaceBuildPromotion- Throws:
BuildTypeNotFoundException- if build type not exist anymore- Since:
- 8.0
-
updateDependenciesCache
void updateDependenciesCache(@NotNull Supplier<Map<Long,Integer>> newDependenciesSupplier)Updates dependencies cache of the promotion and resets "dependent on me" cache of the supplied dependencies.
-
resetDependenciesHardRefs
void resetDependenciesHardRefs()
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.
-
getSettingsDigest
@NotNull byte[] getSettingsDigest(boolean compute)
Returns digest of build promotion settings. If build promotion has build, then digest will be taken from the build artifacts. If there is no digest in artifacts, it will be computed by current settings if compute is set to true. Digest is always computed if build promotion does not have build associated. Returns empty array if digest cannot be computed or build does not have digest and compute is set to false- Parameters:
compute- if true and build promotion has build without digest, then digest will be calculated
-
getArtifactStateInfo
@NotNull BuildPromotionEx.ArtifactsStateInfo getArtifactStateInfo()
- Returns:
- state of the artifacts directory of this build promotion.
-
hasComputedArtifactsState
boolean hasComputedArtifactsState()
-
getArtifacts
@NotNull BuildArtifacts getArtifacts(@NotNull BuildArtifactsViewMode mode)
Returns artifacts of this build promotion.- Parameters:
mode- artifacts view mode- Returns:
- object describing artifacts of this build promotion.
-
artifactsChanged
void artifactsChanged(boolean scheduleUpdate)
Should be called when artifacts are changed on disk.- Parameters:
scheduleUpdate- if true, a task should be scheduled to update artifacts state
-
hasUnpublishedPromotionPersistingEvent
boolean hasUnpublishedPromotionPersistingEvent()
- Returns:
- true if "promotion persisted" event for this build promotion is not yet stored in DB
-
resetArtifactsState
void resetArtifactsState(boolean scheduleUpdate)
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 whengetArtifactStateInfo()is called
-
setQueuedAt
void setQueuedAt(Date queuedAt)
-
setRemoveFromQueueDate
void setRemoveFromQueueDate(@Nullable Date removeFromQueueDate)
-
resetBuildLog
void resetBuildLog()
-
buildFinished
void buildFinished()
Must be called when build history entry created for this promotion.
-
buildEvictedFromCache
void buildEvictedFromCache()
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.
-
freezeSettings
void freezeSettings() throws IOExceptionFreeze buildType settings for this promotion. After call to this method a promotion will use frozen buildType settings instead of current ones.- Throws:
IOException- when freeze fails
-
freezeSettings
void freezeSettings(@NotNull BuildTypeEx buildType, @NotNull String settingsOrigin) throws IOExceptionFreeze 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- Throws:
IOException- when freeze fails
-
freezeSettings
void freezeSettings(@NotNull BuildTypeSettingsEx settings, @NotNull String settingsOrigin) throws IOExceptionFreeze 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- Throws:
IOException- when freeze fails
-
freezeSettingsWithForcedPostprocessing
void freezeSettingsWithForcedPostprocessing(@NotNull BuildTypeSettingsEx settings, String origin) throws IOExceptionFreeze 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- Throws:
IOException- when freeze fails
-
freezeSettings
void freezeSettings(@NotNull File settings, @NotNull String settingsOrigin) throws IOExceptionFreeze 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
void setFreezeSettings(@Nullable Boolean freezeSettings)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 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 defaults- Returns:
- see above
-
getFrozenSettingsFile
@NotNull File getFrozenSettingsFile()
- Returns:
- path to file with frozen settings.
-
hasFrozenSettings
boolean hasFrozenSettings()
- Returns:
- true if settings of this promotion were frozen.
-
hasFrozenSettingsFromVcs
boolean hasFrozenSettingsFromVcs()
- Returns:
- true if this promotion has frozen settins from VCS
-
needToFreezeSettings
boolean needToFreezeSettings()
- Returns:
- true if there was no attempt to freeze settings (successful or failed)
- Since:
- 2021.1
-
scheduleCheckingForChangesIfNeeded
boolean scheduleCheckingForChangesIfNeeded()
- Returns:
- true if checking for changes was scheduled and false if it was not, because build promotion has changes collected already
-
cancelCheckingForChanges
void cancelCheckingForChanges()
-
getVcsRootEntries
@NotNull List<VcsRootInstanceEntry> getVcsRootEntries(boolean includeSettingsRoot)
Returns 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
- Since:
- 9.1
- See Also:
BuildTypeEx.getVcsRootInstanceEntries(boolean)
-
getRequirements
@NotNull List<Requirement> getRequirements()
Returns requirements configured for this build promotion. If a requirement has a parameter reference in it's settings, this parameter reference will be resolved according to current promotion settings. Only enabled requirements are returned by this method.- Returns:
- see above
- Since:
- 2018.1
-
getRunnersRequirements
@NotNull List<Requirement> getRunnersRequirements(@NotNull SBuildStepsCollection buildSteps)
Returns requirements exposed by runners.- Parameters:
buildSteps-- Returns:
-
getBuildFeaturesRequirements
@NotNull List<Requirement> getBuildFeaturesRequirements()
Returns requirements coming by build features, resolved- Returns:
- see above
- Since:
- 2019.1
-
getBuildLog
@NotNull BuildLogEx getBuildLog()
- Specified by:
getBuildLogin interfaceBuildPromotion- Returns:
- Log for operations which could occur before build start, like changes collecting or logging detailed triggering information.
-
getBuildLogIfInitialized
@Nullable BuildLogEx getBuildLogIfInitialized()
-
createOrderedBuild
@NotNull OrderedBuild createOrderedBuild()
Returns an OrderedBuild with all fields filled. The OrderedBuild contains a consistent snapshot of the promotion properties, ie. no one modified promotion during OrderedBuild creation.- Returns:
- see above
-
hasLoadedTags
boolean hasLoadedTags()
Returns true if promotion loaded information about tags from db- Returns:
- see above
-
isEquivalentTo
@NotNull 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
- Since:
- 2019.1
-
setArtifactsDirectory
void setArtifactsDirectory(@NotNull File artifactsDir)Sets new artifacts directory to this build promotion. This method also persists new artifacts directory in database, not additional call topersist()is required.- Parameters:
artifactsDir- new artifacts directory- Since:
- 10.0
-
isFinished
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.
- Since:
- 10.0
-
getProjectPathIds
@NotNull List<String> getProjectPathIds()
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.- Since:
- 10.0
-
getOwnerNodeUrl
@Nullable String getOwnerNodeUrl()
Returns url of the node which processes this build messages. Returns null if this build promotion is not assigned to any node. ReturnsMAIN_NODE_MARKERif build promotion was specifically assigned to main node.
-
getOwnerNode
@Nullable 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
void setOwnerNodeUrl(@Nullable String url)Sets url of the node which processes this build messages.- Parameters:
url-
-
getPreviousBuilds
@NotNull Stream<OrderedBuild> getPreviousBuilds(@NotNull Filter<String> branchFilter)
Returns stream of previous builds matched by specified branch filter and ordered by changes- Parameters:
branchFilter- filter of interest- Returns:
- see above
-
containsChange
boolean containsChange(@NotNull SVcsModification m)Returns true if promotion contains specified modification among its changes. Takes only own changes into account (does not use changes from dependencies).- Parameters:
m- modification of interest- Returns:
- see above
- Since:
- 10.0.3
-
allDependenciesFinished
boolean allDependenciesFinished()
- Returns:
- true if all direct dependencies of this build promotion are finished
-
getDependentCompositePromotions
@NotNull List<BuildPromotionEx> getDependentCompositePromotions()
- Returns:
- list of all composite promotions depending on this build promotion either directly or transitively
-
getSettingsVcsRootInstance
@Nullable VcsRootInstance getSettingsVcsRootInstance()
- Returns:
- settings VCS root associated with this promotion
- Since:
- 2019.1
-
decreaseExpirationCounter
int decreaseExpirationCounter(int decreaseAmount)
-
setExpirationCounter
void setExpirationCounter(int counter)
-
isAssociatedBuildFinished
boolean isAssociatedBuildFinished()
-
associatedBuildFinished
void associatedBuildFinished()
-
isForcedPostprocessingOfFrozenSettings
boolean isForcedPostprocessingOfFrozenSettings()
- Returns:
- true if settings post processing is required even if settings are already marked as frozen
-
resetBuildSettings
void resetBuildSettings()
Resets cached build settings associated with promotion- Since:
- 2019.1
-
hasArtifactDependencyOn
boolean hasArtifactDependencyOn(@NotNull BuildPromotion dependencyBuild)Checks if this promotion artifact-depends on the passed one. Especially useful for queued and running builds- Since:
- 2019.1
-
getBuildPromotionsWithArtifactDependenciesOnMe
@NotNull List<BuildPromotion> getBuildPromotionsWithArtifactDependenciesOnMe(@NotNull 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.- Parameters:
buildPromotions- build promotions to check- Returns:
- the dependent build promotions
- Since:
- 2024.07
-
isAgentLessBuild
boolean isAgentLessBuild()
Does it build cannot be executed on any usual agent but only by some external proccess.- Specified by:
isAgentLessBuildin interfaceBuildPromotionInfo- Returns:
- true if the build cannot be executed on any usual agent; false - if the build can be executed on usual agent
- Since:
- 2019.2
-
getPreviousOrderedBuild
@Nullable OrderedBuild getPreviousOrderedBuild(@NotNull SelectPrevBuildPolicy policy)
Returns previous OrderedBuild instance which corresponds to a build promotion which is created before this one and corresponding to the specified policy.- Parameters:
policy- policy- Returns:
- see above
-
persistVcsRootEntries
void persistVcsRootEntries()
Persists information about VCS roots used by this build promotion to the database.
-
persistDependencies
void persistDependencies()
-
getExecutionTimeoutMin
int getExecutionTimeoutMin()
Returns build execution timeout in minutes, 0 indicates that there is no limit
-
isDetachedFromAgent
boolean isDetachedFromAgent()
- Returns:
- true if the corresponding build was detached from agent at some point and became agentless
- Since:
- 2020.2
-
getDetachedFromAgentDate
@Nullable Date getDetachedFromAgentDate()
- Returns:
- date when this build was fully detched from agent or null
- Since:
- 2020.2
-
getPromotionCustomization
@NotNull PromotionCustomizationInfo getPromotionCustomization()
Returns promotion customization details, if any Build promotion can be customized by pressing ... near "Run" button in the configuration. The customization may include revisions, dependencies, custom parameters. Personal builds are marked as customized only if other some build parameters differ from typical one.- Returns:
- see above
- Since:
- 2020.2
-
getCommitters
@NotNull Set<SUser> getCommitters(@NotNull SelectPrevBuildPolicy selectPrevBuildPolicy, int maxChangesToProcess)
Same asBuildPromotion.getCommitters(SelectPrevBuildPolicy)but allows to control number of changes which should be looked up when committers are computed.- Parameters:
selectPrevBuildPolicy- policy for selecting a previous buildmaxChangesToProcess- max number of changes in build to look up, -1 indicates no limit- Returns:
- committers from builds changes
- Since:
- 2020.2.3
-
createBuildPromotionAccessChecker
@NotNull Predicate<BuildPromotion> createBuildPromotionAccessChecker()
-
getDependenciesSupplier
@NotNull DependenciesSupplier getDependenciesSupplier()
Creates a dependencies supplier from the snapshot dependencies of this build promotion.- Returns:
- see above
- Since:
- 2022.04
-
getMaximumNumberOfBuildsPerBranch
int getMaximumNumberOfBuildsPerBranch() throws BuildTypeNotFoundException- Returns:
- see
BuildTypeOptions.BT_MAX_RUNNING_BUILDS_PER_BRANCH - Throws:
BuildTypeNotFoundException- if build configuration of this build promotion no longer exists- Since:
- 2022.04
-
isMaximumNumberOfBuildsPerBranchLimited
boolean isMaximumNumberOfBuildsPerBranchLimited()
- Returns:
- true if number of builds per branch is limited, see
BuildTypeOptions.BT_MAX_RUNNING_BUILDS_PER_BRANCH - Since:
- 2022.04
-
resetDirectDependenciesCache
void resetDirectDependenciesCache()
reset only direct dependencies cache of the promotion.- Since:
- 2022.10
-
resetDependentOnMeCache
void resetDependentOnMeCache()
reset only dependent on this cache of the promotion.- Since:
- 2022.10
-
ensureBuildLogFlushed
void ensureBuildLogFlushed()
Makes sure that messages in the build log buffer are flushed on disk.
-
generateAgentAccessCode
String generateAgentAccessCode()
Generates agent access code for communication with TeamCity during build
-
setProvidedUpperLimitRevisions
void setProvidedUpperLimitRevisions(@NotNull Map<Long,RepositoryVersion> upperLimitRevisions) throws IllegalArgumentExceptionSets custom/provided upper limit revisions which will be used during the checking for changes process instead of the current repository version.- Parameters:
upperLimitRevisions- map of VCS root instance id to revision object, vcs root instance can belong to the current build or its dependencies- Throws:
IllegalArgumentException- if provided VCS branch name or revision is too long (longer than 1000 characters)- Since:
- 2024.07
-
getProvidedUpperLimitRevisions
@NotNull Map<Long,RepositoryVersion> getProvidedUpperLimitRevisions()
- Returns:
- map of provided upper limit revisions for the checking for changes process
- Since:
- 2024.07
-
getVersionedSettingsRevision
@Nullable String getVersionedSettingsRevision(@NotNull VcsRootInstance vcsRoot)
Returns a revision of versioned settings for the given VCS root instance or null if such a revision does not exist.- Parameters:
vcsRoot-- Returns:
- see above
- Since:
- 2024.07
-
setVersionedSettingsRevision
void setVersionedSettingsRevision(@NotNull VcsRootInstance vcsRoot, @NotNull String revision)Remmebers versioned settings revision for the specified VCS root. Note: persist must be called explicitly for the information to be saved into the database. See alsogetVersionedSettingsRevision(VcsRootInstance).- Parameters:
vcsRoot-revision-- Since:
- 2024.07
-
getAnchorBuildPromotion
@Nullable BuildPromotionEx getAnchorBuildPromotion()
For the build promotion which runs in a virtual build configuration returns a build promotion which created it. The anchor build promotion is visible to the user and collects all the results of the virtual build promotions.- Returns:
- see above
- Since:
- 2024.07
-
isVirtual
boolean isVirtual()
- Returns:
- true if the build promotion is running in a virtual build configuration
- Since:
- 2024.07
-
occupiesLicenseSlot
boolean occupiesLicenseSlot()
Returns true when this build promotion should occupy one of license slots, false otherwise. Currently, the number of license slots is equal to the max number of authorized agents.- Returns:
- see above
- Since:
- 2024.12
- See Also:
LicensingPolicy.getMaxNumberOfAuthorizedAgents()
-
-