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 class
BuildCustomizerImpl.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 void
addParametersIfAbsent(List<Parameter> customParams)
Same asBuildCustomizer.addParametersIfAbsent(Map)
but acceptingParameter
instancesvoid
addParametersIfAbsent(Map<String,String> customParams)
Same asBuildCustomizer.setParameters(Map)
but doesn't overwrite parameters that have been set usingBuildCustomizer.setParameters(Map)
before.void
addParametersIfAbsent(Map<String,String> params, boolean passToDependencies)
Add parameters which should be passed to the build and probably to its dependencies, toovoid
addSkippedDependencies(Collection<String> externalBuildTypeIds)
BuildPromotionEx
createPromotion()
Creates build promotion with all custom settings.SBuildType
getBuildType()
SUser
getCurrentUser()
Map<String,Parameter>
getCustomParameters()
String
getDesiredBranchName()
void
setAddToFavorites(boolean addToFavorites)
Control whether build will be added to favorite or not Overrides StandardProperties.ADD_TRIGGERED_BUILD_TO_FAVORITESvoid
setApplyCleanSourcesToDependencies(boolean apply)
If apply is true, then applies clean sources configuration to all of the snapshot dependencies.void
setApplyTagsToDependencies(boolean value)
Marks if tags should be applied to all builds that this build snapshot depends onvoid
setArtifactDependencies(List<SArtifactDependency> customDependencies)
Sets custom artifact dependencies to the build.void
setAttributes(Map<String,String> attributes)
Sets custom attributes to the buildvoid
setBuildComment(String buildComment)
Sets comment to the build.void
setBuildPromotionInitializer(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.void
setChangesCollectorFactory(VcsChangesCollectorFactory changesCollectorFactory)
void
setChangesUpTo(SVcsModification modification)
Specifies the last change to include in this build.void
setCleanSources(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).void
setDependenciesSupplier(DependenciesSupplier supplier)
Sets a custom dependencies supplier which should be used when a build promotion is created.void
setDesiredBranchName(String branchName)
Sets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).void
setDesiredBranchName(String branchName, boolean defaultBranchFallback)
Sets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).void
setFreezeSettings(Boolean freezeSettings)
void
setNodeRevisions(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 idvoid
setParameters(List<Parameter> customParams)
Same asBuildCustomizerEx.setParameters(List)
but acceptingParameter
instancesvoid
setParameters(Map<String,String> customParams)
Sets custom parameters to the build, custom parameters will overwrite default parameters inherited from build configuration.void
setPersonal(boolean personal)
If personal is true the personal build will be created with owner set to user who performs the action.void
setPersonalChangeId(long changeId)
Sets id of a personal patch should be associated with the personal build.void
setPromotedBuild(SBuild promotedBuild, Predicate<RevisionRule> artifDependencyRevisionPredicate)
Promotes build into dependencies of the build created by this build customizer.void
setProvidedUpperLimitRevisions(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 processvoid
setRebuildDependencies(boolean rebuild)
Sets whether all snapshot dependencies must be rebuild or not.void
setRebuildDependencies(Collection<String> buildTypeIds)
Specifies collection of build configurations where builds cannot be reused.void
setRebuildDependencies(BuildCustomizerEx.RebuildDependenciesMode mode)
Sets rebuild dependencies mode, seeBuildCustomizerEx.RebuildDependenciesMode
.void
setScheduledTime(ZonedDateTime scheduledTime)
Allows to force the build to wait in the queue until some time in the futurevoid
setSnapshotDependencyNodes(Collection<BuildPromotion> promotions)
Sets custom nodes for the snapshot dependency graph.void
setStickToRevisions(boolean stickToRevisions)
void
setTagDatas(Set<TagData> tags)
Sets build tagsvoid
setUpToModificationSelectionMode(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:
getBuildType
in interfaceBuildCustomizer
- Returns:
- build configuration to which custom build belongs.
-
getCurrentUser
@Nullable public SUser getCurrentUser()
- Specified by:
getCurrentUser
in interfaceBuildCustomizer
- Returns:
- user set to customizer during customizer instance creation.
-
setParameters
public void setParameters(@NotNull Map<String,String> customParams)
Description copied from interface:BuildCustomizer
Sets custom parameters to the build, custom parameters will overwrite default parameters inherited from build configuration.- Specified by:
setParameters
in interfaceBuildCustomizer
- Parameters:
customParams
- custom parameters map
-
setParameters
public void setParameters(@NotNull List<Parameter> customParams)
Description copied from interface:BuildCustomizerEx
Same asBuildCustomizerEx.setParameters(List)
but acceptingParameter
instances- Specified by:
setParameters
in interfaceBuildCustomizerEx
-
addParametersIfAbsent
public void addParametersIfAbsent(@NotNull List<Parameter> customParams)
Description copied from interface:BuildCustomizerEx
Same asBuildCustomizer.addParametersIfAbsent(Map)
but acceptingParameter
instances- Specified by:
addParametersIfAbsent
in interfaceBuildCustomizerEx
-
addParametersIfAbsent
public void addParametersIfAbsent(@NotNull Map<String,String> customParams)
Description copied from interface:BuildCustomizer
Same asBuildCustomizer.setParameters(Map)
but doesn't overwrite parameters that have been set usingBuildCustomizer.setParameters(Map)
before.- Specified by:
addParametersIfAbsent
in interfaceBuildCustomizer
-
addParametersIfAbsent
public void addParametersIfAbsent(@NotNull Map<String,String> params, boolean passToDependencies)
Description copied from interface:BuildCustomizer
Add parameters which should be passed to the build and probably to its dependencies, too- Specified by:
addParametersIfAbsent
in 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:
getCustomParameters
in interfaceBuildCustomizerEx
-
setDependenciesSupplier
public void setDependenciesSupplier(@NotNull DependenciesSupplier supplier)
Description copied from interface:BuildCustomizerEx
Sets 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:
setDependenciesSupplier
in interfaceBuildCustomizerEx
- Parameters:
supplier
- dependencies supplier
-
setBuildPromotionInitializer
public void setBuildPromotionInitializer(@NotNull Consumer<BuildPromotionEx> initializer)
Description copied from interface:BuildCustomizerEx
Sets 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:
setBuildPromotionInitializer
in 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:BuildCustomizerEx
Sets 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:
setProvidedUpperLimitRevisions
in 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:BuildCustomizer
Sets custom attributes to the build- Specified by:
setAttributes
in interfaceBuildCustomizer
- Parameters:
attributes
- custom attributes map
-
setRebuildDependencies
public void setRebuildDependencies(boolean rebuild)
Description copied from interface:BuildCustomizer
Sets whether all snapshot dependencies must be rebuild or not. This is the same as to set optionDependencyOptions.TAKE_STARTED_BUILD_WITH_SAME_REVISIONS
to false for all snapshot dependencies.- Specified by:
setRebuildDependencies
in interfaceBuildCustomizer
- Parameters:
rebuild
- true to rebuild all dependencies
-
setRebuildDependencies
public void setRebuildDependencies(@NotNull Collection<String> buildTypeIds)
Description copied from interface:BuildCustomizer
Specifies 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:
setRebuildDependencies
in interfaceBuildCustomizer
- Parameters:
buildTypeIds
- ids of build configurations where builds reusing is disabled
-
setBuildComment
public void setBuildComment(@NotNull String buildComment)
Description copied from interface:BuildCustomizer
Sets comment to the build. If comment is specified but user was not set to this customizer IllegalArgumentException is thrown.- Specified by:
setBuildComment
in interfaceBuildCustomizer
- Parameters:
buildComment
- comment to set
-
setChangesUpTo
public void setChangesUpTo(@NotNull SVcsModification modification)
Description copied from interface:BuildCustomizer
Specifies the last change to include in this build.- Specified by:
setChangesUpTo
in interfaceBuildCustomizer
- Parameters:
modification
- the last change to include in the build
-
setUpToModificationSelectionMode
public void setUpToModificationSelectionMode(@NotNull BuildCustomizerEx.UpToModificationSelectionMode upToModificationSelectionMode)
- Specified by:
setUpToModificationSelectionMode
in interfaceBuildCustomizerEx
-
addSkippedDependencies
public void addSkippedDependencies(@NotNull Collection<String> externalBuildTypeIds)
- Specified by:
addSkippedDependencies
in interfaceBuildCustomizerEx
- Parameters:
externalBuildTypeIds
- for configurations which should be excluded/skipped in the build chain
-
setPersonal
public void setPersonal(boolean personal)
Description copied from interface:BuildCustomizer
If 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:
setPersonal
in interfaceBuildCustomizer
- Parameters:
personal
- true for personal build, false otherwise
-
setPersonalChangeId
public void setPersonalChangeId(long changeId)
Description copied from interface:BuildCustomizer
Sets id of a personal patch should be associated with the personal build.- Specified by:
setPersonalChangeId
in interfaceBuildCustomizer
- Parameters:
changeId
- personal patch id
-
setArtifactDependencies
public void setArtifactDependencies(@NotNull List<SArtifactDependency> customDependencies)
Description copied from interface:BuildCustomizer
Sets custom artifact dependencies to the build. Custom dependencies will overwrite default dependencies completely.- Specified by:
setArtifactDependencies
in interfaceBuildCustomizer
- Parameters:
customDependencies
- collection of custom artifact dependencies
-
setStickToRevisions
public void setStickToRevisions(boolean stickToRevisions)
- Specified by:
setStickToRevisions
in interfaceBuildCustomizerEx
-
setSnapshotDependencyNodes
public void setSnapshotDependencyNodes(@NotNull Collection<BuildPromotion> promotions)
Description copied from interface:BuildCustomizer
Sets custom nodes for the snapshot dependency graph. Each custom node will replace existing one for the same build configuration.- Specified by:
setSnapshotDependencyNodes
in interfaceBuildCustomizer
- Parameters:
promotions
- nodes to insert in the snapshot dependency graph
-
setCleanSources
public void setCleanSources(boolean cleanSources)
Description copied from interface:BuildCustomizer
If cleanSources is true the build will re-checkout all the sources on agent (note: this setting does not affect snapshot dependencies anyhow).- Specified by:
setCleanSources
in interfaceBuildCustomizer
- Parameters:
cleanSources
- true to re-checkout sources on agent.
-
setFreezeSettings
public void setFreezeSettings(@Nullable Boolean freezeSettings)
- Specified by:
setFreezeSettings
in interfaceBuildCustomizerEx
- See Also:
BuildPromotionEx.setFreezeSettings(Boolean)
-
setRebuildDependencies
public void setRebuildDependencies(@NotNull BuildCustomizerEx.RebuildDependenciesMode mode)
Description copied from interface:BuildCustomizerEx
Sets rebuild dependencies mode, seeBuildCustomizerEx.RebuildDependenciesMode
.- Specified by:
setRebuildDependencies
in interfaceBuildCustomizerEx
-
setNodeRevisions
public void setNodeRevisions(@NotNull String buildTypeId, long modId, long chainModId, @NotNull Collection<BuildRevisionEx> revisions)
Description copied from interface:BuildCustomizerEx
Sets revision information to node of the build chain which corresponds to specified build configuration internal id- Specified by:
setNodeRevisions
in interfaceBuildCustomizerEx
-
setDesiredBranchName
public void setDesiredBranchName(@NotNull String branchName)
Description copied from interface:BuildCustomizer
Sets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).- Specified by:
setDesiredBranchName
in 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:BuildCustomizerEx
Allows to force the build to wait in the queue until some time in the future- Specified by:
setScheduledTime
in 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:BuildCustomizerEx
Sets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).- Specified by:
setDesiredBranchName
in 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:
getDesiredBranchName
in 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:BuildCustomizer
Creates build promotion with all custom settings. Created build promotion can be added to the queue.- Specified by:
createPromotion
in interfaceBuildCustomizer
- Returns:
- new build promotion
- Throws:
RuntimeException
- if some problem occurred
-
setTagDatas
public void setTagDatas(@NotNull Set<TagData> tags)
Description copied from interface:BuildCustomizer
Sets build tags- Specified by:
setTagDatas
in interfaceBuildCustomizer
-
setApplyTagsToDependencies
public void setApplyTagsToDependencies(boolean value)
Description copied from interface:BuildCustomizerEx
Marks if tags should be applied to all builds that this build snapshot depends on- Specified by:
setApplyTagsToDependencies
in interfaceBuildCustomizerEx
-
setApplyCleanSourcesToDependencies
public void setApplyCleanSourcesToDependencies(boolean apply)
Description copied from interface:BuildCustomizerEx
If apply is true, then applies clean sources configuration to all of the snapshot dependencies.- Specified by:
setApplyCleanSourcesToDependencies
in interfaceBuildCustomizerEx
-
setAddToFavorites
public void setAddToFavorites(boolean addToFavorites)
Description copied from interface:BuildCustomizerEx
Control whether build will be added to favorite or not Overrides StandardProperties.ADD_TRIGGERED_BUILD_TO_FAVORITES- Specified by:
setAddToFavorites
in interfaceBuildCustomizerEx
- See Also:
FavoriteBuildsManager
-
setPromotedBuild
public void setPromotedBuild(@NotNull SBuild promotedBuild, @NotNull Predicate<RevisionRule> artifDependencyRevisionPredicate)
Description copied from interface:BuildCustomizerEx
Promotes 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:
setPromotedBuild
in 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.
-
-