Package jetbrains.buildServer.serverSide
Interface BuildCustomizer
-
- All Known Subinterfaces:
BuildCustomizerEx
- All Known Implementing Classes:
BuildCustomizerImpl
public interface BuildCustomizer
This class can be used to create and/or add custom builds to the queue. To create instance of the class useBuildCustomizerFactory
- Since:
- 7.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addParametersIfAbsent(Map<String,String> params)
Same assetParameters(Map)
but doesn't overwrite parameters that have been set usingsetParameters(Map)
before.void
addParametersIfAbsent(Map<String,String> params, boolean passToDependencies)
Add parameters which should be passed to the build and probably to its dependencies, tooBuildPromotion
createPromotion()
Creates build promotion with all custom settings.SBuildType
getBuildType()
SUser
getCurrentUser()
void
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
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
setDesiredBranchName(String branchName)
Sets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).void
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
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
setSnapshotDependencyNodes(Collection<BuildPromotion> promotions)
Sets custom nodes for the snapshot dependency graph.void
setTagDatas(Set<TagData> tags)
Sets build tags
-
-
-
Method Detail
-
getBuildType
@NotNull SBuildType getBuildType()
- Returns:
- build configuration to which custom build belongs.
-
getCurrentUser
@Nullable SUser getCurrentUser()
- Returns:
- user set to customizer during customizer instance creation.
-
setParameters
void setParameters(@NotNull Map<String,String> customParams)
Sets custom parameters to the build, custom parameters will overwrite default parameters inherited from build configuration.- Parameters:
customParams
- custom parameters map
-
addParametersIfAbsent
void addParametersIfAbsent(@NotNull Map<String,String> params)
Same assetParameters(Map)
but doesn't overwrite parameters that have been set usingsetParameters(Map)
before.- Since:
- 2021.1
-
addParametersIfAbsent
void addParametersIfAbsent(@NotNull Map<String,String> params, boolean passToDependencies)
Add parameters which should be passed to the build and probably to its dependencies, too- Parameters:
params
- parameters, passed but do not overwrite already present onespassToDependencies
- if set, the parameters will be set on dependencies, too- Since:
- 2021.2.2
-
setAttributes
void setAttributes(@NotNull Map<String,String> attributes)
Sets custom attributes to the build- Parameters:
attributes
- custom attributes map
-
setRebuildDependencies
void setRebuildDependencies(boolean rebuild)
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.- Parameters:
rebuild
- true to rebuild all dependencies
-
setRebuildDependencies
void setRebuildDependencies(@NotNull Collection<String> buildTypeIds)
Specifies collection of build configurations where builds cannot be reused. Similar tosetRebuildDependencies(boolean)
but works for a specific set of nodes. Note thatsetRebuildDependencies(boolean)
(true) has higher priority.- Parameters:
buildTypeIds
- ids of build configurations where builds reusing is disabled
-
setBuildComment
void setBuildComment(@NotNull String buildComment)
Sets comment to the build. If comment is specified but user was not set to this customizer IllegalArgumentException is thrown.- Parameters:
buildComment
- comment to set
-
setChangesUpTo
void setChangesUpTo(@NotNull SVcsModification modification)
Specifies the last change to include in this build.- Parameters:
modification
- the last change to include in the build
-
setPersonal
void setPersonal(boolean personal)
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.- Parameters:
personal
- true for personal build, false otherwise
-
setPersonalChangeId
void setPersonalChangeId(long changeId)
Sets id of a personal patch should be associated with the personal build.- Parameters:
changeId
- personal patch id- Since:
- 2019.1
-
setArtifactDependencies
void setArtifactDependencies(@NotNull List<SArtifactDependency> customDependencies)
Sets custom artifact dependencies to the build. Custom dependencies will overwrite default dependencies completely.- Parameters:
customDependencies
- collection of custom artifact dependencies
-
setSnapshotDependencyNodes
void setSnapshotDependencyNodes(@NotNull Collection<BuildPromotion> promotions)
Sets custom nodes for the snapshot dependency graph. Each custom node will replace existing one for the same build configuration.- Parameters:
promotions
- nodes to insert in the snapshot dependency graph
-
setCleanSources
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).- Parameters:
cleanSources
- true to re-checkout sources on agent.
-
setDesiredBranchName
void setDesiredBranchName(@NotNull String branchName)
Sets the desired branch name for the build promotion (will be propagated to the whole snapshot dependency graph).- Parameters:
branchName
- the branch name - empty string or display name of the default branch means default branch- Since:
- 7.1
-
createPromotion
@NotNull BuildPromotion createPromotion()
Creates build promotion with all custom settings. Created build promotion can be added to the queue.- Returns:
- new build promotion
- Throws:
RuntimeException
- if some problem occurred
-
-