Class BuildCustomizerImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.BuildCustomizerImpl
-
- All Implemented Interfaces:
BuildCustomizer,BuildCustomizerEx
public class BuildCustomizerImpl extends Object implements BuildCustomizerEx
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classBuildCustomizerImpl.AutoMaxModificationIdStrategy-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.BuildCustomizerEx
BuildCustomizerEx.RebuildDependenciesMode, BuildCustomizerEx.UpToModificationMode, BuildCustomizerEx.UpToModificationSelectionMode
-
-
Constructor Summary
Constructors Constructor Description BuildCustomizerImpl(SBuildType buildType, SUser userWhoPerformsAction, BuildChainFactory buildChainFactory, VcsModificationHistory vcsModificationHistory, SecurityContextEx securityContext, Collection<BuildCustomizerExtension> customizerExtensions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParametersIfAbsent(List<Parameter> customParams)Same asBuildCustomizer.addParametersIfAbsent(Map)but acceptingParameterinstancesvoidaddParametersIfAbsent(Map<String,String> customParams)Same asBuildCustomizer.setParameters(Map)but doesn't overwrite parameters that have been set usingBuildCustomizer.setParameters(Map)before.voidaddParametersIfAbsent(Map<String,String> params, boolean passToDependencies)Add parameters which should be passed to the build and probably to its dependencies, toovoidaddSkippedDependencies(Collection<String> externalBuildTypeIds)BuildPromotionExcreatePromotion()Creates build promotion with all custom settings.SBuildTypegetBuildType()SUsergetCurrentUser()Map<String,Parameter>getCustomParameters()StringgetDesiredBranchName()voidsetAddToFavorites(boolean addToFavorites)Control whether build will be added to favorite or not Overrides StandardProperties.ADD_TRIGGERED_BUILD_TO_FAVORITESvoidsetApplyCleanSourcesToDependencies(boolean apply)If apply is true, then applies clean sources configuration to all of the snapshot dependencies.voidsetApplyTagsToDependencies(boolean value)Marks if tags should be applied to all builds that this build snapshot depends onvoidsetArtifactDependencies(List<SArtifactDependency> customDependencies)Sets custom artifact dependencies to the build.voidsetAttributes(Map<String,String> attributes)Sets custom attributes to the buildvoidsetBuildComment(String buildComment)Sets comment to the build.voidsetBuildPromotionInitializer(Consumer<BuildPromotionEx> initializer)Sets an initializer which accepts a newly created build promotion and does some initialization work there, for instance, it can set some specific settings.voidsetChangesCollectorFactory(VcsChangesCollectorFactory changesCollectorFactory)voidsetChangesUpTo(SVcsModification modification)Specifies the last change to include in this build.voidsetCleanSources(boolean cleanSources)If cleanSources is true the build will re-checkout all the sources on agent (note: this setting does not affect snapshot dependencies anyhow).voidsetDependenciesSupplier(DependenciesSupplier supplier)Sets a custom dependencies supplier which should be used when a build promotion is created.voidsetDesiredBranchName(String branchName)Sets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).voidsetDesiredBranchName(String branchName, boolean defaultBranchFallback)Sets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).voidsetFreezeSettings(Boolean freezeSettings)voidsetNodeRevisions(String buildTypeId, long modId, long chainModId, Collection<BuildRevisionEx> revisions)Sets revision information to node of the build chain which corresponds to specified build configuration internal idvoidsetParameters(List<Parameter> customParams)Same asBuildCustomizerEx.setParameters(List)but acceptingParameterinstancesvoidsetParameters(Map<String,String> customParams)Sets custom parameters to the build, custom parameters will overwrite default parameters inherited from build configuration.voidsetPersonal(boolean personal)If personal is true the personal build will be created with owner set to user who performs the action.voidsetPersonalChangeId(long changeId)Sets id of a personal patch should be associated with the personal build.voidsetPromotedBuild(SBuild promotedBuild, Predicate<RevisionRule> artifDependencyRevisionPredicate)Promotes build into dependencies of the build created by this build customizer.voidsetProvidedUpperLimitRevisions(Map<Long,RepositoryVersion> upperLimitRevisions)Sets upper limit revisions map as "provided" upper limit revisions: they will be used instead of the current revision during the checking for changes processvoidsetRebuildDependencies(boolean rebuild)Sets whether all snapshot dependencies must be rebuild or not.voidsetRebuildDependencies(Collection<String> buildTypeIds)Specifies collection of build configurations where builds cannot be reused.voidsetRebuildDependencies(BuildCustomizerEx.RebuildDependenciesMode mode)Sets rebuild dependencies mode, seeBuildCustomizerEx.RebuildDependenciesMode.voidsetScheduledTime(ZonedDateTime scheduledTime)Allows to force the build to wait in the queue until some time in the futurevoidsetSnapshotDependencyNodes(Collection<BuildPromotion> promotions)Sets custom nodes for the snapshot dependency graph.voidsetStickToRevisions(boolean stickToRevisions)voidsetTagDatas(Set<TagData> tags)Sets build tagsvoidsetUpToModificationSelectionMode(BuildCustomizerEx.UpToModificationSelectionMode upToModificationSelectionMode)
-
-
-
Constructor Detail
-
BuildCustomizerImpl
public BuildCustomizerImpl(@NotNull SBuildType buildType, @Nullable SUser userWhoPerformsAction, @NotNull BuildChainFactory buildChainFactory, @NotNull VcsModificationHistory vcsModificationHistory, @NotNull SecurityContextEx securityContext, @NotNull Collection<BuildCustomizerExtension> customizerExtensions)
-
-
Method Detail
-
setChangesCollectorFactory
public void setChangesCollectorFactory(@NotNull VcsChangesCollectorFactory changesCollectorFactory)
-
getBuildType
@NotNull public SBuildType getBuildType()
- Specified by:
getBuildTypein interfaceBuildCustomizer- Returns:
- build configuration to which custom build belongs.
-
getCurrentUser
@Nullable public SUser getCurrentUser()
- Specified by:
getCurrentUserin interfaceBuildCustomizer- Returns:
- user set to customizer during customizer instance creation.
-
setParameters
public void setParameters(@NotNull Map<String,String> customParams)Description copied from interface:BuildCustomizerSets custom parameters to the build, custom parameters will overwrite default parameters inherited from build configuration.- Specified by:
setParametersin interfaceBuildCustomizer- Parameters:
customParams- custom parameters map
-
setParameters
public void setParameters(@NotNull List<Parameter> customParams)Description copied from interface:BuildCustomizerExSame asBuildCustomizerEx.setParameters(List)but acceptingParameterinstances- Specified by:
setParametersin interfaceBuildCustomizerEx
-
addParametersIfAbsent
public void addParametersIfAbsent(@NotNull List<Parameter> customParams)Description copied from interface:BuildCustomizerExSame asBuildCustomizer.addParametersIfAbsent(Map)but acceptingParameterinstances- Specified by:
addParametersIfAbsentin interfaceBuildCustomizerEx
-
addParametersIfAbsent
public void addParametersIfAbsent(@NotNull Map<String,String> customParams)Description copied from interface:BuildCustomizerSame asBuildCustomizer.setParameters(Map)but doesn't overwrite parameters that have been set usingBuildCustomizer.setParameters(Map)before.- Specified by:
addParametersIfAbsentin interfaceBuildCustomizer
-
addParametersIfAbsent
public void addParametersIfAbsent(@NotNull Map<String,String> params, boolean passToDependencies)Description copied from interface:BuildCustomizerAdd parameters which should be passed to the build and probably to its dependencies, too- Specified by:
addParametersIfAbsentin interfaceBuildCustomizer- Parameters:
params- parameters, passed but do not overwrite already present onespassToDependencies- if set, the parameters will be set on dependencies, too
-
getCustomParameters
@NotNull public Map<String,Parameter> getCustomParameters()
- Specified by:
getCustomParametersin interfaceBuildCustomizerEx
-
setDependenciesSupplier
public void setDependenciesSupplier(@NotNull DependenciesSupplier supplier)Description copied from interface:BuildCustomizerExSets a custom dependencies supplier which should be used when a build promotion is created. The supplier allows to affect how build promotion build graph is created by providing dependencies different from those which are currently present in the build configuration.- Specified by:
setDependenciesSupplierin interfaceBuildCustomizerEx- Parameters:
supplier- dependencies supplier
-
setBuildPromotionInitializer
public void setBuildPromotionInitializer(@NotNull Consumer<BuildPromotionEx> initializer)Description copied from interface:BuildCustomizerExSets an initializer which accepts a newly created build promotion and does some initialization work there, for instance, it can set some specific settings. The initializer is not called for nodes which were specified viaBuildCustomizer.setSnapshotDependencyNodes(java.util.Collection<jetbrains.buildServer.serverSide.BuildPromotion>)method. The initializer is called as a final step, before returning the resulting build promotion.- Specified by:
setBuildPromotionInitializerin interfaceBuildCustomizerEx- Parameters:
initializer- initializer which is called for every newly created build promotion of the build chain.
-
setProvidedUpperLimitRevisions
public void setProvidedUpperLimitRevisions(@NotNull Map<Long,RepositoryVersion> upperLimitRevisions)Description copied from interface:BuildCustomizerExSets upper limit revisions map as "provided" upper limit revisions: they will be used instead of the current revision during the checking for changes process- Specified by:
setProvidedUpperLimitRevisionsin interfaceBuildCustomizerEx- Parameters:
upperLimitRevisions- map of VCS root instance id to repository version
-
setAttributes
public void setAttributes(@NotNull Map<String,String> attributes)Description copied from interface:BuildCustomizerSets custom attributes to the build- Specified by:
setAttributesin interfaceBuildCustomizer- Parameters:
attributes- custom attributes map
-
setRebuildDependencies
public void setRebuildDependencies(boolean rebuild)
Description copied from interface:BuildCustomizerSets whether all snapshot dependencies must be rebuild or not. This is the same as to set optionDependencyOptions.TAKE_STARTED_BUILD_WITH_SAME_REVISIONSto false for all snapshot dependencies.- Specified by:
setRebuildDependenciesin interfaceBuildCustomizer- Parameters:
rebuild- true to rebuild all dependencies
-
setRebuildDependencies
public void setRebuildDependencies(@NotNull Collection<String> buildTypeIds)Description copied from interface:BuildCustomizerSpecifies collection of build configurations where builds cannot be reused. Similar toBuildCustomizer.setRebuildDependencies(boolean)but works for a specific set of nodes. Note thatBuildCustomizer.setRebuildDependencies(boolean)(true) has higher priority.- Specified by:
setRebuildDependenciesin interfaceBuildCustomizer- Parameters:
buildTypeIds- ids of build configurations where builds reusing is disabled
-
setBuildComment
public void setBuildComment(@NotNull String buildComment)Description copied from interface:BuildCustomizerSets comment to the build. If comment is specified but user was not set to this customizer IllegalArgumentException is thrown.- Specified by:
setBuildCommentin interfaceBuildCustomizer- Parameters:
buildComment- comment to set
-
setChangesUpTo
public void setChangesUpTo(@NotNull SVcsModification modification)Description copied from interface:BuildCustomizerSpecifies the last change to include in this build.- Specified by:
setChangesUpToin interfaceBuildCustomizer- Parameters:
modification- the last change to include in the build
-
setUpToModificationSelectionMode
public void setUpToModificationSelectionMode(@NotNull BuildCustomizerEx.UpToModificationSelectionMode upToModificationSelectionMode)- Specified by:
setUpToModificationSelectionModein interfaceBuildCustomizerEx
-
addSkippedDependencies
public void addSkippedDependencies(@NotNull Collection<String> externalBuildTypeIds)- Specified by:
addSkippedDependenciesin interfaceBuildCustomizerEx- Parameters:
externalBuildTypeIds- for configurations which should be excluded/skipped in the build chain
-
setPersonal
public void setPersonal(boolean personal)
Description copied from interface:BuildCustomizerIf personal is true the personal build will be created with owner set to user who performs the action. If personal is true but user was not set to this customizer IllegalArgumentException is thrown.- Specified by:
setPersonalin interfaceBuildCustomizer- Parameters:
personal- true for personal build, false otherwise
-
setPersonalChangeId
public void setPersonalChangeId(long changeId)
Description copied from interface:BuildCustomizerSets id of a personal patch should be associated with the personal build.- Specified by:
setPersonalChangeIdin interfaceBuildCustomizer- Parameters:
changeId- personal patch id
-
setArtifactDependencies
public void setArtifactDependencies(@NotNull List<SArtifactDependency> customDependencies)Description copied from interface:BuildCustomizerSets custom artifact dependencies to the build. Custom dependencies will overwrite default dependencies completely.- Specified by:
setArtifactDependenciesin interfaceBuildCustomizer- Parameters:
customDependencies- collection of custom artifact dependencies
-
setStickToRevisions
public void setStickToRevisions(boolean stickToRevisions)
- Specified by:
setStickToRevisionsin interfaceBuildCustomizerEx
-
setSnapshotDependencyNodes
public void setSnapshotDependencyNodes(@NotNull Collection<BuildPromotion> promotions)Description copied from interface:BuildCustomizerSets custom nodes for the snapshot dependency graph. Each custom node will replace existing one for the same build configuration.- Specified by:
setSnapshotDependencyNodesin interfaceBuildCustomizer- Parameters:
promotions- nodes to insert in the snapshot dependency graph
-
setCleanSources
public void setCleanSources(boolean cleanSources)
Description copied from interface:BuildCustomizerIf cleanSources is true the build will re-checkout all the sources on agent (note: this setting does not affect snapshot dependencies anyhow).- Specified by:
setCleanSourcesin interfaceBuildCustomizer- Parameters:
cleanSources- true to re-checkout sources on agent.
-
setFreezeSettings
public void setFreezeSettings(@Nullable Boolean freezeSettings)- Specified by:
setFreezeSettingsin interfaceBuildCustomizerEx- See Also:
BuildPromotionEx.setFreezeSettings(Boolean)
-
setRebuildDependencies
public void setRebuildDependencies(@NotNull BuildCustomizerEx.RebuildDependenciesMode mode)Description copied from interface:BuildCustomizerExSets rebuild dependencies mode, seeBuildCustomizerEx.RebuildDependenciesMode.- Specified by:
setRebuildDependenciesin interfaceBuildCustomizerEx
-
setNodeRevisions
public void setNodeRevisions(@NotNull String buildTypeId, long modId, long chainModId, @NotNull Collection<BuildRevisionEx> revisions)Description copied from interface:BuildCustomizerExSets revision information to node of the build chain which corresponds to specified build configuration internal id- Specified by:
setNodeRevisionsin interfaceBuildCustomizerEx
-
setDesiredBranchName
public void setDesiredBranchName(@NotNull String branchName)Description copied from interface:BuildCustomizerSets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).- Specified by:
setDesiredBranchNamein interfaceBuildCustomizer- Parameters:
branchName- the branch name - empty string or display name of the default branch means default branch
-
setScheduledTime
public void setScheduledTime(@NotNull ZonedDateTime scheduledTime)Description copied from interface:BuildCustomizerExAllows to force the build to wait in the queue until some time in the future- Specified by:
setScheduledTimein interfaceBuildCustomizerEx- Parameters:
scheduledTime- - the time when build can start, i.e. it's guaranteed that it won't start before
-
setDesiredBranchName
public void setDesiredBranchName(@NotNull String branchName, boolean defaultBranchFallback)Description copied from interface:BuildCustomizerExSets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).- Specified by:
setDesiredBranchNamein interfaceBuildCustomizerEx- Parameters:
branchName- the branch name - empty string means default branchdefaultBranchFallback- true means that when display name of the default branch is passed, build in the default branch will be triggered. false just sets the branch name as passed
-
getDesiredBranchName
@Nullable public String getDesiredBranchName()
- Specified by:
getDesiredBranchNamein interfaceBuildCustomizerEx- Returns:
- the specified desired branch name, if any. Could be used by extensions to check if branch was set
-
createPromotion
@NotNull public BuildPromotionEx createPromotion() throws RuntimeException
Description copied from interface:BuildCustomizerCreates build promotion with all custom settings. Created build promotion can be added to the queue.- Specified by:
createPromotionin interfaceBuildCustomizer- Returns:
- new build promotion
- Throws:
RuntimeException- if some problem occurred
-
setTagDatas
public void setTagDatas(@NotNull Set<TagData> tags)Description copied from interface:BuildCustomizerSets build tags- Specified by:
setTagDatasin interfaceBuildCustomizer
-
setApplyTagsToDependencies
public void setApplyTagsToDependencies(boolean value)
Description copied from interface:BuildCustomizerExMarks if tags should be applied to all builds that this build snapshot depends on- Specified by:
setApplyTagsToDependenciesin interfaceBuildCustomizerEx
-
setApplyCleanSourcesToDependencies
public void setApplyCleanSourcesToDependencies(boolean apply)
Description copied from interface:BuildCustomizerExIf apply is true, then applies clean sources configuration to all of the snapshot dependencies.- Specified by:
setApplyCleanSourcesToDependenciesin interfaceBuildCustomizerEx
-
setAddToFavorites
public void setAddToFavorites(boolean addToFavorites)
Description copied from interface:BuildCustomizerExControl whether build will be added to favorite or not Overrides StandardProperties.ADD_TRIGGERED_BUILD_TO_FAVORITES- Specified by:
setAddToFavoritesin interfaceBuildCustomizerEx- See Also:
FavoriteBuildsManager
-
setPromotedBuild
public void setPromotedBuild(@NotNull SBuild promotedBuild, @NotNull Predicate<RevisionRule> artifDependencyRevisionPredicate)Description copied from interface:BuildCustomizerExPromotes build into dependencies of the build created by this build customizer. If there is a snapshot dependency on build configuration of provided build, then corresponding modification id will be calculated and set and snapshot dependencies will be modified. If there are artifact dependencies on build configuration of provided build (except the same chain dependencies, they will be left intact), then they will be modified to have direct dependencies on this build.- Specified by:
setPromotedBuildin interfaceBuildCustomizerEx- Parameters:
promotedBuild- build to promoteartifDependencyRevisionPredicate- dependent build configuration can have many artifact dependencies with different rules pointing to the build configuration of promoted build; this predicate determines which revision rules must be changed to point at the promoted build.
-
-